Managing Multi platform Application In-App Purchases - android

I am developing an App with Flutter and Firebase as backend. Here in the app, I want to use to the In-App purchases with trial for a month and then monthly or yearly Subscription on both iOS and Android Platforms.
Can anyone suggest the better way to work with the scenario like this?
The way I know is to upload the receipt from both platforms on server for verification from corresponding Store (we can verify receipts on App end as well for first time) and update the User node with In-App purchase related info. Then we can Schedule a cron to verify In-app purchase day before (basically two days i.e Day before and on Expiration day if not updated) the subscription get over.
And how we can manage it with Firebase only without cost for additional server to put the logic files to verify the In-App Purchases?
Thanks

Related

How to test InAppPurchase Subscription renewal in sandbox mode

I am using InAppPurchase to sell subscription to users with one month plan.
Setup is done and i can test Purchase flow, but renewal is not working in sand-box mode.
I am using billing library version 4
implementation 'com.android.billingclient:billing:4.0.0'
After successfull purchase while validating receipt on server side getting autoRenew param in json with value blank. After 5 min plan is expired as describe in doc, but as per doc auto renew will expires after 6 times. In my case after first purchase auto renew not happening.
Can any one help me in this where i am wrong in this.
I already spent 4 days in searching for this issue.
Thanks in advance
From your screenshot I'm deducing you are in India.
A few months ago, Google has announced that it would pause new signups of auto-renewing subscriptions for users in India:
Subscriptions will continue to be available as single access passes that provide users a single billing period of access (eg. 1-month access). At the end of the billing duration, Google says users will need to sign up again in order to continue their subscription.
source: https://www.xda-developers.com/google-play-suspend-free-trials-auto-renewing-subscriptions/
Maybe you should try to test on another market.

How to handle renewal of autorenewable subscriptions (ios/android)?

Perhaps I am simply not looking in the correct places, but I am surprised at the lack of documentation around cross-platform apps incorporating renewing subscriptions.
I have a cross-platform (iOS and Android) Ionic app with a Rails API for the back-end. I am using https://github.com/AlexDisler/cordova-plugin-inapppurchase as a wrapper around the iOS/Google store SDKs.
My question revolves around subscription renewal:
From what I gather, it is recommended that I have a daily job checking each of my subscriptions for their expiration date. If a subscription is about to expire, I can send the receipt stored in my database to either Google/Apple and check if the subscription has been renewed. If it has, I update the expiration date and keep the subscription active. If the subscription has not been renewed, I mark the subscription as inactive.
Now, what happens if a user renews a subscription? How will I know that a subscription has been renewed? And when do I check for subscription renewal? Seems like my options are:
Every day, check every expired subscription for renewal. Problems with this: 1) as the number of users grows, so will the number of users with expired subscriptions. Eventually, this will result in checking many, many expired subscriptions every night. 2) A user will be unable to access subscription-only content between the time they renew their subscription through the app/play store and the nightly subscription-checking job is run.
Every time a user with an expired subscription logs into the app, check to see if they have renewed their subscription. Problems with this: 1) My app uses token authentication. Therefore, users are not required to login with each use. So, if a user renews their subscription, but their token is still valid, the app will have no way of knowing that their subscription is up-to-date.
Is there another option? What am I missing here?
I would suggest using a combination of both options.
When a user opens your app you should send a separate request to your backend that will fetch the receipt a check if its renewed and cache the expiration date and the time it was checked. Then I would have another job run nightly that doesn't check all the expired receipts, but clears the expiration date cache if it hasn't been checked within a certain period. Then, the next time a user opens the app, the cache will be empty and and will be fetched.
I'm working on adding Android subscriptions to RevenueCat but it won't be ready for a couple months.

how to reliably detect subscription changes in android in app billing on the server

We are creating an app in which we have two different premium models: silver and gold. Both are monthly recurring subscriptions.
On the server we store which user has subscribed to which premium membership and the date when it will expire. At the expiration day we'll check via the Purchase.subscriptions HTTP API from the server if the subscription was renewed and remove the premium status if it wasn't.
But how should we handle subscription downgrades? Assume the user buys the more expensive gold version and then after one day downgrades to the silver version. Our server would only check after one month and recognise that the user downgraded.
The premium memberships are also usable on other platforms like iOS. That's why solutions involving the client won't properly work.
Do we have to poll the Purchase.subscriptions Api from our server on a regular basis?

InApp Subscriptions or Google Wallet

I have gone through most of the links here on stackoverflow and i have some doubts regarding InApp Subscriptions and Google Wallet.
What i know:
InApp Subscriptions basically allows a user to be able to subscribe to an app, say for example if it offers one year trial period, then once thats over, Google automatically handles the subscriptions then after.
Google Wallet, its a method that can be used to perform the purchase. What i don't understand is, can i use this method in order to allow users to use the app for one year, and then make them pay for the next years?
Billing continues indefinitely at the interval and price specified for the subscription. At each subscription renewal, Google Play charges the user account automatically, then notifies the user of the charges afterward by email. For monthly and annual subscriptions, billing cycles will always match subscription cycles, based on the purchase date. (Seasonal subscriptions are charged annually, on the first day of the season.)
This is what happens in my app:
1. A user logs in, and i get a date that probably keeps track of the billing cycle
2. If the sessions expired, the user is asked to pay using the inApp Billing serivce
3. Based on TrivailDriveApp Example, where we have the success log printed on subscription, we update the date of payment.
Some questions i have:
As per the quote from android, if the user is automatically subscribed to the service, and if a mail is sent to the user, does that mean that i would never be able to get a notification about the payment extension? How do i sync that with the server then?
Is my approach wrong in handling this kind of scenario? Or do i have to select a different method of handling app extensions?
P.S: There is no way of testing inapp subscriptions also. I wonder if i could do that without using real credit/debit card credentials.
EDIT:
I would also want to keep track of when the purchase or billing was done, if subscriptions are auto-renewed, then should i take up the purchase flow as an InApp Product instead of an InApp Subscription?
Please help.

In Android In-App Billing, how can I get back all the payments for a subscription product?

Before I explain my question, let me give an example situation.
A user of a magazine app subscribes to the monthly subscription on the month of August and September. If the user reformats the phone, the app should be able to restore both August and September month's magazines.
The problem with this is that, the In-App Billing API returns only the latest subscription and whether the subscription is active.
Also, I want the users to be able view the previous months' magazines even if they have canceled their subscription.
Is there a way to keep track of all payments made by the user?
This likely would involve your own independent servers and "developer payload" information. As stated in this Subscriptions link:
Include business logic in your app to notify your backend servers of subscription purchases, tokens, and any billing errors that may occur. Your backend servers can use the server-side API to query and update your records and follow up with customers directly, if needed.
In other words, you should be keeping track of this--unfortunately.
Further, you can check this api reference as to whether a user's subscription purchase is valid.

Categories

Resources