Article

Requesting a Payment from the App Store

Submit a payment request to the App Store when a user selects a product to buy.

Overview

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.

Figure 1

Continue the purchase process by requesting a payment from the App Store

A flow chart depicting the steps of the in-app purchase process. The payment request stage is diagrammed as two steps between your app and the App Store. After the user selects a product in your app and the App Store, your app makes a payment request.

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.

// Use the corresponding SKProduct object returned in the array from SKProductsRequest.
let payment = SKMutablePayment(product: product)
payment.quantity = 2

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.

SKPaymentQueue.default().add(payment)

For every payment request your app submits, it receives a corresponding transaction to process.

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.

See Also

Initiating a Purchase

class SKPayment

A request to the App Store to process payment for additional functionality offered by your app.

class SKMutablePayment

A mutable request to the App Store to process payment for additional functionality offered by your app.

class SKPaymentDiscount

The signed discount applied to a payment.

class SKPaymentQueue

A queue of payment transactions to be processed by the App Store.