When to use restoreCompletedTransactions in Auto-renewable Subscriptions? - iphone

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.

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.

Can ExpressCheckout identify if the transaction is approved?

Some time ago I developed a custom shopping cart for a simple website which sell mainly digital goods. I integrated ExpressCheckout on it, and after the DoExpressCheckout operation, if the response contains ACK equal to Success or SuccessWithWarning (just as the sample code at that time says) then I immediately set access to the content for the user.
I see this is a great mistake, since yesterday a transaction did not appear at the owner's account, but appears in the site since user had access. After contacting PayPal we checked this particular transaction was denied. To late, since access was already granted to the user.
So what should I do? Is it because of the SucessWithWarning not reviewed, or never I should grant access to a user just by finishing DoExpressCheckout? Shall I use IPN to receive information about the transaction to only after grant the user access to the content?
Yes, you'll want to use IPN for post-transaction processing, and you'll only want to grant access once the payment status is completed.
In the case of an e-check you'll get an IPN with a status of pending, and then you'll get another IPN with updated status once that e-check clears (or fails).
Of course, this happens in real-time so you can automate the process accordingly based on the data sent.

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.

StoreKit for iOS - Subscriptions Question

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.

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...