4

I have been testing out Apple's In-App Purchases (sandbox mode) which is great for testing what happens when a user subscribes, but how do I tell if the user is still paying? How do I know if the subscription has been canceled? Apple doesn't appear to let me test that out?

I see that there is something about verifying receipts? How can I do this?

Marius
  • 17
  • 1
  • 10
John Doe
  • 3,559
  • 15
  • 62
  • 111
  • Have you read all the documentation? https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Introduction.html#//apple_ref/doc/uid/TP40010573 – Abhi Beckert Mar 23 '14 at 00:21
  • Refer this:- perfect solution - https://stackoverflow.com/a/39650050/9805273 – AzeTech Apr 09 '20 at 16:03

1 Answers1

0

When you subscribe a auto-renewable subscription from app, you will get a receipt. Send that receipt to your server and your sever can use that receipt to verify if your purchase is valid from iTune store (check their doc)

You will get a JSON response and some field inside can show you the expired date. As to user's cancel, sorry, you cannot know that until current period expire (actually you will know that 24 hours before expiration due to apple store's mechanism)

Hope this helps.

[Updated @ 2017/11/5]

Now Auto-renewable subscription is allowed to notify your sever when new period begins. Please check latest document.

Pofat
  • 84
  • 4
  • In the link mentioned in your answer it shows the code that can be used to verify the auto renew subscription from within the app using objective c language, is there a code in vb.net or c# that can be used from the server side to check whether the user is still subscribed. thank you for your help. – coder May 25 '17 at 06:01
  • I suggest you verify receipt at server side. For your service is very likely to be provided by server side and thus you'b better verify at the same place. All it takes is just to send a JSON to apple store server via HTTP request. I thinks c# and vb.net can do that easily. As to JSON format, check their document (https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW1) – Pofat Nov 05 '17 at 13:59