App Store Connect
Create an In-App Purchase key, connect the App Store Server API, and point App Store Server Notifications V2 at AppCore for iOS purchases and subscriptions.
On this page
AppCore verifies iOS purchases and subscriptions with Apple and turns them into entitlements:
- The app buys through StoreKit and sends the signed transaction to
POST /v1/commerce/purchases/verify. AppCore checks Apple's signature chain (ending at Apple Root CA G3 or G2; no certificates to configure), then fetches the current state from the App Store Server API with your In-App Purchase key before granting anything. - Apple sends lifecycle events (renewals, expiry, billing retry, refunds) as App Store Server Notifications V2 to a per-connection URL. Each event is stored before AppCore answers, and state is always re-read from Apple.
- A scheduled sweep reconciles recent transaction history; no setup is needed.
Apple is the merchant of record: it charges the user, handles tax and issues the receipt. AppCore stores only a receipt reference and never issues its own invoice for store sales. See Stores as merchant of record. Console paths are as of 2026-11.
Note
Verification, notifications, refunds and reconciliation are implemented and tested in the Workers runtime against a
test certificate chain and a fake App Store Server API. They have not yet run against Apple's sandbox
(PROVIDER_TESTED is pending real credentials).
Warning
Not yet enabled:
- Operator-initiated refunds for Apple. Apple refunds are requested by the customer from Apple. An operator
refund request for an Apple purchase is recorded as
awaiting_manual; AppCore applies the refund when Apple'sREFUNDnotification arrives. - Automatic product sync from App Store Connect. Map product IDs by hand in Store mappings.
- Upgrade/downgrade proration is taken from Apple's state as-is; AppCore does no proration math and does not warn about duplicate subscriptions across Apple and Google.
Before you begin
- Account Holder or Admin role in App Store Connect. Only the Account Holder can accept agreements.
- Business → Agreements: the Paid Apps agreement is Active, with tax and banking complete. This blocks production activation, not sandbox testing.
- The app record exists in App Store Connect, with the bundle ID of this environment's build.
- Your environment's API host,
https://<your-api-host>, for each environment you connect (staging and production have different hosts and different connections).
Steps
Find the app's identifiers. App Store Connect → Apps → your app → General → App Information: copy the Apple ID (digits) and the Bundle ID.
Create the In-App Purchase key. App Store Connect → Users and Access → Integrations → In-App Purchase → Generate In-App Purchase Key (➕). Name it and generate. Copy the Key ID, and the Issuer ID shown at the top of the keys list. Download the
.p8; Apple lets you download it once. Use an In-App Purchase key, not a Team key from the App Store Connect API tab, and not your APNs or Sign in with Apple key.Create the connection. In AppCore, open Setup and connections → Connections, choose the environment, and create an Apple in-app purchases and subscriptions connection. Fill in the public fields (below) and save. Paste the whole
.p8file intoprivate_key_p8, then delete the local file.Run Check syntax, then Read-only check, then Activate. The notification URL only accepts events while the connection is active.
Point notifications at AppCore. Copy the Callback URL from the connection page. It has the form:
Codehttps://<your-api-host>/webhooks/apple-store/<connection-id>Then go to App Store Connect → Apps → your app → General → App Information → App Store Server Notifications, choose Version 2 Notifications, and set:
- Sandbox Server URL: the URL from your staging (or development) connection.
- Production Server URL: the URL from your production connection, once it exists.
Never use one URL for both. Each environment rejects the other environment's events.
Send a test notification. Call the App Store Server API's Request a Test Notification endpoint (
POST /inApps/v1/notifications/teston the sandbox host, signed with your In-App Purchase key), or use the button in App Store Connect if your account shows one. AppCore stores it with outcometestand grants nothing. Record the test notification's ID as evidence for checkiap-test-notification.Create products. Apps → your app → Monetization → In-App Purchases or Subscriptions. Product IDs must match exactly what you map in AppCore (Products and entitlements → Store mappings). Apple requires the first in-app purchase to be submitted for review together with an app version.
Create sandbox testers. Users and Access → Sandbox → Test Accounts → ➕. On the device, sign in with the tester when StoreKit prompts during a purchase in a development or TestFlight build (iOS also lists the sandbox account in Settings; where depends on the iOS version).
Buy in the app with the SDK (Getting started, step 7).
IapStoreBridgesets StoreKit'sappAccountTokento the purchase intent's account binding, so the purchase is tied to the signed-in AppCore user. Record the transaction ID as evidence foriap-sandbox-purchase, and attestiap-negativeafter checking a tampered or other-app transaction is rejected.
Paste into AppCore
| AppCore field | Where to find it | Secret? |
|---|---|---|
bundle_id | Apps → your app → General → App Information → Bundle ID | Public |
app_apple_id | Apps → your app → General → App Information → Apple ID (digits only) | Public |
issuer_id | Users and Access → Integrations → In-App Purchase → Issuer ID (top of the list) | Public |
key_id | Users and Access → Integrations → In-App Purchase → your key → Key ID | Public |
private_key_p8 | The downloaded SubscriptionKey_<KEYID>.p8, whole contents including BEGIN/END lines | Secret (write-only) |
store_environment | sandbox for development and staging; production for production only | Public |
agreement_evidence | Business → Agreements: who confirmed Paid Apps is Active, and when | Public |
verifier_release | Record that Version 2 notifications point at this connection's URL | Public |
catalog_mapping_version | Filled by the platform from your published store mappings | Public |
Paste into Apple: the connection's Callback URL
(https://<your-api-host>/webhooks/apple-store/<connection-id>) as the Sandbox or Production Server URL.
Verify
- Read-only check passes with
APPLE_STORE_AUTHENTICATED: AppCore signed a token with your key for your bundle and asked the App Store Server API (sandbox or production host, perstore_environment) for a transaction that does not exist. Apple answering "not found" proves the key, Key ID, Issuer ID and bundle work together. Nothing is created. - After Activate,
appleappears inpurchase_providersofGET https://<your-api-host>/v1/config/public. - The test notification appears as processed with outcome
test. - A sandbox purchase appears in Purchases and finance → Purchases, the subscription in Subscriptions, and the user's access in Products and entitlements → Entitlements.
- With all sandbox checks evidenced the connection becomes
sandbox_ready. Production additionally needs checksiap-policyandiap-liveand the setup tasks Paid Apps agreement, products created and app review done.
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
Read-only check PROVIDER_AUTH_REJECTED | Wrong Issuer ID or Key ID, revoked key, or a Team API key instead of an In-App Purchase key | Generate an In-App Purchase key; copy the Issuer ID from the In-App Purchase tab |
INVALID_P8_KEY | Partial key pasted | Paste the whole .p8 file |
PROVIDER_REJECTED on bundle_id | Bundle ID does not belong to this key's team | Copy it from App Information |
Notification URL returns 404 | Connection ID in the URL is not this environment's active connection | Copy the Callback URL from the active connection again |
Notification URL returns 503 FEATURE_UNAVAILABLE | Connection not active yet | Activate, then resend the test |
Notification returns 422 | Event is for another bundle ID, or a sandbox event reached production (or the reverse) | Point the Sandbox URL at staging and the Production URL at production |
Notification returns 401 | Signature chain did not verify | Only Apple-signed payloads are accepted; check nothing rewrites the request body |
Purchase returns 503 FEATURE_UNAVAILABLE "Store connection environment does not match" | store_environment is production on staging, or the reverse | Set sandbox outside production |
404 PRODUCT_NOT_MAPPED | The store product ID is not mapped in AppCore | Map it in Store mappings and publish |
503 PROVIDER_UNAVAILABLE on verify | Apple's API was unreachable | The SDK keeps the transaction unfinished and retries with the same idempotency key |
409 on restore, job awaiting_manual | The purchase belongs to another AppCore account | Handle it in Purchases and finance → Restore cases |