Connect the App Store
Step by step to bring your iOS app sales, subscriptions and refunds into CrazyLeads, from the screen or from your AI assistant (MCP).
With the App Store source, every charge of your iOS app shows up in Sales, next to Hotmart and Kiwify, and every subscription becomes events on the buyer timeline: free trial, start, renewal, failed billing, cancellation, expiration and refund. You use those events in Deliveries (for example, sending the purchase to Meta), automations and audiences.
Who does what: steps 1, 2, 3 and 5 are done by whoever manages the Apple account, no code, in about 15 minutes. Step 4 belongs to the app developer: send them this link. Without step 4, sales still show up in Sales, but with no buyer: nothing reaches the timeline, and Deliveries (such as the purchase to Meta) and automations do not fire.
Before you start
- The App Store source is in beta. If the card does not show up in Sources → Add source, ask for it through the support page (crazyleads.com.br/landing/suporte, in Portuguese), with the project name and the store.
- The app published on the App Store, with subscriptions or in-app purchases.
- Account Holder or Admin access to App Store Connect: only they can generate the step 1 key.
- Someone who works on the app server (the one that handles login), for step 4.
- No approved app or Apple review needed: the connection uses a key you generate yourself.
1. Generate the key in App Store Connect
- 01Open App Store Connect → Users and Access → Integrations → In-App Purchase.
- 02Generate a key, give it a name (for example, CrazyLeads) and download the .p8 file. Apple lets you download it only once: keep a copy.
- 03Write down the Issuer ID (on the same page) and the Key ID (10 characters, next to the key name).
- 04Write down the app bundle ID (for example, com.company.app) and the app Apple ID (the number in App Store Connect → the app → App Information).
2. Connect in CrazyLeads
Pick one of the two paths. The result is the same.
From the screen
- 01In the project, open Sources → Add source → App Store → Continue.
- 02First step: enter the bundle ID and the app Apple ID. The source name and identifier come pre-filled; the app name is optional.
- 03Second step: enter the Issuer ID and the Key ID and pick the .p8 file. Click Connect and create source. CrazyLeads checks the key with Apple before creating it.
- 04Copy the identification key shown and hand it to the developer (it goes into step 4). It is shown only once. Tick I saved the key and click Open source.
From your AI assistant (MCP)
- 01With CrazyLeads connected to Claude or another AI assistant (see the Connect Claude to your data guide, at the end of this page), ask for example: "Connect the App Store for the app com.company.app, Apple ID 6400000000, in the project My Company".
- 02The assistant returns a connection link. Open it and upload the .p8 file with the Issuer ID and the Key ID. The file goes straight to the vault, never through the chat.
- 03Copy the identification key shown on the page and hand it to the developer.
- 04Go back to the chat and say you are done. The assistant checks the source and shows the source URL. Then follow steps 3 to 5.
Do not paste the .p8 key or the identification key in the chat. Always use the link.
3. Send Apple notifications to CrazyLeads
On the source page, Connection tab, copy the source URL. Apple accepts one notification URL per app, so what to do depends on whether someone already uses that slot. If you are not sure, ask the developer.
If the app does not receive Apple notifications yet
Paste the source URL in App Store Connect → the app → App Information → App Store Server Notifications, version 2, in both fields: Production and Sandbox.
If the app server already receives them
Do not change the URL. Ask the developer to make the server re-send each received notification, unchanged, to the source URL. The Connection tab shows the ready code snippet.
4. Link the purchase to the buyer (developer)
This step is for the app developer. Apple does not send the buyer e-mail or phone, so there are two ends: the app writes an account ID into each purchase, and the app server tells CrazyLeads who that ID belongs to. The Connection tab shows these snippets with the right URL, in Node and Python.
- 01In the app: on each purchase, pass the user account ID as appAccountToken (StoreKit 2: the appAccountToken purchase option; expo-iap: appAccountToken in the request). Apple requires a UUID.
- 02On the server: on sign-up, on login and when the person changes their e-mail, send the account ID with the e-mail and/or phone to the source URL, signed with the identification key.
import crypto from 'node:crypto'
// The identification key: the 64 characters shown ONCE when connecting.
const KEY = process.env.CRAZYLEADS_IDENTIFICATION_KEY
// The source URL (Connection tab of the source in CrazyLeads).
const SOURCE_URL = 'https://webhook.crazyleads.com.br/webhooks/webhook/v1/YOUR_KEY'
// Call it on sign-up, on login and when the person changes their e-mail.
export async function identifyBuyer({ accountId, email, phone }) {
const body = JSON.stringify({
account_id: accountId, // the SAME id the app writes into the purchase
email,
phone,
ts: Math.floor(Date.now() / 1000), // in seconds; valid for 5 minutes
})
const signature = crypto
.createHmac('sha256', KEY)
.update(body)
.digest('hex')
await fetch(SOURCE_URL, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CL-Identificacao': '1',
'X-CL-Assinatura': signature,
},
body, // send exactly the text you signed
})
}Your user ID is not a UUID (a number, a cuid)? Derive a UUID v5 from it with a fixed namespace of your own. The same user always gets the same UUID, and the app and the server compute the same value.
import { v5 as uuidv5 } from 'uuid'
// A fixed namespace of YOUR own: generate it once with
// crypto.randomUUID() and never change it.
const NAMESPACE = '00000000-0000-0000-0000-000000000000'
// The same user always gets the same UUID.
// Use this value in the app (purchase) and the server (identification).
export const storeAccountId = (userId) =>
uuidv5(String(userId), NAMESPACE)- Subscribers from before this setup have no account ID in the purchase. To bring them in, send the purchase original_transaction_id (the server usually stores it) instead of account_id.
- App without its own server (only Firebase or similar): there is no server-less path yet. Sales show up in Sales, but with no buyer, timeline or Deliveries.
5. Test
- 01On the source page, Actions tab, click Test. Apple sends a test notification to the URL set in the store. From the assistant, ask: "test the App Store notification and tell me if it arrived".
- 02In the Health tab, Last notification stops showing None yet, and the top of the page shows Receiving.
- 03Optional, with the developer: make a Sandbox purchase: it shows up in the Subscriptions and charges tab marked Test. A test purchase never becomes a sale nor goes to Meta.
On the App Store, the amount in Sales is what the customer paid, with tax and the Apple commission included (gross).
When something goes wrong
| If you see | What to do |
|---|---|
| "Apple rejected the key" | Check the Issuer ID, the Key ID, the bundle ID and that the .p8 is the In-App Purchase key (not the App Store Connect API one). |
| "Apple did not find the app with this bundle ID" | Check the bundle ID and that the key is from the same App Store Connect account. If the app only exists in testing, the connection also looks in Sandbox. |
| "The Apple ID entered is not the app" | Use the number from App Store Connect → the app → App Information. |
| "This app is already in another active Crazyleads source" | An app can be in only one source in CrazyLeads. Pause or delete the other one. |
| At the top of the page: Waiting for first notification | The URL is not in App Store Connect yet, or the app server is not re-sending. Redo step 3 and click Test. |
| Health: Purchases waiting for the buyer | The app writes the account ID, but the server has not identified it yet. Check step 4. |
What Apple does not let you do: refund or cancel as the seller. Only the customer asks Apple for a refund, and only they cancel on the device. CrazyLeads only reads and records: it never confirms or finishes a purchase.