StoreKit for iOS - Subscriptions Question - iphone

I am using the new subscription model with StoreKit in a test application of mine, but I have a few questions:
If the user cancels the subscription,
how am I informed of this? Or do I
have to monitor the date myself
(using the value transactionDate)
If the subscription is cancelled, the
user can now longer restore this
purchase if the subscription is
expired right?
Thank you!

You aren't informed if the user cancels. When you validate a receipt, Apple should give you a receipt for the most recent subscription period with a status of 0. If this isn't the case, the user is no longer subscribed.
The user can't restore an expired subscription.

Related

Receipt doesn't refresh on auto-renewing subscription?

I have an auto-renewing subscription in my macOS app. The initial purchase refreshes the app receipt, which can be locally checked to validate whether the user has an active subscription.
When the subscription automatically renews, the app receipt is not updated. Even when the transaction passes through the SKPaymentQueue on app relaunch, the receipt is still not updated.
The only way I've managed to get a current receipt is to use SKReceiptRefreshRequest, but this prompts the user to input their App Store login credentials.
How can I make sure the user's subscription information in the receipt is up to date without using server-side receipt validation?
EDIT: The behavior described reflects my experience with the StoreKit sandbox. If the same behavior can be confirmed to be nonexistent in production, that would be awesome.

is MKStoreKit right option to use for auto renewable in app subscription?

Hello friends i just want to know some couple of questions:
MKStoreKit is good to use for auto renew subscription or does it have any loophole because i am using it for subscribing multiple product for a limited time period using a built in model.?
I am using MKStoreKit to handle autorenewable subscriptions. I'm currently testing a 1 month subscription (in test a subscription lasts 5 minutes). After I purchase the subscription I wait for it to expire. Once it expires I check if the subscription is still active.
This returns false like I would expect. However, since it is auto-renewing, I would expect MKStoreKit at that point to contact Apple to revalidate the subscription.
Is it my respossibility to handle auto renew subscription when it expire, i mean to say that i have to implement observer of kSubscriptionsPurchasedNotification notification in my app.
Thanks in advance
I had this question a while back too.
MKStoreKit is not an ideal solution now because it doesn't support iOS7 and the new App Receipt system.
2-3. Apple documentation explains that they renew the receipt in the 24h prior to expiration, and then:
After a subscription is successfully renewed, Store Kit adds a transaction for the renewal to the transaction queue. Your app checks the transaction queue on launch and handles the renewal the same way as any other transaction. Note that if your app is already running when the subscription renews, the transaction observer is not called; your app finds out about the renewal the next time it’s launched.
Your app "checks the transaction queue on launch" and you need to set a SKPaymentTransactionObserver via
[[SKPaymentQueue defaultQueue] addTransactionObserver:yourTransactionObserver];
to handle:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions
just like you would when you first subscribe.
While testing, you could try to force close your app and then re-launch it after it expires to see if it successfully renews on launch. Alternatively, you can re-verify the receipt you saved from the original subscription. The verification server returns a new receipt if a renewal occurred, and then you can get the most recent expiration date from that.
I've put my autorenewable subscription implementation on github if you want to check it out. RMStore is another library that supports iOS7 and works for other types of purchases too.

Do we need to prompt user regarding auto renewable subscription expire?

I have implemented Auto renewable subscription for In-App purchase.
At time of login I am verifying the reciept But what should be that next step if I am getting response as code-21006 that states subscription has been expire.
Do I need to prompt user regarding "Do you want to renew now" or it renews automatically though it sends 21006 code?
Auto renewable as it's name is auto and as long as your user is clear that he purchased an Auto renewable subscription you don't have to inform or ask every time. I looked at apple docs and there is no mention that you have to.
Don'f forget that the user will get a receipt from iTunes when the subscription will renew.
BUT
After all I think this is a good service to inform (not to ask) your user that the subscription has been renewed. As a customer I would appreciate that.

Auto renewal verification in app purchase iphone

I am working on one app in which i have implemented the in app purchase and also successfully verified the receipt.
I have done the auto renewal subscription in which I want to know how I can check the user subscription is active or not?
In order to verify the receipt i need the receipt from the SKPaymentTransaction. So my question is that how could I can check when user returns to my app that he still has subscription or it expired.
or simply which method can give me the user transaction property of SKPaymentTransaction on load of my view so i can verify the receipt.
Thanks in advance,
Satish
Finally I did it in the following way...
I save the transaction receipt in userdefaults when user first time subscribes to the subscription and when later I need to check for the subscription activation I use that receipt which tells me the latest expiry day..
Hope this will help...

When to use restoreCompletedTransactions in Auto-renewable Subscriptions?

my question is: If a subscription receipt expired, do i have to call [[SKPaymentQueue defaultQueue] restoreCompletedTransactions]?
Background:
In sandbox, i dont get a new receipt automatically, so i think i have to use restoreCompletedTransactions.
But in this way, the user has to enter his password every week, bad user experience.
And if the user has turned of the subscription, it has expired and starts the app again. The popup has to appear?
The way to handle this is to store any or all receipts your receive that pertain to the subscription. Then when you occasionally verify one of these receipts with Apple, they will send you the latest pertinent receipt which will tell you the status of the user's subscription. This process doesn't require the user to enter their credentials.
Note: Apple prefers that you perform verification from your server, and not from the app, so that you can keep your secret private and not include it in your app's code.