Testing Strategies
There are several ways to test webhooks during development:- Use the built-in “Test Webhook” button in your dashboard
- Expose your local server with ngrok or similar tools
- Use webhook testing services
- Create a staging environment
Test Webhook Button
The easiest way to test webhooks is using the built-in test button.How to Use
- Go to Dashboard > Shops
- Click on your shop
- Enter your webhook URL
- Click “Test Webhook”
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
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
- Download and install ngrok
- Start your local server:
- Start ngrok:
- Copy the ngrok URL:
- Use this URL in your webhook settings:
Example Setup
Testing with ngrok
- Start server:
node app.js
- Start ngrok:
ngrok http 3000
- Update webhook URL in dashboard to:
https://abc123.ngrok.io/api/webhooks/card2crypto
- Click “Test Webhook” button
- Check your local console for webhook logs
Alternative Tools
LocalTunnel
Free alternative to ngrok:Cloudflare Tunnel
Another free option:Webhook Testing Services
webhook.site
For quick testing without code:- Go to webhook.site
- Copy your unique URL
- Use it as your webhook URL in Card2Crypto dashboard
- Click “Test Webhook”
- View the received webhook on webhook.site
- Viewing webhook structure
- Checking headers
- Verifying signatures
- Debugging issues
RequestBin
Similar to webhook.site:- Go to requestbin.com
- Click “Create a RequestBin”
- Use the provided URL in your dashboard
- Test webhooks and inspect payloads
Manual Testing
Create test scripts to send webhooks to your endpoint:Node.js Test Script
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
Issue: Signature Verification Fails
Possible causes:- Using wrong webhook secret
- Body parsing modifies payload
- Incorrect signature algorithm
Issue: Timeout Errors
Possible causes:- Slow processing in webhook handler
- Not returning 200 OK immediately
- Database queries taking too long
Production Testing
Before going live, test with real payments in production:- Create a test shop in production
- Make a small real payment ($0.50 minimum)
- Verify webhook is received
- Check payment shows in dashboard
- Verify balance is credited