Instance Method

paymentQueue(_:shouldAddStorePayment:for:)

Tells the observer that a user initiated an in-app purchase from the App Store.

Declaration

optional func paymentQueue(_ queue: SKPaymentQueue, shouldAddStorePayment payment: SKPayment, for product: SKProduct) -> Bool

Parameters

queue

The payment queue on which the payment request was made.

payment

The payment request.

product

The in-app purchase product.

Return Value

Return true to continue the transaction in your app.

Return false to defer or cancel the transaction.

If you return false, you can continue the transaction later by manually adding the SKPayment payment to the SKPaymentQueue queue.

Discussion

This delegate method is called when the user starts an in-app purchase in the App Store, and the transaction continues in your app. Specifically, if your app is already installed, the method is called automatically.

If your app is not yet installed when the user starts the in-app purchase in the App Store, the user gets a notification when the app installation is complete. This method is called when the user taps the notification. Otherwise, if the user opens the app manually, this method is called only if the app is opened soon after the purchase was started.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software