1
votes

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?

1
On iOS the app will receive an updated receipt with the new subscription details. The app should provide this updated receipt to your server when the user opens it - Paulw11
@Paulw11 - how do I receive this updated receipt? Do you have a link to this documentation? I also wonder if github.com/AlexDisler/cordova-plugin-inapppurchase supports this functionality. Also, does Android offer something similar? - Joel Brewer
It is covered in the Apple in app purchasing guide. developer.apple.com/library/content/documentation/… Apple can also POST to your server to advise you of renewals. - Paulw11
@Paulw11saw that -- trying to determine if I need to integrate those notifications into my app (it does add a bit of complexity, and we're on a tight schedule). Also trying to figure out Android in tandem. - Joel Brewer

1 Answers

1
votes

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.