Skip to main content

Testing Strategies

There are several ways to test webhooks during development:
  1. Use the built-in “Test Webhook” button in your dashboard
  2. Expose your local server with ngrok or similar tools
  3. Use webhook testing services
  4. Create a staging environment

Test Webhook Button

The easiest way to test webhooks is using the built-in test button.

How to Use

  1. Go to Dashboard > Shops
  2. Click on your shop
  3. Enter your webhook URL
  4. Click “Test Webhook”
This sends a payment.completed event with test data to your endpoint.

Test Payload

Expected Response

Your endpoint should:
  • Return 200 OK status code
  • Respond within 10 seconds
  • Verify the HMAC signature
If successful, you’ll see: “Webhook test successful! Your endpoint is configured correctly.”

Local Development with ngrok

When developing locally, your server isn’t publicly accessible. Use ngrok to create a public URL that forwards to your local machine.

Setup ngrok

  1. Download and install ngrok
  2. Start your local server:
  1. Start ngrok:
  1. Copy the ngrok URL:
  1. Use this URL in your webhook settings:

Example Setup

Testing with ngrok

  1. Start server: node app.js
  2. Start ngrok: ngrok http 3000
  3. Update webhook URL in dashboard to: https://abc123.ngrok.io/api/webhooks/card2crypto
  4. Click “Test Webhook” button
  5. Check your local console for webhook logs

Alternative Tools

LocalTunnel

Free alternative to ngrok:
Use the provided URL in your webhook settings.

Cloudflare Tunnel

Another free option:

Webhook Testing Services

webhook.site

For quick testing without code:
  1. Go to webhook.site
  2. Copy your unique URL
  3. Use it as your webhook URL in Card2Crypto dashboard
  4. Click “Test Webhook”
  5. View the received webhook on webhook.site
This is useful for:
  • Viewing webhook structure
  • Checking headers
  • Verifying signatures
  • Debugging issues

RequestBin

Similar to webhook.site:
  1. Go to requestbin.com
  2. Click “Create a RequestBin”
  3. Use the provided URL in your dashboard
  4. Test webhooks and inspect payloads

Manual Testing

Create test scripts to send webhooks to your endpoint:

Node.js Test Script

Run it:

cURL Test

Testing Different Events

Test all event types to ensure your integration handles them correctly:

Payment Completed

Payment Failed

Payment Refunded

Automated Testing

Unit Tests

Test your webhook handler in isolation:

Integration Tests

Test the complete webhook flow:

Common Testing Issues

Issue: Webhook Not Received

Possible causes:
  • Server not running
  • Firewall blocking requests
  • Incorrect URL
  • ngrok tunnel expired
Solution:

Issue: Signature Verification Fails

Possible causes:
  • Using wrong webhook secret
  • Body parsing modifies payload
  • Incorrect signature algorithm
Solution:

Issue: Timeout Errors

Possible causes:
  • Slow processing in webhook handler
  • Not returning 200 OK immediately
  • Database queries taking too long
Solution:

Production Testing

Before going live, test with real payments in production:
  1. Create a test shop in production
  2. Make a small real payment ($0.50 minimum)
  3. Verify webhook is received
  4. Check payment shows in dashboard
  5. Verify balance is credited
Use your own credit card for testing to avoid issues.

Monitoring Webhooks

Set up monitoring to track webhook health:

Next Steps

Webhook Security

Learn how to verify webhook signatures

Webhook Events

Complete list of webhook event types