Overview
The Payment Links API sandbox environment provides a safe, isolated testing space where you can develop and test your payment link 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/payment-links | business.coinbase.com/api/v1/payment-links |
| 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 Payment Links API
2. Configure Your Application
The only change required to use sandbox is updating your API endpoint to include the/sandbox path segment:
1
Update Base URL
Change your API base URL to include the sandbox path:
2
Create Test Payment Links
Use the same API calls as production to create payment links:
3
Test Payment Flows
Use the returned payment link URL to test payment flows
API Endpoints
All Payment Links API endpoints are available in sandbox with the/sandbox path prefix:
| Endpoint | Sandbox URL |
|---|---|
| Create Payment Link | POST /sandbox/api/v1/payment-links |
| List Payment Links | GET /sandbox/api/v1/payment-links |
| Get Payment Link | GET /sandbox/api/v1/payment-links/{id} |
| Deactivate Payment Link | DELETE /sandbox/api/v1/payment-links/{id} |
Webhook Events
Sandbox webhook events work the same as production but are differentiated using thesandbox label. 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 payment links, create a subscription with"sandbox": "true" in the labels:
Webhook Event Types
The same event types are available for both sandbox and production:| Event Type | Description |
|---|---|
payment_link.payment.success | Payment link successfully paid |
payment_link.payment.failed | Payment link payment failed |
payment_link.payment.expired | Payment link 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 payment links
Separate Webhook Subscriptions
Separate Webhook Subscriptions
Create separate webhook subscriptions for sandbox and production:
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:1
Complete Integration Testing
Ensure all features work correctly in sandbox with comprehensive test coverage
2
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
3
Update Configuration
Switch from sandbox to production endpoints:
4
Test with Small Amounts
Begin with small payment amounts to verify everything works as expected
5
Monitor Closely
Set up monitoring and alerting for:
- Failed payments
- API errors
- Webhook delivery failures
Troubleshooting
401 Unauthorized Errors
401 Unauthorized Errors
Not Receiving Sandbox Webhooks
Not Receiving Sandbox Webhooks
Problem: Webhook events are not being delivered for sandbox payment linksSolutions:
- Verify your subscription has
"sandbox": "true"in labels - 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
Payment Link URL Not Working
Payment Link URL Not Working
Problem: Unable to complete payment on sandbox payment linkSolutions:
- Verify the payment link hasn’t expired
- Check the payment link status via API
- Ensure the payment link 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 payment link 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