Contents

SKReceiptRefreshRequest

A request to the App Store to get the app receipt, which represents the customer’s transactions with your app.

Declaration

class SKReceiptRefreshRequest

Mentioned in

Overview

Use this API to request a new app receipt from the App Store if the receipt is invalid or missing from its expected location, appStoreReceiptURL. To request the receipt using the SKReceiptRefreshRequest object, you initialize it, attach a delegate, and then call the request’s start() method.

When the request completes successfully, your delegate receives an SKReceiptRefreshRequest object in its requestDidFinish(_:) method. Locate the app receipt using the appStoreReceiptURL property. For information about validating the receipt, see Choosing a receipt validation technique.

If the request fails and calls your delegate’s request(_:didFailWithError:) method, your app needs to release the request and not attempt to call it a second time. Requests can fail when a user doesn’t authenticate or chooses to cancel the request. Without a validated receipt, assume the user doesn’t have access to premium content.

In the sandbox environment, you can initialize a receipt with any combination of properties for testing when you call init(receiptProperties:).

Use alternative techniques

There are times when using SKReceiptRefreshRequest isn’t necessary, so avoid doing so, such as in the following scenarios:

  • If the receipt is valid, but may be missing transactions, use restoreCompletedTransactions() instead. For example, the receipt may be missing a transaction if a person purchases a new subscription on another device.

  • In the sandbox environment, before the tester completes their first in-app purchase. Receipts are initially absent in the sandbox environment for iOS and iPadOS apps. For more information, see appStoreReceiptURL.

Topics

Initializing Receipt Refresh Requests

Receipt Properties and Keys

See Also

Purchase validation