let say I purchase one month auto renewable subscription. I use product for 3 month, in 3rd month I cancel subscription. Now my question is can I get receipt for last two month transaction?
The concept of receipt when working with iap is not the same as the general concept of receipts. You don't get a new receipt for each transaction. Your app only has one receipt. Each time you auto renewable subscription renews your app receipt will get updated with a new transaction.
The receipt for an application or in-app purchase is a record of the
sale of the application and of any in-app purchases made from within
the application.
Related
I’m working on application which contains two types of IAP.
1. Consumable IAP
2. Auto renewable IAP
Consumable IAP is working fine. But I confused in Auto renewable IAP.
Should I need to store validation receipt in db?
How I check is user cancelled Subscription?
If user Subscribed using Auto renewable IAP and then after user use Consumable IAP to purchase different Item. In this case which receipt is I need to send for receipt validation for Auto renewable IAP? Latest receipt generated using Consumable IAP or old one which is generated using Auto renewable IAP?
I’m also confused in transaction id and original transaction id.
Please help me
For auto-renewable subscriptions, the best way is to store the receipt file in your database like you said. From there, you can periodically refresh it with the Apple /verifyReceipt endpoint to get the latest subscription status for a user.
This video is useful as a high level guide for setting up a server to handle this: How to Build a Great iOS In-app Purchase Subscription Server
The latest receipt file will contain the entire purchase history for a user, so this is what you should be updating and refreshing in your database.
For auto-renewable subscriptions, the transaction id is a unique identifier for the purchase or renewal. The original transaction id will be the same for all renewals, and can be used to see how many renewals an individual user had.
I want to implement InApp purchase in my iOS video streaming app to do that I need to implement Non-renewing subscription e.g 1 month,3 months, 6 months and 1 year.
I am using Objetive-C in my application.
Can you please tell me how to implement it because as per Apple, developer need to manage subscription expiration date and time.
How to validate receipt ??
How to manage user's subscription on multiple device or restore user's subscription if user login on other device ??
Please help me and let me know if anything is required in Non-renewing subscription.
Thanks,
You should go through the in-app purchase programming guide before starting the implementation.
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Introduction.html
Store-kit won't send you any notification in case of subscription end for a non-renewable subscription. You need to calculate the duration on your own and revoke the user's access to your server after that duration.
To verify the receipt you can do the validation on user's device or on your server, but your server is preferably better and even recommended by apple also.
For restoring the purchase you can go through the following doc
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/Restoring.html#//apple_ref/doc/uid/TP40008267-CH8-SW9
Non Renewing subscription
First of non renewing subscription is the consumable keys that means once it purchased it just purchased. Keep in mind Storekit doesnot restore consumable products so you have to manage yourself because StoreKit does not do it as it do in Auto-renewable subscriptions and Non-consumable .
More details about Non renewing subscription :
Does Non-Renewing subscription requires a restore button?
How to manage?
To manage your in-app purchase you have to use server DB. You have to store your all purchases in server DB by using post API.
Benefits:
You can easily maintain the end date of purchase.
You can get each paid account every time user logged in with any device.
Note: Maintain your DB according to your need.
I have implemented the IAP for Consumable Products in my app. I have couple of queries regarding validating the receipt. I am going to use my own server which will communicate with apple server.
1.) Does the below url will contain the most recent receipt or all the receipts (even the old ones)?
NSBundle.mainBundle().appStoreReceiptURL
2.) If the above url stores all the receipts then do i need to verify all the receipts whenever user purchase a new product?
3.) Does the user will have access to these receipts if he chooses to reinstall the application?
Refer: In-App Purchase Programming Guide
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/StoreKitGuide/Chapters/DeliverProduct.html#//apple_ref/doc/uid/TP40008267-CH5-SW16
Information about consumable products and non-renewing subscriptions
is added to the receipt when they’re paid for and remains in the
receipt until you finish the transaction. After you finish the
transaction, this information is removed the next time the receipt is
updated—for example, the next time the user makes a purchase.
Information about all other kinds of purchases is added to the receipt
when they’re paid for and remains in the receipt indefinitely.
I would like to offer a monthly subscription (as In App Purchase) to my users. When the user buys a subscription a receipt is stored on the device with an expiration date one month after purchase date. My question is how i should retrieve a new receipt after this month is passed and the subscription auto renewed?
What i am doing now is to perform refresh receipt using SKReceiptRefreshRequest when i recognize that there is an expired receipt on the device. The problem with this method is that it triggers the "Sign in to iTunes Store" popup. I am testing the app using sandbox users.
Managing subscriptions with In-App Purchase minute 21:00 exactly.
This happens automatically when user opens your app. The implemented delegate will receive any waiting new receipts.
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.