1

I'm using auto recurring subscriptions in my app in my app,I need to change the subscription status if recurring fails from iOS.

I am following this documentation, but there are a few things that are still not clear to me:

  • What if my server missed the post data from iOS
  • How do I know if the subscription got renewed
  • How do I link my app user memberId (unique id) to the transaction
  • What is the difference between latest_receipt form iOS post data(server to server notification) and bundle receipt url after purchase.
l-l
  • 3,804
  • 6
  • 36
  • 42
Srikanth
  • 137
  • 12

1 Answers1

0

Here are the steps I take the user to subscribe:

  1. Ask the user to sign in. If they don't sign in they can't subscribe.
  2. Send the app receipt to my server and store it there. If this fails they can't subscribe. This need this to validate get the latest_receipt info from the server at any time.
  3. The user subscribes through iTunes.
  4. Validate their receipt with the app store and check the latest_receipt to make sure they are subscribed. (This is done server side)
  5. Repeat step 4 periodically to make sure they are still subscribed

So to answer your questions:

What if my server missed the post data from iOS?

Since I get the app receipt from the user before they subscribe I can check the with itunes directly from my sever any time and get the status of their subscription.

How do I know if the subscription got renewed?

Since you have the user receipt on your server, you can use it to get the latest receipt from apple and check the current status of the subscription. Here is how you do it Validating Receipts With the App Store

How do I link my app user memberId (unique id) to the transaction?

You could use the "Original Transaction Identifier" from the receipt as a unique id. This value is the same for all receipts that have been generated for a specific subscription

What is the difference between latest_receipt form iOS post data(server to server notification) and bundle receipt url after purchase?

When you send a receipt to the app store to be validated, it will return a JSON representation of the receipt that was send, this can be found in the "receipt" field. If your receipt contains subscriptions you will get "latest_receipt" and "latest_receipt_info" fields. These fields are useful when checking whether an auto-renewable subscription is currently active. If the bundle receipt is up to date then the "receipt" and "latest_receipt" will be the same.

mickeymoon
  • 4,820
  • 5
  • 31
  • 56
l-l
  • 3,804
  • 6
  • 36
  • 42
  • what happens if my server updation failed with original transaction while initial transaction due to power failure or network failure etc. in device how to manage recurring updations. and how i can identify the member, who actually done the transaction – Srikanth Feb 23 '18 at 16:50
  • 1
    When the user installs the app they will have an app receipt, don't allow the user to purchase from the app until you send this receipt to your server. You can use this receipt to check from your server directly to the app store to check the current state of the subscription – l-l Feb 23 '18 at 17:13
  • great!! but, what if the user changed the apple id. will the receipt still helps and if user is playing with apple id is there a way to handle subscriptions ...? – Srikanth Feb 24 '18 at 06:00