Agent payments (x402 + MPP)

Crane Ledger supports two machine payment protocols so agents can fund API credits (and bootstrap accounts) without a browser checkout:

ProtocolRailSpec
x402USDC on Base (EIP-3009)HTTP 402 + PAYMENT-REQUIRED / PAYMENT-SIGNATURE
MPP (Stripe + Tempo)Stripe Shared Payment Tokens and/or TempoHTTP 402 + WWW-Authenticate: Payment / Payment-Authorization

Both can be advertised on the same 402 response when Stripe / x402 pay-to is configured: x402 keeps its PAYMENT-REQUIRED header, and MPP adds WWW-Authenticate: Payment …. MPP is on by default whenever those existing vars are present (same pattern as x402).

Credit funding

x402 (unchanged)

POST /organizations/{master_organization_id}/credits/purchase-x402?credits={n}
Authorization: Bearer {api_key}

Full details: x402 credit top-up.

MPP (parallel)

POST /organizations/{master_organization_id}/credits/purchase-mpp?credits={n}
Authorization: Bearer {api_key}
  1. Omit Payment-Authorization → 402 with WWW-Authenticate: Payment … (Stripe and/or Tempo challenges).
  2. Retry with Payment-Authorization: Payment <credential> after fulfilling the challenge.
  3. Credits are added to the billing master org, idempotent per credential hash.

Because API keys already use Authorization: Bearer, MPP challenges advertise header="Payment-Authorization" (MPP requires_auth pattern).

Account creation

  • Free bootstrap (unchanged): POST /accounts/master
  • MPP-funded bootstrap: POST /accounts/master/purchase-mpp?credits={n} with body {"name":"…","base_currency_code":"USD"}. Same 402 → Payment-Authorization flow; on success returns the new org, funded credits, and a one-time API key.

Operator configuration

MPP reuses the same Railway Stripe / x402 env already used for credit purchases. No new required vars. Every MPP_* key is optional.

VariablePurpose
STRIPE_SECRET_KEYEnables MPP Stripe (SPT verification); same key as credit top-ups / x402
STRIPE_X402_PAYMENT_METHOD_CONFIGURATIONReused in Stripe MPP challenges when set
X402_PAY_TO_ADDRESSEnables MPP Tempo (EVM pay-to; valid on Tempo). Used when MPP_TEMPO_RECIPIENT is unset
MPP_TEMPO_RECIPIENTOptional Tempo recipient override
MPP_STRIPE_CURRENCYOptional; default usd
MPP_STRIPE_NETWORK_IDOptional; default internal
MPP_STRIPE_PAYMENT_METHOD_TYPESOptional comma list; default card when no PMC is set
MPP_REALMOptional challenge realm (defaults to host from PUBLIC_BASE_URL or api.craneledger.ai)
PUBLIC_BASE_URLPublic API origin

x402 env vars are unchanged — see x402 credit top-up.

MCP

Product MCP (https://api.craneledger.ai/mcp) keeps start_x402_credit_purchase / complete_x402_credit_purchase. Prefer REST + an MPP-aware client for MPP. ChatGPT MCP (/mcp/chatgpt) omits credit purchase tools.


Need help?

Create a free account (GitHub, Google, Apple, or email) to access our support portal. Once signed in, use the Support tab in your dashboard to submit a support ticket — no GitHub account required. Our team typically responds within 24 hours.