Overview
The Checkouts API sandbox environment provides a safe, isolated testing space where you can develop and test your checkout integrations without affecting production data or processing real transactions. The sandbox mirrors production functionality while using test data and simulated payment flows.Authentication methods, and response formats in sandbox are identical to production, making it easy to transition your code when ready.
Key Differences: Sandbox vs Production
| Feature | Sandbox | Production |
|---|---|---|
| API Endpoint | business.coinbase.com/sandbox/api/v1/checkouts | business.coinbase.com/api/v1/checkouts |
| API Keys | Same CDP API keys | Same CDP API keys |
| Transactions | Simulated (no real value) | Real payment processing |
| Webhooks | Requires sandbox: true label | No label required |
| Rate Limits | Same as production | Standard production limits |
| Data Retention | 30 days (auto-purged) | Permanent |
Getting Started
1. Prerequisites
Before using the sandbox environment, ensure you have:- A Coinbase Business account
- CDP API credentials (same keys work for both sandbox and production)
- Familiarity with the Checkouts API
2. Configure Your Application
The only change required to use sandbox is updating your API endpoint to include the/sandbox path segment:
Testing Payments with Testnet Funds
To fully test your sandbox integration, you’ll need a wallet with testnet USDC on Base Sepolia. Here’s how to set one up:Step 1: Get a Wallet on Base Sepolia
You can use any EVM-compatible wallet. The easiest options for non-crypto developers:- Coinbase Wallet (Recommended)
- MetaMask
- Download Coinbase Wallet (browser extension) or Base (mobile)
- Create a new wallet (no cryptocurrency purchase needed)
- In settings, enable Developer Mode or Testnets
- Switch network to Base Sepolia
0x1234...abcdStep 2: Get Testnet USDC from the Faucet
Use the Coinbase Developer Portal Faucet to claim free testnet USDC:- Go to the Coinbase Developer Portal Faucet
- Sign in with your Coinbase account (the same account you use for Coinbase Business)
- Select Network: Base Sepolia
- Select Token: USDC
- Enter your wallet address from Step 1
- Click Claim
Faucet limits: 10 USDC claims per 24 hours. See Faucets documentation for full details.
Step 3: Test a Payment
Now you can test the full payment flow:- Create a sandbox checkout (see Getting Started above)
- Open the checkout URL in your browser
- Connect your testnet wallet when prompted
- Approve the USDC payment
- Verify your webhook receives the
checkout.payment.successevent - Confirm the transaction on Base Sepolia Explorer
API Endpoints
All Checkouts API endpoints are available in sandbox with the/sandbox path prefix:
| Endpoint | Sandbox URL |
|---|---|
| Create Checkout | POST /sandbox/api/v1/checkouts |
| List Checkouts | GET /sandbox/api/v1/checkouts |
| Get Checkout | GET /sandbox/api/v1/checkouts/{id} |
| Deactivate Checkout | POST /sandbox/api/v1/checkouts/{id}/deactivate |
Webhook Events
Sandbox webhook events work the same as production. This allows you to:- Test webhook integration without receiving production events
- Validate your webhook handler with realistic event payloads
- Test failure scenarios and retry logic safely
Subscribing to Sandbox Webhooks
To receive webhook events for sandbox checkouts, you must include the"sandbox": "true" label in your subscription. Without this label, you will only receive events from production checkouts.
Webhook Event Types
The same event types are available for both sandbox and production:| Event Type | Description |
|---|---|
checkout.payment.success | Checkout successfully paid |
checkout.payment.failed | Checkout payment failed |
checkout.payment.expired | Checkout expired without payment |
Best Practices
Isolate Sandbox Configuration
Isolate Sandbox Configuration
Keep sandbox configuration completely separate from production:
Test Error Scenarios
Test Error Scenarios
Use sandbox to thoroughly test error scenarios:
- Invalid authentication
- Malformed requests
- Payment failures
- Expired checkouts
Separate Webhook Subscriptions
Separate Webhook Subscriptions
Create a dedicated webhook subscription for sandbox using the
sandbox: true label:Automate Integration Tests
Automate Integration Tests
Create automated test suites that run against sandbox:
Limitations & Considerations
- Simulated Transactions: Sandbox payments do not involve real funds
- No Wallet Updates: Payments will not appear in your Coinbase app wallet
- Data Retention: Sandbox data is automatically purged after 30 days
- Performance: Response times may vary from production
- Third-Party Services: Some third-party integrations may use mocked responses
Transitioning to Production
When you’re ready to move from sandbox to production:Complete Integration Testing
Ensure all features work correctly in sandbox with comprehensive test coverage
Review Webhook Configuration
- Verify you have a webhook subscription for production (no sandbox label needed)
- Ensure your production webhook endpoint is ready to receive events
Troubleshooting
401 Unauthorized Errors
401 Unauthorized Errors
Not Receiving Sandbox Webhooks
Not Receiving Sandbox Webhooks
Problem: Webhook events are not being delivered for sandbox checkoutsSolutions:
- Check that your webhook endpoint is accessible and returns 200 OK
- Ensure you’re subscribed to the correct event types
- Review webhook signature verification is implemented correctly
Checkout URL Not Working
Checkout URL Not Working
Problem: Unable to complete payment on sandbox checkoutSolutions:
- Verify the checkout hasn’t expired
- Check the checkout status via API
- Ensure the checkout is still active
Funds Not Appearing in Wallet
Funds Not Appearing in Wallet
Problem: Completed sandbox payments not showing in Coinbase walletThis is expected behavior: Sandbox payments are simulated and will not appear in your Coinbase wallet. To verify payments, check the checkout status via API or webhook events.
Environment Mismatch
Environment Mismatch
Problem: Code works in sandbox but fails in production (or vice versa)Solutions:
- Verify all configuration uses environment variables
- Check for hardcoded sandbox-specific URLs
- Ensure webhook subscriptions have correct
sandboxlabel values
Additional Resources
API Reference
Complete API documentation for Checkouts endpoints
Webhooks Guide
Learn how to set up and verify webhook events
Authentication
Learn how to authenticate your API requests
Postman Collection
Download Postman files for testing