Docs/Testing

Testing

Test your integration without processing real payments. Use test mode API keys and test card numbers.

Test Mode vs Live Mode

FeatureTest ModeLive Mode
API Key Prefixwp3_test_sk_wp3_live_sk_
Real PaymentsNoYes
Crypto DeliverySimulatedReal
WebhooksSent normallySent normally
DashboardSeparate test dataSeparate live data

Toggle between test and live mode in your dashboard to view respective data.

Test Card Numbers

Use these card numbers in test mode. Use any future expiry date and any 3-digit CVC.

Successful Payments

Card NumberBrandResult
4242 4242 4242 4242VisaSucceeds
4000 0566 5566 5556Visa (debit)Succeeds
5555 5555 5555 4444MastercardSucceeds
3782 822463 10005American ExpressSucceeds

Declined Payments

Card NumberDecline Reason
4000 0000 0000 0002Generic decline
4000 0000 0000 9995Insufficient funds
4000 0000 0000 9987Lost card
4000 0000 0000 0069Expired card
4000 0000 0000 0127Incorrect CVC

3D Secure Authentication

Card NumberBehavior
4000 0027 6000 3184Requires authentication, succeeds
4000 0082 6000 3178Requires authentication, fails

Test Wallet Addresses

In test mode, you can use any valid wallet address. No real crypto will be sent. Here are some valid test addresses:

# Ethereum/EVM compatible
0x742d35Cc6634C0532925a3b844Bc9e7595f5fB
0x8ba1f109551bD432803012645Hac136c22C5Bc
0x1234567890123456789012345678901234567890

# The "zero address" (not recommended)
0x0000000000000000000000000000000000000000

Local Webhook Testing

To receive webhooks locally during development, use a tunnel service like ngrok:

bash
# Start your local server
-green-400">npm run dev

# In another terminal, start ngrok
-green-400">ngrok http 3000

# You'll get a URL like: https://abc123.ngrok.io
# Add this URL as your webhook endpoint in the dashboard:
# https://abc123.ngrok.io/api/webhooks/web3pay

Alternative Tunneling Services

Simulating Webhook Events

You can trigger test webhooks from the dashboard, or manually send test events:

bash
# Simulate a completed transaction webhook
-green-400">curl -X POST http://localhost:3000/api/webhooks/web3pay \
  -H "Content-Type: application/json" \
  -H "x-web3pay-signature: t=1732624500,v1=test_signature" \
  -d '{
    "id": "evt_test_123",
    "type": "onramp.session.completed",
    "created_at": "2024-01-15T12:08:00Z",
    "data": {
      "session_id": "onramp_sess_test",
      "status": "completed",
      "wallet_address": "0x742d35Cc6634C0532925a3b844Bc9e7595f5fB",
      "crypto_amount": "0.0412",
      "tx_hash": "0xtest123..."
    }
  }'

Note: In development, you may want to skip signature verification or use a known test secret.

Testing Checklist

Before going live, verify these scenarios work correctly:

Happy Path

  • Create a session successfully
  • Complete payment with test card 4242...
  • Receive completed webhook
  • Verify transaction appears in dashboard

Payment Failures

  • Test declined card (4000 0000 0000 0002)
  • Test insufficient funds (4000 0000 0000 9995)
  • Verify failed webhook is received
  • Verify error message shown to user

Edge Cases

  • Session expiry (wait 30+ minutes)
  • Invalid wallet address
  • Amount below minimum ($10)
  • Unsupported currency/network

Webhooks

  • Signature verification works
  • Duplicate events handled (idempotency)
  • Failed webhook triggers retry

Going Live

When you're ready to accept real payments:

  1. Complete Stripe Connect verification in the dashboard
  2. Generate live API keys (wp3_live_sk_...)
  3. Update your application to use live keys
  4. Update webhook URL to point to production
  5. Test with a small real transaction

Keep environments separate

Never use test API keys in production or live keys in development. Keep your keys in environment variables and use different values per environment.

Back to home
Was this page helpful?