How to fetch already purchased details of iOS IAP Auto Renewable product

2.1k views Asked by At

I have created Auto renewable products and testing in sandbox environment. My question is I have purchased one product, and If I try to purchase same product with same Apple account it is showing alert as already purchased as expected but I could not able to fetch that transaction details as it is executing failed state in updated transactions. How I can get that purchased details (atleast original receiptID) as we get in Initial transaction.

3

There are 3 answers

0
Sagar Thummar On BEST ANSWER

There is two way to get user purchased transaction details:

  1. Refresh receipt
  2. Restore completed transaction

To know more about difference between refreshing receipt & restore transaction in details, Please check:- SKReceiptRefreshRequest vs restoreCompletedTransactions

In Simply,

  • Refreshing the receipt asks the App Store for the latest copy of the receipt.
  • Restoring completed transactions creates a new transaction for every completed transaction the user made, essentially replaying history for your transaction queue observer.

Question: How I can get that purchased details (atleast original receiptID) as we get in Initial transaction.

Answer: If you want to verify user with original receiptID every time each time than user SKReceiptRefreshRequest for validating user transaction.

Note: Anytime if you validating user with RestoreCompletedTransactions, Your transactionID will change. Find list of parameter that change while restoreTransaction: https://developer.apple.com/library/content/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html#//apple_ref/doc/uid/TP40010573-CH106-SW1

0
Kirish On

By validating Receipts With the App Store you can able to find which products identifiers are already purchased. There are Cocoapods libraries you can use to find out the purchased products.

  1. SwiftyStoreKit
  2. DHAppleReceiptParser
  3. IAPValidation

I hope it will helps to you.

0
Vikas Dadheech On

You have to implement a mechanism of restoring the purchased products in your app.

For more info about what exactly is restoring purchased products: Restore Purchased Products

To get to the implementation part, you can follow this tutorial: In App Purchase tutorial

The later part of the tutorial will guide you through the implementaiton of restore purchase.