Auto-Renewal Subscription (In-App Purchase - Server)

393 views Asked by At

I have a doubt with Auto-renewal subscription (In-App purchase). I need to keep the subscription on my server (with it’s own account management, login/registration), because the user can move to another device (or platform).

Suppose the following scenario: “User A” subscribe to the app (with it’s Apple Id), I know that a receipt document is created on the device (that contains all the purchases by this user ~ AppleId), then the SKPaymentQueue will dispatch a transaction to the delegate, and from my side need to communicate the receipt (base64) to server and after received response finish the transaction. Now, let’s suppose that “User B” use my app in the same device (and he is not subscribed ~ according to my server):

  1. Can I still show the options to subscribe? (I mean, although he is using the same Apple ID that user A).
  2. If the purchase is created in the same receipt, how can I differentiate between user A and B?
  3. Same as before, when the server-to-server (AppStore - My Server) notification is send with an update to a subscription, how can I differentiate between user A and B?
  4. If the user B go to settings (In App-Purchase) will show that have a subscription (but in reality for user A)?
2

There are 2 answers

0
the.evangelist On

Couple of things here, are you building this app for personal device or shared (ie enterprise) devices?

If its for personal device, why would User-A let User-B login into his device? However if its an app for shared device then yes, User-B would be able to restore the payments (using User-A's AppleId) as highlighted in the link below:

https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html

Hope this helps.

0
Mantu On

I had the same problem. I fixed this issue using RevnueCat.It can differentiate users on the bases of specific App userID, you can use this easy to use SDK to achieve what you need.