App Store and Google Play
Connect iOS and Android apps, verify store purchases, and check one set of entitlements across web, App Store and Google Play.
How it works
In iOS and Android apps, Apple and Google are the seller of in-app purchases and pay you directly. Munim doesn’t take those payments. It verifies them with Apple and Google, follows renewals and cancellations through the stores’ server notifications, and merges them with web purchases, so you check one set of entitlements for each of your users, wherever they paid.
- Connect each app once (its store keys).
- Group products into entitlements, like
pro. - After a purchase in the app, send it to Munim with your user id.
- Ask what a user is entitled to, or read it from your own database.
Entitlements
An entitlement is a feature a purchase unlocks. Its product_ids can mix Munim products (pro_…) and App Store or Google Play product ids. Connecting a store app imports its product ids into an entitlement (pro unless you say otherwise).
curl https://billing-sandbox-api.munimtech.com/v1/entitlements \
-H "Authorization: Bearer $MUNIM_BILLING_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"identifier": "pro",
"description": "Everything in Pro",
"product_ids": ["pro_…", "com.acme.notes.pro.monthly", "pro_monthly"]
}'// Creating entitlements is a REST call (or the dashboard); the SDK lists them:
const { data } = await munim.entitlements.list()identifierstringrequired- Lowercase id such as pro: a–z, 0–9, _ - . and up to 40 characters. It can't change later.
descriptionstring- What it unlocks.
product_idsstring[]- pro_… ids and/or store product ids. On update, replaces the list.
Change one with POST /v1/entitlements/:id, remove it with POST /v1/entitlements/:id/delete.
Check what a user has
A subscriber is one of your users, by the app_user_id you passed to checkouts and receipts. The response has each entitlement, whether it’s active, when it ends and where it came from (web, apple or google).
curl https://billing-sandbox-api.munimtech.com/v1/subscribers/user_123 -H "Authorization: Bearer $MUNIM_BILLING_SECRET_KEY"const subscriber = await munim.subscribers.retrieve(user.id)
const isPro = subscriber.entitlements.pro?.active === true{
"object": "subscriber",
"app_user_id": "user_123",
"customer_id": "ctm_…",
"entitlements": {
"pro": {
"active": true,
"expires_at": 1767139200000,
"product_id": "com.acme.notes.pro.monthly",
"source": "apple",
"will_renew": true
}
},
"store_subscriptions": [ … ],
"subscriptions": [ … ]
}To skip the call, have Munim keep a munim_subscribers table in your own database, with each user’s active_entitlements.
Connect an app
One call checks the keys, imports the app’s products into an entitlement, and points the store’s server notifications at Munim. Do it in the dashboard under App Store & Play, or with the API.
curl https://billing-sandbox-api.munimtech.com/v1/store_apps \
-H "Authorization: Bearer $MUNIM_BILLING_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "apple",
"app_identifier": "com.acme.notes",
"apple_issuer_id": "57246542-96fe-1a63-e053-0824d011072a",
"apple_key_id": "2X9R4HXF34",
"apple_private_key": "-----BEGIN PRIVATE KEY-----\n…",
"asc_key_id": "ABCD123456",
"asc_private_key": "-----BEGIN PRIVATE KEY-----\n…",
"entitlement": "pro"
}'curl https://billing-sandbox-api.munimtech.com/v1/store_apps \
-H "Authorization: Bearer $MUNIM_BILLING_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"platform": "google",
"app_identifier": "com.acme.notes",
"google_service_account_json": "{\"type\": \"service_account\", …}",
"entitlement": "pro"
}'| Store | What to send |
|---|---|
| App Store | app_identifier is the bundle id. apple_issuer_id, apple_key_id and apple_private_key are the In-App Purchase key (App Store Connect → Users and Access → Integrations → In-App Purchase; the key id is in the file name SubscriptionKey_<KEYID>.p8). Add asc_key_id and asc_private_key (an App Store Connect API key with the App Manager role, same issuer) and Munim also imports products and sets App Store Server Notifications itself. Without it, pass product_ids. |
| Google Play | app_identifier is the package name. google_service_account_json is the key of a service account invited in Play Console with “View financial data” and “Manage orders and subscriptions”. With the Pub/Sub Admin role, Munim also wires Real-time developer notifications; pass google_pubsub_topic to use the topic Play Console already has. |
Other fields: forward_url (Munim passes each store notification on to your own server, so whatever was there keeps getting them), app_name, entitlement (default pro) and notifications (auto, or manual to leave the store’s settings alone).
Finish the setup
The app comes back with a setup checklist: setup.ready, and setup.next_steps saying in plain words what’s left for the person who has the store accounts (for example, inviting the service account in Play Console). Then:
POST /v1/store_apps/:id/setupchecks the keys, imports products and sets notifications again.POST /v1/store_apps/:id/test_notificationhas Apple (or your Pub/Sub topic) send a test notification, waits a few seconds, and says whether it arrived.POST /v1/store_apps/:idchanges keys orforward_url(""stops forwarding); new keys are checked and setup runs again.POST /v1/store_apps/:id/deletestops tracking the app. Nothing changes in App Store Connect or Play Console, and its subscriptions stay.
Send purchases
After a purchase in your app, send it to your server, and from there to Munim with your user id. Munim checks it with Apple or Google and attaches it to that user.
# After a StoreKit 2 purchase
curl https://billing-sandbox-api.munimtech.com/v1/receipts/apple \
-H "Authorization: Bearer $MUNIM_BILLING_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"app_user_id": "user_123", "transaction_id": "2000000812345678"}'
# After a Play Billing purchase
curl https://billing-sandbox-api.munimtech.com/v1/receipts/google \
-H "Authorization: Bearer $MUNIM_BILLING_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"app_user_id": "user_123", "product_id": "pro_monthly", "purchase_token": "…"}'// Your app sends the purchase to your server; your server sends it to Munim.
await munim.receipts.apple({ app_user_id: user.id, transaction_id })
await munim.receipts.google({ app_user_id: user.id, product_id, purchase_token })app_user_idstringrequired- Your user id.
transaction_idstring- The StoreKit 2 transaction id…
signed_transactionstring- …or its signed JWS.
app_identifierstring- The bundle id, when you have more than one Apple app.
importboolean- true for purchases made before the app was connected (existing subscribers).
app_user_idstringrequired- Your user id.
product_idstringrequired- The Play product id.
purchase_tokenstringrequired- From Play Billing.
typestringsubscriptionorone_time.app_identifierstring- The package name, when you have more than one Android app.
importboolean- true for purchases made before the app was connected.
Both return a store_subscription: platform, product_id, status (active, trialing, in_grace_period, in_billing_retry, paused, expired, revoked), will_renew, expires_at (null for lifetime purchases), environment and country. List them with GET /v1/store_subscriptions?app_user_id=….
Tracking fee
Tracking App Store and Google Play purchases is free up to $2,500 of tracked revenue a month, then 1% of the rest. GET /v1/store_fees shows this month’s tracked revenue, the fee so far and past months.
import: true don’t count their current period as tracked revenue.