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

EnvironmentBase URLKey Prefix
Sandboxhttps://api-sandbox.hedgepayments.comsk_test_
Productionhttps://api.hedgepayments.comsk_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

NumberBrandDescription
4242 4242 4242 4242VisaSucceeds
5555 5555 5555 4444MastercardSucceeds
3782 822463 10005AmexSucceeds
6011 1111 1111 1117DiscoverSucceeds
3566 0020 2036 0505JCBSucceeds

Decline Scenarios

NumberError CodeDescription
4000 0000 0000 0002card_declinedGeneric decline
4000 0000 0000 9995insufficient_fundsInsufficient funds
4000 0000 0000 9987lost_cardLost card
4000 0000 0000 9979stolen_cardStolen card
4000 0000 0000 0069expired_cardExpired card
4000 0000 0000 0127incorrect_cvcIncorrect CVC

3D Secure Test Cards

NumberBehavior
4000 0000 0000 32203DS required, authentication succeeds
4000 0000 0000 30633DS required, authentication fails
4000 0000 0000 30553DS supported but not required

Test ACH Accounts

For Plaid sandbox bank linking:

Username

user_good

Password

pass_good
Account NumberRoutingResult
1111222233330000011401533Success
1111222233331111011401533Insufficient Funds
1111222233332222011401533Account 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.returned

API 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)