Auto-renewable subscription in ios7
Asked Answered
R

3

9

I know it has been asked many times but none of the questions are helping me and I am not sure which of these answers are still valid in iOS 7.

I am doing some app with Auto-Renewing subscription. I have successfully created my product and I can buy it with test users.

My question is: What is the right way to check if a particular user still has access to this product?

And how to test if auto-renewing is working well? (Since I read that in sandbox auto-renewing does not work as real iStore).

Last question is: Is it still true that Apple rejects a lot of ARS apps?

Marko

Rosabelle answered 27/3, 2014 at 6:39 Comment(2)
I am developing application which delivers audio clips as channel basis media over http streaming. I am planing to use Auto-Renewable Subscriptions too. I searched on the internet for a complete tutorial or sample app, but couldn't found. There are couple of tutorials, but all those are quite complex. Please share if there a good source availableBozo
I put a question myself too. #31423364Bozo
B
8

To check if a user still has access to the product you should store the receipt data you received during the payment and check that receipt with the app store service.

The app store service will reply with a status for your receipt (0 for valid receipt, 21006 if the subscription has expired and was not renewed, etc)

The process with sample code can be found here :

https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ValidateRemotely.html#//apple_ref/doc/uid/TP40010573-CH104-SW3

To answer your last question : Yes Apple rejects a lot of ARS apps, it only works for content apps (magazine, newspaper, videos, etc). For example if you offer a service such as dropbox your app is not eligible to ARS

In our case we are distributing a book subscription service, to validate the app Apple asked us how many new content is available to users every month.


edit

For iOS 7 status 0 represents a valid receipt even if it's expired :

For iOS 7 style app receipts, the status code is reflects the status of the app receipt as a whole. For example, if you send a valid app receipt that contains an expired subscription, the response is 0 because the receipt as a whole is valid.

You need to verify the latest_receipt_info expires_date.

Boutique answered 27/3, 2014 at 8:14 Comment(5)
If I am not mistaken receipt is stored in mainBundle automatically? Is status 0 always mean that subscription is renewed ? I parse json I got "expires_date" = "2014-03-26 12:28:19 Etc/GMT";,... status = 0; and I am a bit confused.Rosabelle
Receipts are stored in the main bundle only since iOS 7, for earlier version you need to store it manually. Also note that the receipt stored in the app bundle will be lost if the user de-install the app and re-install, you might want to store in it the keychain (that's the strategy used by MKStoreKit for example). For your question about json response i edited my answerBoutique
I can't see what is edit in your answer :D it looks the same to me.Rosabelle
Thanks a lot :D One more question : I see that in receipt all previous purchases - is this mean that receipt will pile up for every time that product was renewed ?Rosabelle
Yes, the receipts will pile upWhitaker
I
2

Recently Apple has launched a new feature to receive server side notification whenever the subscription is renewed. However, the subscription should be in-app.

See the links given below for your reference:

https://help.apple.com/itunes-connect/developer/#/dev0067a330b

&

https://itunespartner.apple.com/en/apps/news/45333106?sc_cid=ITC-AP-ENREC

Irrelevancy answered 20/7, 2017 at 16:18 Comment(0)
E
0

Apple does not provide anything built into iOS or a REST API that gives you simple subscription details, nor are there any callbacks that you can listen for and respond to in regards to renewal or cancellation. Apple does have an API that, when given a user's local receipt and a “shared secret” generated in iTunes Connect, returns a JSON object of the user's purchase history for your app, including their current subscription information.In-App purchase doc

Equiponderance answered 22/12, 2016 at 13:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.