Subscriptions in Stripe - if a subscription payment didn't pan out - ruby-on-rails

I'm working on a Rails app where I'm using stripe for creating subscriptions. Suppose, the first month the user has been charged successfully but on the second month their bank card got expired or ran out of money and they, obviously, weren't charged. How would I, as an admin of that Rails app, know if such the case has happened with one of my users?

Check api for callback after payment process, there must be something which would notify your app regarding payment(if it was succesfull or failure), and afterwards do some actions.

Related

Google Play store cancels every subscription

If a user subscribes in-app, it is always refunded exactly three days later. Like this:
Intended behaviour is for the subscription to remain activated and payment not to be refunded.
Why might this happen?
Google has updated its In-App payment policies a while back and you'd need to acknowledge the payment within three days in order to retain the payment. Otherwise, your payment would get automatically refunded.
There is a new acknowledge() method available so you'd need to acknowledge your purchase.
Google states that the acknowledgement should only place after processing and granting the said features that come with In-App purchase.
See more information here.
If you do not acknowledge a purchase within three days, the user automatically receives a refund, and Google Play revokes the purchase.
https://developer.android.com/google/play/billing/billing_library_releases_notes#release-2_0

Is is possible to pre-authorize delayed in-app payments using Apple Pay?

Is it possible to make user pre-authorize a payment in an app but the actual payment occurs at a specified later date? User will know when the payment actually takes place when she authorizes the payment.
This is not regular recurring subscription, but more like one-off payments user can make at any interval.
If not, is there a payment solution that can be integrated with iOS and offers this feature?
Using Stripe, you can save the Apple Pay token to a customer and charge it at any time. Authorization and Capture is supported with Stripe but you have to capture the funds within 7 days of authorizing it.

Handling cancellations for iOS In-App-Purchase recurring subscriptions

I've been looking for a solution for hours, but I haven't found it yet.
I have a freemium app, where you can buy 3 month plans via iOS IAP, or via Stripe.
When a customer buys via stripe and their card fails, or when they cancel the subscription, my app receives a webhook and I can mark that customer as delinquent. This way I can report that customer as lost, and take actions to reengage with them.
However, with iOS I don't seem to have this possibility. One solution for this would be to keep a marker in my database for the start_date and renewal_date of that subscription, and mark them as lost only when they've failed a payment.
That'd be quite inconvenient, and I was wondering if there's a better way to validate with iTunes connect whether a user cancelled.

iOS In-App purchase subscriptions integration with a third party system

I need to build an app for a system, which already has a subscription on its website. It looks like Apple doesn't allow to use any own subscriptions and forces to integrate any app with iOS in-app subscriptions.
Is it any way to integrate two subscription systems? The main problem is that users can manage iOS subscriptions via iTunes and I can't find whether it's possible to get information about this and to stop subscription in the existing system if it's stopped via iTunes.
So is it possible to get notifications about unsubscribed iTunes users?
Using third party subscriptions
First off, it is possible to support an existing subscription system in your app, but it must be in addition to the App Store subscriptions. Also you have to be very careful about the UI you use. You can't prompt users to bypass the App Store and purchase through your server, but you can offer existing subscribers the ability to sign in with credentials they may have previously obtained through your website.
That said, Apple can be fairly capricious in their rulings on what is and isn't allowed in the App Store. I have worked on apps that have done this sort of thing, but they have been for fairly well known magazine publications. There's no guarantee that they will allow it for everyone.
Detecting unsubscribed App Store subscriptions
As for using App Store subscriptions, when a user purchases a subscription in your app, they will receive a receipt in the SKPaymentTransaction object. This receipt should be posted to your backend server to make sure it is valid before you give the user access to anything. See the In-App Purchase Programming Guide for more details.
When you setup a subscription type, you specify how long that subscription lasts. So if you log the transaction date in the SKPaymentTransaction when you receive a receipt, you can determine exactly when that subscription should expire by adding the duration of the subscription to the transaction date.
If it's an auto-renewing subscription, you will receive a new receipt when the subscription is renewed. So once you have validated that with your backend server, you can update your expiry date based on the new transaction date. If you don't receive a new receipt before the first one expires, it's likely the user has cancelled their subscription.
On the backend, your server can also tell when a particular subscription will expire based on the response from the verification server. First there is the status code which will tell you whether the subscription has already expired, but there is also an expiry date returned in the decoded receipt which will tell you when it is expected to expire if it hasn't already.
For more details, see the Auto-Renewable Subscriptions documentation.
Testing auto-renewing subscriptions
It's worth noting that when you are testing auto-renewing subscriptions in the App Store sandbox environment, the length of the various subscription types is dramatically shortened to make it easier to test. For example a 1 week subscription lasts only 3 minutes in the sandbox environment. You can see the full list of times in the iTunes Connect Developer Guide.
So you want the people that have bought the service from the website to be able to use the app, exactly like if they had purchased it from in App Purchases and in App Purchases people to be able to join the service just like people that joined through the site? As far as I know, Apple doesn't allow you to pay through other services as you said, but let's say someone buys the service from the app. What should happen would be that the money will be transferred to the company. Then after the payment you should include some code doing what the site does after a new person has payed for the service, so create his account as a paid account. Then, the app should also have a login screen where the registered users (no matter where they registered from) will be able to login into the app and use the service. Now the problem is indeed that if the subscription is stopped through iTunes you would never know, though a way around this would be to make a check in the server of this company which should monitor the income coming from one account. Then if this user has stopped paying (or stopped the subscription) you would be able to stop the service from the app. And you should recheck the server for payment after the duration of the subscription has passed, let's say a weekly subscription should be checked every week. (Sorry I would do this a comment but I haven't got enough reputation for this)

How to Integrate Authorize.Net ARB and AIM together

I want to Integrate Authorized.Net ARB and AIM together using rails.
Actually, I want Instant payment when user signs up today and I want the subscription to start today. for this i want to charge their first payment via the AIM API. and if AIM tranaction get succeed then only i will create ARB.I write code for both my ARB works perfect but when i write code for the AIM it gives error This transaction has been declined but when i create an ARB with same card it works perfectly.I really don't know how to go for this.
Also I want to know when subscription is declined when processing a future scheduled payment is Authorize.Net cancelled that Subscription or try again on next day?if it try next day again how many times it will try? Can I check or write a code using SILENT POST that after 5 times it's subscription should get cancelled.
ARB performs no validation of a credit card when a subscription is created (other then validating the card has a valid card number format, properly formatted expiration date, etc and won't expire before the first payment is scheduled for). Therefore you have to use AIM to validate the card first, either by running a transaction or performing an AUTH_ONLY, and then if it is successful establish the subscription with ARB. Basically once you get that decline from AIM your script should abort and notify the user of the error and have them try again with a new credit card.
If a subscription payment is declined the subscription will be suspended. If you update the subscription before the next scheduled payment is due the missed payment will automatically be attempted again and if successful the subscription will be active again.
There is no way through any current API to check the status of a subscription. It currently can only be done through the control panel. It is on their to do list so this may change in the future.
UPDATE 2011-12-01
The ARB API now offers the ARBGetSubscriptionStatusRequest call to get a subscription's status.

Resources