Testing & Sandbox
Test your integration before going live with real payments
Sandbox Environment
The sandbox environment is a complete replica of production. All API endpoints work identically, but no real money is processed. Test thoroughly before switching to production.
Environment Setup
| Environment | Base URL | Key Prefix |
|---|---|---|
| Sandbox | https://api-sandbox.hedgepayments.com | sk_test_ |
| Production | https://api.hedgepayments.com | sk_live_ |
// SDK Configuration
import { HedgePayments } from '@hedgepayments/node'
// Sandbox
const hedgeTest = new HedgePayments({
apiKey: process.env.HEDGE_TEST_API_KEY, // pk_test_...
apiSecret: process.env.HEDGE_TEST_SECRET, // sk_test_...
environment: 'sandbox'
})
// Production
const hedgeLive = new HedgePayments({
apiKey: process.env.HEDGE_LIVE_API_KEY, // pk_live_...
apiSecret: process.env.HEDGE_LIVE_SECRET, // sk_live_...
environment: 'production'
})Test Card Numbers
Use these card numbers in sandbox mode. Use any future expiration date and any 3-digit CVC (4-digit for Amex).
Successful Payments
| Number | Brand | Description |
|---|---|---|
| 4242 4242 4242 4242 | Visa | Succeeds |
| 5555 5555 5555 4444 | Mastercard | Succeeds |
| 3782 822463 10005 | Amex | Succeeds |
| 6011 1111 1111 1117 | Discover | Succeeds |
| 3566 0020 2036 0505 | JCB | Succeeds |
Decline Scenarios
| Number | Error Code | Description |
|---|---|---|
| 4000 0000 0000 0002 | card_declined | Generic decline |
| 4000 0000 0000 9995 | insufficient_funds | Insufficient funds |
| 4000 0000 0000 9987 | lost_card | Lost card |
| 4000 0000 0000 9979 | stolen_card | Stolen card |
| 4000 0000 0000 0069 | expired_card | Expired card |
| 4000 0000 0000 0127 | incorrect_cvc | Incorrect CVC |
3D Secure Test Cards
| Number | Behavior |
|---|---|
| 4000 0000 0000 3220 | 3DS required, authentication succeeds |
| 4000 0000 0000 3063 | 3DS required, authentication fails |
| 4000 0000 0000 3055 | 3DS supported but not required |
Test ACH Accounts
For Plaid sandbox bank linking:
Username
user_goodPassword
pass_good| Account Number | Routing | Result |
|---|---|---|
| 1111222233330000 | 011401533 | Success |
| 1111222233331111 | 011401533 | Insufficient Funds |
| 1111222233332222 | 011401533 | Account Closed |
Testing Webhooks
Test webhook delivery without making real transactions:
Local Development
# Install the Hedge CLI
npm install -g @hedgepayments/cli
# Forward webhooks to your local server
hedge listen --forward-to localhost:3000/webhooks/hedge
# In another terminal, trigger test events
hedge trigger payment.succeeded
hedge trigger payment.failed
hedge trigger ach.returnedAPI Trigger
// Trigger a test webhook event via API
await hedge.webhooks.trigger({
event: 'payment.succeeded',
payload: {
id: 'pay_test123',
amount: 9999,
status: 'succeeded'
}
})Sandbox Limitations
- • No real money is processed
- • Test transactions are automatically cleared after 24 hours
- • Rate limits are more permissive than production
- • Webhook retries happen faster for easier testing
- • Some fraud checks are disabled
⚠️ Important: Never use real card numbers in sandbox mode, and never use test card numbers in production.
Go-Live Checklist
Switch from sandbox to production API keys
Verify webhook endpoint is publicly accessible
Test a real transaction with a small amount
Configure production webhook URL in dashboard
Enable email notifications for failed payments
Set up monitoring and alerting
Review and configure fraud rules
Complete business verification (KYB)