Apple In-App Purchase API (StoreKit 2)

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

For Adapty to securely validate in-app purchases in your app, and authenticate and validate subscription requests with Apple, you need to upload an in-app purchase key and provide the Issuer ID and Key ID.

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.

  1. Open App Store Connect. Proceed to Users and AccessIntegrationsIn-App Purchase section.
  2. Then click the Plus (+) button next to the Active title. The Generate in-App Purchase Key window will open.
Generating new in-app purchase key

Generating new in-app purchase key

  1. Enter the name of the key for your future reference (this name is not used in Adapty).

  2. Click the Generate button. Once the Generate in-App Purchase Key window closes, you'll see the created key in the Active list.

    Generated in-app purchase key

    Generated in-app purchase key

  3. After generating your API key, click the Download In-App Purchase Key button to get the key as a file.
    Keep this file safe to later upload it to Adapty. Please keep in mind that the generated file can be downloaded only once, so store it safely until you upload it to Adapty. The generated .p8 key from the In-App Purchase section can be used for both In-app purchase API and promotional offers.

  4. Copy the values of Issuer ID and Key ID fields from this screen as well. Later you will use them in Adapty.

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:

  1. Open App settings -> iOS SDK in your Adapty dashboard.

  2. Scroll down to the In-App Purchase API (StoreKit 2) section.

  3. Fill out the Issuer ID and the Key ID with the corresponding field values copied from your App Store Connect. Please note that the fields will only be active after the app's Bundle ID is provided, as the in-app purchase key is specific to each app bundle.

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

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

  4. Upload the In-App Purchase Key file in .p8 format you've downloaded from App Store Connect to the Private Key (.p8 file) field.

After completing these steps, you're all set!

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 App Store Connect side as well. You can read more about it in App Store server notifications.