Original API for In-App Purchase
Offer additional content and services in your app using the Original In-App Purchase API.
Overview
The In-App Purchase APIs, including the original API and the Swift-based In-App Purchase API, allow you to offer customers the opportunity to purchase in-app content and features. Customers can make the purchases within your app, and find your promoted products on the App Store.
The StoreKit framework connects to the App Store on your app’s behalf to prompt for, and securely process, payments. The framework then notifies your app, which delivers the purchased products. To validate purchases, you can verify receipts on your server with the App Store or on the device. For auto-renewable subscriptions, the App Store can also notify your server of key subscription events.
[Image]
For more information about In-App Purchases, including configuration, testing, marketing, and more, see In-App Purchase.
Configure In-App Purchases in App Store Connect
To use the In-App Purchase API, you need to configure the products in App Store Connect. As you develop your app, you can add or remove products and refine or reconfigure existing products. For more information, see Configure In-App Purchase settings.
You can also offer apps and In-App Purchases that run on multiple platforms as a single purchase. For more information about universal purchase, see App Store Connect Help.
Understand product types
There are four In-App Purchase types you can offer:
Consumables are a type that are depleted after one use. Customers can purchase them multiple times.
Non-consumables are a type that customers purchase once. They don’t expire. Non-consumable In-App Purchases can offer Family Sharing.
Auto-renewable subscriptions to services or content are a type that customers purchase once and that renew automatically on a recurring basis until customers decide to cancel. Auto-renewable subscriptions can offer Family Sharing.
Non-renewing subscriptions to services or content provide access over a limited duration and don’t renew automatically. Customers need to purchase a new subscription after it concludes if they want to retain access.
You can sync and restore non-consumables and auto-renewable subscriptions across devices using StoreKit. When a customer purchases an auto-renewable or non-renewing subscription, your app is responsible for making it available across all the person’s devices, and for restoring past purchases.
Topics
Essentials
Setting up the transaction observer for the payment queueOffering, completing, and restoring in-app purchasesSKPaymentQueueSKPaymentTransactionObserverSKPaymentQueueDelegateSKRequest
Product information
Loading in-app product identifiersFetching product information from the App StoreSKProductsRequestSKProductsResponseSKProduct
Storefronts
Purchases
Requesting a payment from the App StoreProcessing a transactionSKPaymentSKMutablePaymentSKPaymentTransaction
Purchase validation
Choosing a receipt validation techniqueValidating receipts with the App StoreappStoreReceiptURLSKReceiptRefreshRequest
Content delivery
Refunds
Providing access to previously purchased products
Restoring purchased productsSKReceiptRefreshRequestSKRequestSKPaymentTransactionSKTerminateForInvalidReceipt()
Family Sharing
Supporting Family Sharing in your appisFamilyShareablepaymentQueue(_:didRevokeEntitlementsForProductIdentifiers:)
Subscriptions
Promotions
Testing In-App Purchases
Testing at all stages of development with Xcode and the sandboxSetting up StoreKit Testing in XcodeTesting In-App Purchases in XcodeTesting In-App Purchases with sandbox