Add the In-App Purchase key to Adapty
Adapty uses the In-App Purchase key to validate purchases in your app and to sign promotional offers. Generate the key in App Store Connect, then enter it in two sections of App settings in Adapty. If the key stops working or needs a change, replace it.
The In-App Purchase key is different from the App Store Connect API key, though App Store Connect labels the IDs of both keys Issuer ID and Key ID.
To enter all the credentials in App settings > iOS SDK at once, follow Configure App Store integration.
Generate the key in App Store Connect
-
In App Store Connect, go to Users and Access > Integrations > In-App Purchase.
One key serves every app of your App Store Connect team. To reuse an active key from this page, you need its file. If you have it, skip steps 2-4. Active keys keep working when you generate a new one.
-
To generate a key, you need the Account Holder or Admin role in App Store Connect. Without either role, ask someone who has one to generate a key and send you the file with its Issuer ID and Key ID.
If the page already lists active keys, click +. Otherwise, click Generate In-App Purchase Key.
-
Enter a name for the key, and click Generate. The key appears in the Active list.
-
You can only download each key once. Next to the new key, click Download In-App Purchase Key.
Then, in the dialog, click Download. Keep the file secure: you upload it to each Adapty app that uses the key.
Apple describes these steps in Creating API keys to authorize API requests.
Add the key to Adapty
-
To find the Issuer ID and the Key ID of your key, in App Store Connect, go to Users and Access > Integrations > In-App Purchase. If someone else generated the key and sent you its Issuer ID, Key ID, and file, skip this step.
-
In Adapty, go to App settings > iOS SDK. In the In-app purchase API (StoreKit 2) section, fill in the fields:
- Issuer ID: Copy it from the In-App Purchase page in App Store Connect.
- Key ID: Copy it from the Active list on the In-App Purchase page, next to the key you downloaded.
- Private key (.p8 file): Upload the file you downloaded.
-
Adapty signs promotional offers with the In-App Purchase key. In the App Store promotional offers section, enter the key again:
- Subscription key ID: The Key ID from step 2.
- Subscription key (.p8 file): The file from step 2.
A different key saves without an error, but users then can’t receive promotional offers.
-
Click Save. Adapty verifies the key in the In-app purchase API (StoreKit 2) section with Apple before it saves the page. If Apple rejects the key, the page shows “The provided field values are incorrect”: review the values.
Replace the key
If the key stops working or needs a change, save a new key in Adapty before you revoke the old one.
When the key stops working:
- Purchases in your app unlock no access, and the app receives no error.
- Users can’t redeem promotional offers.
- Refund Saver can’t answer consumption requests.
- Adapty shows no warning, and the status in the App Store server notifications section stays Active.
When your app moves to another Apple developer account, replace the key with one from the team of the new owner.
To replace the key:
- In Adapty, go to App settings > iOS SDK. To identify the key that Adapty uses now, in the In-app purchase API (StoreKit 2) section, note the value in the Key ID field.
- Generate a new key.
- Add the new key to Adapty in the In-app purchase API (StoreKit 2) and App Store promotional offers sections, and click Save.
- One key serves every app of your App Store Connect team. If other Adapty apps use the Key ID from step 1, add the new key to them too. Replace the old key on any of your servers that use it.
- A revoked key stops working in every app that uses it, and you can’t restore it. In App Store Connect, revoke the old key: the active key with the Key ID from step 1.
Users who bought while Adapty had no working key get access when they restore purchases.