A queue of payment transactions to be processed by the App Store.
- iOS 3.0+
- macOS 10.7+
- Mac Catalyst 13.0+
- tvOS 9.0+
The payment queue communicates with the App Store and presents a user interface so that the user can authorize payment. The contents of the queue are persistent between launches of your app.
To process a payment, first add at least one observer object (
SKPayment) to the queue (see
add(_:)). Then, add a payment object (
SKPayment) for the item the user wants to purchase. Each time you add a payment object, the queue creates a transaction object (
SKPayment) to process that payment and enqueues it to be processed. After payment is fulfilled, the queue updates the transaction object and then calls any observer objects to provide them the updated transaction. Your observer should process the transaction and then remove it from the queue.
The exact mechanism you use to process a processed transaction depends on the design of your app and the product being purchased. Here are a few common examples:
If the product is a feature already built into your app, your app enables the feature to process the transaction.
If the product includes downloadable content provided by the App Store, your app retrieves the
SKDownloadobjects from the transaction and ask the payment queue to download them. You provide the actual content files to be served by the App Store to App Store Connect when you create the product information.
If the product represents downloadable content provided by your own server, your app might open a network connection to your server and download the content from there.
For more information on designing the payment processing portion of your app, see In-App Purchase Programming Guide.