# Munim Billing

> Payments for apps and websites with Munim, Inc. as the merchant of record (like
> Paddle), plus App Store / Google Play subscription tracking (like RevenueCat).
> Agents can set it up end to end: make an account, products, prices, checkouts,
> webhooks, App Store / Play apps and a sync into the app's own database, with no
> dashboard.

This is the LIVE API: real payments, at https://billing-api.munimtech.com.

## Fastest start for an AI agent

1. Sign the person in: `POST https://billing-api.munimtech.com/v1/auth/start {"email":"…"}`, ask them for the
   emailed code, then `POST https://billing-api.munimtech.com/v1/auth/verify {"email":"…","code":"123456"}`
   → { api_key: "mb_live_sk_…", test_api_key: "mb_test_sk_…", account }
2. Follow account.setup.steps (GET https://billing-api.munimtech.com/v1/account with `Authorization: Bearer <api_key>`).
3. To try things without real money first, use the sandbox: https://billing-sandbox-api.munimtech.com/llms.txt

## MCP server

Streamable HTTP at https://billing-api.munimtech.com/mcp. Works with no key: tools sign_in
make one and bind it to the session. Or set `Authorization: Bearer mb_live_sk_…`.

- Claude Code: `claude mcp add --transport http munim-billing https://billing-api.munimtech.com/mcp`
- Cursor / others: `{ "mcpServers": { "munim-billing": { "url": "https://billing-api.munimtech.com/mcp" } } }`

Start with the get_account tool: its setup.steps say what to do next.

## REST API

Auth: `Authorization: Bearer mb_…_sk_…`. JSON in and out. Amounts in cents, USD only.

No key needed:
- POST /v1/sandbox { name? } (test only) → a new test account and key
- POST /v1/auth/start { email } → emails a code
- POST /v1/auth/verify { email, code, key_name?, account? } → an API key (on live, a test key too)

Account and setup:
- GET /v1/account → account + setup checklist; POST /v1/account { name, support_email, website, statement_name }
- POST /v1/account/claim { email }, POST /v1/account/claim/verify { email, code }, POST /v1/account/claim_link (sandboxes)
- GET/POST /v1/checkout_settings { template, brand_color, logo_url, theme, corners }

Catalog and selling:
- POST /v1/products { name, description?, image_url?, tax_code?, metadata? }; GET /v1/products; POST /v1/products/:id
- POST /v1/prices { product_id, unit_amount, currency: "usd", type: "one_time"|"recurring", interval?, interval_count?, trial_days? }; GET /v1/prices; POST /v1/prices/:id
- POST /v1/checkouts { price_id, quantity?, customer_email?, app_user_id?, success_url?, cancel_url? } → { url }; GET /v1/checkouts?status=&project_id=&customer_id=&app_user_id= (newest first); GET /v1/checkouts/:id
- GET /v1/customers, /v1/transactions, /v1/subscriptions (and /:id)
- POST /v1/transactions/:id/refund { amount? }; POST /v1/subscriptions/:id/cancel { at_period_end? }; POST /v1/subscriptions/:id/manage_url
- GET /v1/balance, /v1/payouts
- Projects (one per app or website): GET/POST /v1/projects { name, kind?, url? }; POST /v1/projects/:id/assign { product_ids?, store_app_ids? }. Products, lists, exports, events and webhooks take project_id.
- Data out: GET /v1/exports/:dataset.csv|.json|.ndjson?from=&to=&project_id=&columns= (transactions, subscriptions, customers, payouts, balance, products; up to 50k rows); POST /v1/reports { dataset, … } for bigger ones (GET /v1/reports/:id → download_url); GET /v1/events?after=start then ?after=<next_cursor> to stay in sync. Read-only keys (made in the dashboard) can do all of this.
- Munim Autopilot Pricing (paid add-on, +1% on priced sales, turned on in the dashboard): POST /v1/pricing/quote { product_id, app_user_id?, country?, platform?, channel?, timezone? (IANA: enables weekend / time-of-day prices) } → { id, price_id, store_product_id, disclosure }; then POST /v1/checkouts { pricing_quote_id } (in the app stores, sell store_product_id). 404 not_found = no test running for that product: sell your own price. Call quote for every product you sell, so the autopilot can test it.
  - Experiments: GET /v1/pricing (settings, autopilot, experiments); POST /v1/pricing/experiments { product_id, price_ids (2-6, first = control), segment_by?, objective?, store_product_ids? }; POST /v1/pricing/experiments/:id { status: running|paused|ended }; GET /v1/pricing/experiments/:id/results.
  - Autopilot (on by default with Pricing): Munim starts tests itself on products with enough sales (one at a time, more with more traffic): today's price as the control plus a ladder around it (e.g. -20% / +15% / +30%, snapped to .99), new prices made on your product with metadata munim_autopilot = "true". App Store / Play buyers only get store products you already made (map them with price metadata apple_product_id / google_product_id, or store_product_ids on an experiment). Every 6 hours it stops arms clearly losing revenue, promotes a segment's clear winner, and when one price wins overall starts the next round around it (hill-climbing) until it settles; settled products are re-checked after 60 days. Its experiments carry created_by: "autopilot"; pausing or ending one hands that product back to you.
  - Guardrails: POST /v1/pricing/settings { autopilot?: bool, max_move_pct?: 5-50 (default 30, from your base price), floor?: cents|null, ceiling?: cents|null, min_quotes_to_promote?: 100-100000, products?: { "pro_…": { autopilot?, floor?, ceiling? } } }. Segments are only channel, platform, region and country (never protected traits or anything about the person, so no disclosure is needed); existing subscribers keep their price.
  - GET /v1/pricing/activity?product_id=&limit=&cursor= → what it did ("Started test on Pro Monthly: $7.99 / $9.99 / $11.99, learning per platform, region", "Promoted $11.99 for App store · iOS · North America on Pro Monthly: +18% revenue per visitor"); POST /v1/pricing/autopilot/run checks now.
  - Learning across sellers: every test starts from priors pooled from all Pricing sellers' results (price elasticity by product kind, price band, channel, platform, region, country). Only aggregates are kept and a group counts once 3 sellers are in it; no seller's products, prices or customers are shown to another.

Webhooks and entitlements:
- GET/POST /v1/webhook_endpoints { url, events? } (secret returned once); POST /v1/webhook_endpoints/:id/delete, /:id/test
- GET/POST /v1/entitlements { identifier, description?, product_ids? }; POST /v1/entitlements/:id, /:id/delete
- GET /v1/subscribers/:app_user_id → entitlements across web, App Store, Google Play
- GET/POST /v1/store_apps (connect and set up an app); POST /v1/store_apps/:id, /:id/setup, /:id/test_notification, /:id/delete
- GET /v1/store_fees → the App Store / Google Play tracking fee

Your own database (full-access key; the rows stay up to date as things change):
- GET /v1/integrations → syncs, plus every provider's credential fields and setup files
- POST /v1/integrations { provider, credentials, project_id?, name? }:
  convex { deploy_key, url? } · supabase { access_token, project_ref } · neon { connection_string }
  · turso { url, auth_token } · d1 { account_id, database_id, api_token }
  · endpoint { url } → returns signing_secret (whsec_…) once; Munim POSTs
    { object: "munim.sync", ping, transactions, subscriptions, subscribers } signed with
    Munim-Signature (verify with the SDK's verifyWebhook), upsert rows by key, answer 2xx
- GET /v1/integrations/:id; POST /v1/integrations/:id/test, /resync, /pause, /resume, /rotate_secret, /delete
- needs_setup means the target isn't ready (Convex file not deployed, endpoint not answering 2xx): fix it, then /test

Errors: { "error": { "type", "message", "param"? } } with 400, 401, 402, 403, 404, 409, 429, 500.

## What stays with people

- Claiming a sandbox and signing in take a code emailed to the person.
- Payouts go to the seller's bank through Stripe, set up only by the account owner, in the dashboard: https://dashboard.billing.munimtech.com.
- Making store keys (App Store Connect, Google Cloud) and the one Play Console field Google has no API for: the store app's `setup.next_steps` says exactly what.

## More

- Integration guide (SDK, web, React Native, webhooks): the MCP tool get_integration_guide, or https://www.npmjs.com/package/munim-billing
- Product page: https://munimtech.com/billing
