https://sandbox.cdp.coinbase.com/platform
Prerequisites
Before you begin, you’ll need:CDP CLI
CDP CLI
Install the CDP CLI (requires Node.js 22+):Configure a Sandbox environment using your CDP Secret API Key JSON file from the CDP Portal:
Onboarding
Onboarding
Payment Acceptance requires onboarding before you can use the APIs. Contact our team to get started. Once onboarded, you’ll receive Sandbox credentials and an account ID for testing.Set your account ID:
1. Create a payment session
Create a payment session with an amount, asset, and target. The target is the account where captured funds will settle.Example response
Example response
url— A hosted payment page URL you can redirect buyers toexpiries— Deadlines for authorization (1 day), capture (7 days), and refund (30 days)balances— Running totals that update as funds move through the lifecyclestatus— Starts ascreated, waiting for buyer authorization
2. Authorize the payment
Authorization places a hold on the buyer’s funds. Payment Acceptance supports wallet, Coinbase, and x402 authorization — see Authorization for all three flows in full. Wallet authorization is the flow to use in Sandbox. It runs against real signature verification and real EVM RPC nodes — only the onchain settlement step is mocked, so no real funds move. Coinbase (OAuth) authorization is not available in Sandbox; test that flow against production once you’ve completed onboarding. Start by fetching the available wallet authorization options for the buyer’s address — this is a stateless read, no signing required yet:Example response
Example response
pending and transitions asynchronously to succeeded or failed. In production, subscribe to webhooks to get notified.
3. Check the session status
Poll the session to confirm authorization succeeded:authorization_succeeded, the session’s balances.capturable will equal the authorized amount.
4. Capture the funds
After fulfillment, capture the authorized funds. You can capture the full amount or a partial amount. Full capture:Example response
Example response
finalCapture: true releases any remaining capturable balance back to the buyer after the capture settles. If omitted or false, the remaining hold stays open for subsequent partial captures.
Other lifecycle paths
The full capture in step 4 above moves the session to a terminal state — the steps below are alternative paths, not steps that follow it on the same session. Each applies to a session in a different state.Void uncaptured funds
If you need to release authorized funds without capturing (e.g., order canceled before shipment):Refund captured funds
To return funds to the buyer after capture:amount is omitted, the full refundable balance is refunded. Multiple partial refunds are supported up to the total captured amount.
Cancel an unused session
If a session was never authorized, cancel it to move it to a terminal state:created status — before any authorization.
5. List payment sessions
View all payment sessions for your entity:6. Handle webhooks
In production, subscribe toacceptance.payment_session.* events to receive real-time status updates rather than polling. See Webhooks for setup.
Events fired for a successful payment:
acceptance.payment_session.authorization_pending— buyer is authorizingacceptance.payment_session.authorization_succeeded— funds heldacceptance.payment_session.capture_pending— capture initiatedacceptance.payment_session.capture_succeeded— funds settled
Move to production
To run this flow with real funds:- Complete onboarding with our team (get in touch)
- Set up your CDP account and Prime account for settlement
- Switch from the Sandbox base URL to the production base URL
- Use a production API key
What to read next
Payment Sessions
Expiries, balances, auto-capture, and target types
Authorization
Wallet, Coinbase, and x402 authorization flows
Webhooks
Subscribe to real-time payment lifecycle events
API Reference
Full Payment Acceptance API