Skip to main content

Restoring Purchase History

Restore Purchase History#

If your users had some purchases that performed before you implemented SDK to your project, you will be able to sync this purchase transactions with appmate. This will allow you to see all the purchase records made by this user, this data will be available seen via purchase reports. Additionally, if you want to show all purchase history records of your users, you will be able to fetch all purchases after syncing purchase history transactions. See this page to learn how to fetch all purchases. To store users' transaction history, call restorePurchases method.

You should send this request only when your application is installed for the first time on a device or when your application has been removed from a device and reinstalled.

The following code demonstrates how to restore purchase history transactions.

Request#

Parameter NameType
completion([PurchaseInfo]?, GenericError?) -> Void

Response#

Parameter NameType
purchases[PurchaseInfo]?
errorGenericError?
PurchaseClient.shared.restorePurchases { purchases, error in    if purchases != nil {        print(purchases)    } else {        print(error)    }}