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...
Related
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.
In my application I am using Auto-Renewable Transection. Now I have some queries in it. I have read steps for receipt verification in Apple Documentation and also refer lot's of blogs but I am not Clear about the following my scenario which I can't get.
i.e I am subscribing for 1 month and after completion of that transection I get receipt of that transection. I am verifying it successfully. Now I need to send receipt parameter to my web service That I am sending If receipt status is '0' mean receipt is verified. Now I want to verify receipt at every time once I am starting of application that receipt is verified or not I yes the send parameter to web services and if not then send false parameter to web service.
1). Is it ok if I save receipt on completion of transection and verify that receipt at every time when app start. But will it work. Will it give me latest parameter in response. i.e if one month completed then expire date and purchase date para change so that will take effect on it.
Please suggest me the best way so That I can continues check the status of receipt and can call web services as best as I can.
Thanks In Advance
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.
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.
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.