Create Credit Top-up
Buy credits with USDC from an agent at /api/v1/credits/topups
Overview
Creates a USDC checkout foramount (US dollars, $10 to $10,000) and returns its x402_url. This is the write behind morph billing topup.
- Call this route with your Morph API key and read
x402_urlandcheckoutId. - POST to
x402_urlwith an x402 client that supports theauth-capturescheme on Base (AuthCaptureEvmSchemefrom@x402/evm). A client that only handles theexactscheme cannot pay it. See Coinbase’s x402 checkout guide. - A 200 from
x402_urlmeans the funds are authorized, not credited. Poll Get Credit Top-up untilcreditedistrue.
url is the same checkout as a hosted page, for paying in a browser instead. The checkout accepts payment for 24 hours.
Pass idempotencyKey (a UUID v4) to make retries return the same checkout. Organization keys top up the organization and require an organization admin.Authorizations
Morph API key, passed as Authorization: Bearer sk-.... Create keys at https://www.morphllm.com/dashboard/api-keys.
Body
Amount to add, plus an optional idempotency key for safe retries.
Top-up to create.
Response
Top-up created.
A created top-up, ready to pay.
Checkout id. Poll it at GET /api/v1/credits/topups/{checkoutId}.
"6ae3c4f9b78e569c621631be"
Coinbase checkout status. ACTIVE accepts payment at x402_url; PROCESSING means capture is under way; COMPLETED means settled. FAILED, EXPIRED and DEACTIVATED are terminal and unpaid, so start a new top-up. A completed top-up can later become REFUNDED or PARTIALLY_REFUNDED.
ACTIVE, PROCESSING, COMPLETED, FAILED, EXPIRED, DEACTIVATED, REFUNDED, PARTIALLY_REFUNDED "ACTIVE"
USD amount, two decimals.
"25.00"
Settlement currency.
USDC "USDC"
POST here with an x402 client that supports the auth-capture scheme on Base (AuthCaptureEvmScheme from @x402/evm). A 200 means the funds are authorized, not yet credited. Accepts payment for 24 hours.
"https://api.cdp.coinbase.com/platform/v2/payment-sessions/paymentSession_9a323500-bd94-47f5-9ca8-2dc60e19a8e9/authorizations/x402"
Hosted checkout page for paying the same top-up in a browser.
"https://payments.coinbase.com/payment-sessions/paymentSession_9a323500-bd94-47f5-9ca8-2dc60e19a8e9"