iOS INApp Purchase Auto renewal subscription? - ios

I have implemented auto renewable subscription (Monthly and Yearly Renewal).I have purchased successfully and verified the receipt. But I don't know how to verify the recipet when subscription auto renewed.(Successfully OR failed). SO please help

There are two approaches. First, your app get notified, when subscription is renewed, actually new purchased transaction received, and you should resend receipt to your server or locally on device set proper configuration. Second, in apple response of receipt validation there is a field "latest_receipt_info", you can retry receipt validation on server in the end of period of subscription and get actual info about your subscription (for instance, if client can't send receipt for some reasons). Combined approach is the best way.

Related

how to detect the renewal status in apple auto subscription development?

there is a way if the server verify the receipt the apple will return the latest_receipt_info which contains the expires_date of auto subscription.But what time and what way to do this check? everyday the server to do this check or the app to do this when it's opened,should I always take the first buy receipt to post http://buy.itunes.apple.com/veriryreceipt for get the latest_receipt_info?
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Subscriptions.html
is there a good way to check the renewal status?

How Do I know that auto Renewalbe subscription is cancelled or not?

I am implementing In App purchases in my app ,with auto renewable subscription , Now i am confusing that how i know that when the user is cancelled auto-renewable subscription or not
When user purchase any subscription using in app purchase, apple provide a Receipt for each purchase or transaction. Now you can anytime verify the subscription of user using this receipt. When you will pass this receipt to apple server it will provide you with the user current subscription (if available) along with the current receipt also.
For learning more about receipt validation go through this apple link. May be it will solve your issue.
You need to track the expiration date of the current subscription. If you don't get a new subscription transaction at the start of the next period you can assume that the renewal has been cancelled.
From the In-App Purchase Programming Guide -
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.

How do I know if a user cancels an auto renewing subscription with In-App Purchases on iOS?

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

How to manage the InAppPurchase subscriptions

I am doing one application.In that i implemented In App Purchase with Auto renewal subscription.First i subscribed for one month and got the receipt from apple.And when i try to send the receipt to server,due to some problem i am unable to send a receipt to my server.And i didn't store the receipt in my local DB also.Whenever next time i will try to open my application,my server giving the alert like "Please subscribe".So if i try to subscribe once again,apple will again deduct the money or not.Can i get the receipt from the apple.
Every user can only have one subscription at one time. Apple give him an alert that he already has this subscription.
You have to implement subscription restoring option for users. Here is a nice guide in the Apple Docs

How to update a subscription with StoreKit?

I'm trying to work out the best mechanism to handle the auto renewing part so that it handles the continuation of the subscription into the next period.
What the best way of handling this?
Should I have an NSTimer set to check if the current expires_date has been reached .. and then try send a purchase request?
Apple iOS in-app purchases provides the product "Auto-renewable subscription". This product will be renewed automatically by Apple.
When you use this type of product, your app has to verify if the auto-renewable subscription is still valid, since the user might have cancelled the subscription. When an user cancel a subscription, the subscription remains valid until the end of the subscription period.
To validate an auto-renewable subscription, you have to use the purchase receipt and the shared secret generated for your app in-app purchases in iTunes Connect. You have to post this two things to the App Store. This will return a JSON and you have to get from this data the "
subscription's latest purchase date". From that date you have to calculate the expiration date and validate or invalidate the subscription.
You can do all this validation after application launch and/or when the model is updated.
Additional information
You can find information about auto-renewable subscription in Apple documentation. Also, you can check about MKStoreKit, which is a framework that reduces the amount of code that you have to write for the use of StoreKit, and supports Auto-renewable subscriptions.

Resources