Submit a payment request to the App Store when a user selects a product to buy.
After you present your app's store UI, users can make purchases from within your app. When the user chooses a product, your app creates and submits a payment request to the App Store.
Implementing an in-app purchase flow can be divided into three stages. In the first stage, your app retrieves product information. Then your app requests payment when the user selects a product in your app's store. Finally, your app delivers the products. This article details the steps performed by your app and the App Store in the second stage, as highlighted in Figure 1.
Create a Payment Request
When the user selects a product to buy, create a payment request using the corresponding
SKProduct object and set the quantity if needed, as shown below. The product object comes from the array of products returned by your app’s products request, as discussed in Fetching Product Information from the App Store.
Submit a Payment Request
Submit your payment request to the App Store by adding it to the payment queue. If you add a payment object to the queue more than once, it's submitted to the App Store multiple times, charging the user and requiring your app to deliver the product each time.
For every payment request your app submits, it receives a corresponding transaction to process. For more information about transactions and the payment queue, see Processing a Transaction.
For auto-renewable subscriptions, you may submit a payment request with a subscription offer for users you determine eligible to receive an offer. For more information, see Implementing Subscription Offers in Your App.