Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to update auto-renewable subscription receipt

I am trying to implement an auto-renewable subscription in an app, it works like this:

  1. The user buys a subscription.
  2. The app gets the receipt and sends it to my webService.
  3. My webService verifies the receipt, changes the role of the user from Free to VIP and also records the receipt.

Now the question: When the expiration date comes, should I verify the receipt at my webService or in the app?

  • If it is on the webService, should I attempt to verify the old receipt (stored) and Apple returns to me the latest one if renewed or cancelled?

  • If it is on the app how should I proceed? Is there some kind of notification from storeKit when the subscription is renewed or cancelled?

If the right approach is the second (App), since my webService controls whether the role of the user is Free or VIP, every time a renewal happens I will have to send the latest receipt to my webService, so, it can manage the user's role properly. That's why I need to know how and when to get the latest receipt to send.

like image 309
rihurla Avatar asked Feb 11 '23 04:02

rihurla


1 Answers

The more useful approach is the first one - through your web Service. When you will attempt to verify the old receipt (stored) and Apple may respond in one of the following two ways:

  1. If user has not cancelled the subscription, you will get the latest receipt with the expiration date extended.
  2. If user has cancelled the subscription, you will get the receipt with the old expiration date only.

So based on the expiration date you can create your logic to whether extend the VIP membership or not.

Additionally, you can configure your authentication call on app side to re-authenticate user every 12 hours or 24 hours so you will get the updated membership status as well.

like image 85
Vikas Dadheech Avatar answered Feb 24 '23 01:02

Vikas Dadheech