Apple In-App Purchase API (StoreKit 2)

Learn how to configure In-App Purchase API to use with StoreKit 2

Adapty requires users to provide In-App Purchase API information to obtain authorization from the App Store Server API for each request made to the API and ensure that the process of managing in-app purchases for your app is secure and efficient.
To enable secure authentication and validation of in-app purchase transaction history requests for your app's customers with Apple through Adapty, it is necessary to upload an In-App Purchase API key. Additionally, for iOS apps to enable customer lookup through Order ID, providing an Issuer ID is required.

1. Generate the API key


To generate API keys for the App Store Server API, you need to have either an Admin role or Account Holder role in App Store Connect. Read more about how to generate API Keys here.

As a first step, please log in to App Store Connect and navigate to Users and Access. Select the Keys tab and importantly choose In-App Purchase as the Key Type, which is specified on the left side. Then click on the Add (+) button.

In-App Purchase API (StoreKit 2) - Photo 1

Generate In-App Purchase Key

Enter a name for the key. The name is for your reference only and isn’t part of the key itself.

In-App Purchase API (StoreKit 2) - Photo 2

Name your In-App Purchase Key

After entering a name for the key and clicking Generate, the page will display the key's name, key ID, download link, and other relevant details.

In-App Purchase API (StoreKit 2) - Photo 3

Download In-App Purchase Key

After generating your API key, App Store Connect lets you download the private half of the key your key. The private key is only available for download a single time. So simply click on Download In-App Purchase Key button.
You also need to copy the values of Issuer ID and Key ID field values from this screen.

Please note that the generated .p8 key from the In-App Purchase section can be used for both In-app purchase API and promotional offers.

2. Add the generated API key to Adapty

After completing the necessary setup steps in App Store Connect, the next step is to upload the In-App Purchase Key to Adapty.
For doing that, please select App settings -> iOS SDK in your Adapty dashboard. Scroll down to In-App Purchase API (StoreKit 2) section. Fill out the Issuer ID and Key ID fields with the corresponding values copied from your App Store Connect.
As a last step please upload .p8 file downloaded from App Store Connect to the Purchase Key field.
After completing these steps, you're all set!

In-App Purchase API (StoreKit 2) - Photo 4

In-App Purchase API (StoreKit 2) section in Adapty

Please note that the fields will only be active when the app's Bundle ID is provided, as the in-app purchase key is specific to each app bundle.

Also, if you are currently using Storekit 1 notifications and you are now configuring Storekit 2, it is recommended that you switch to V2 notifications on the Apple Connect side as well. You can check more about the App Store Server Notifications in this doc.