Webhooks Configuration
Configure payment gateway webhooks to handle subscriptions, payment notifications, and real-time updates.
What are Webhooks?
Webhooks are automated messages sent from payment gateways to CoinTrail when specific events occur. They allow your application to receive real-time notifications about:
- Successful payments - When a customer completes a payment
- Failed payments - When a payment attempt fails
- Subscription renewals - When a recurring subscription is charged
- Subscription cancellations - When a customer cancels their subscription
- Refunds - When a payment is refunded
- Disputes/Chargebacks - When a customer disputes a charge
Without properly configured webhooks, CoinTrail cannot automatically update subscription statuses, process renewals, or handle cancellations. Make sure to configure webhooks for every payment gateway you use.
Webhook Endpoint Structure
CoinTrail provides a unified webhook endpoint for all payment gateways. The URL pattern is:
https://yourdomain.com/api/webhooks/payment/{gateway}
Replace {gateway} with the gateway identifier from the table below:
| Gateway | Identifier | Full Webhook URL |
|---|---|---|
| Stripe | stripe | https://yourdomain.com/api/webhooks/payment/stripe |
| PayPal | paypal | https://yourdomain.com/api/webhooks/payment/paypal |
| Razorpay | razorpay | https://yourdomain.com/api/webhooks/payment/razorpay |
| Paystack | paystack | https://yourdomain.com/api/webhooks/payment/paystack |
| Flutterwave | flutterwave | https://yourdomain.com/api/webhooks/payment/flutterwave |
| Mollie | mollie | https://yourdomain.com/api/webhooks/payment/mollie |
| CoinGate | coingate | https://yourdomain.com/api/webhooks/payment/coingate |
| NOWPayments | nowpayments | https://yourdomain.com/api/webhooks/payment/nowpayments |
| Coinbase Commerce | coinbase_commerce | https://yourdomain.com/api/webhooks/payment/coinbase_commerce |
| Cryptomus | cryptomus | https://yourdomain.com/api/webhooks/payment/cryptomus |
| Binance Pay | binance_pay | https://yourdomain.com/api/webhooks/payment/binance_pay |
| Paytm | paytm | https://yourdomain.com/api/webhooks/payment/paytm |
| Instamojo | instamojo | https://yourdomain.com/api/webhooks/payment/instamojo |
| Monnify | monnify | https://yourdomain.com/api/webhooks/payment/monnify |
| Skrill | skrill | https://yourdomain.com/api/webhooks/payment/skrill |
| 2Checkout | 2checkout | https://yourdomain.com/api/webhooks/payment/2checkout |
| Authorize.net | authorize_net | https://yourdomain.com/api/webhooks/payment/authorize_net |
Traditional Payment Gateways
Stripe
Stripe is the most popular payment gateway and requires webhook configuration for subscription management.
Setup Steps:
- Log in to your Stripe Dashboard
- Navigate to Developers → Webhooks
- Click Add endpoint
- Enter the webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/stripe - Select the following events to listen for:
checkout.session.completed- When checkout is successfulcustomer.subscription.created- New subscription createdcustomer.subscription.updated- Subscription plan changedcustomer.subscription.deleted- Subscription cancelledinvoice.paid- Invoice successfully paidinvoice.payment_failed- Payment attempt failedcharge.refunded- Payment refundedcharge.dispute.created- Chargeback initiated
- Click Add endpoint
- Click on the newly created webhook endpoint
- Under Signing secret, click Reveal and copy the secret
- Add the signing secret to your
.envfile:
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_signing_secret_here
Stripe webhooks use HMAC-SHA256 signatures for security. The signing secret is required to verify that webhook requests actually come from Stripe.
PayPal
PayPal webhooks are essential for handling subscription payments and IPN (Instant Payment Notification) events.
Setup Steps:
- Log in to the PayPal Developer Dashboard
- Select your app under My Apps & Credentials
- Scroll down to Webhooks and click Add Webhook
- Enter the webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/paypal - Select the following event types:
PAYMENT.CAPTURE.COMPLETED- Payment captured successfullyPAYMENT.CAPTURE.DENIED- Payment capture deniedBILLING.SUBSCRIPTION.CREATED- Subscription createdBILLING.SUBSCRIPTION.ACTIVATED- Subscription activatedBILLING.SUBSCRIPTION.CANCELLED- Subscription cancelledBILLING.SUBSCRIPTION.SUSPENDED- Subscription suspendedPAYMENT.SALE.COMPLETED- Sale completedPAYMENT.SALE.REFUNDED- Sale refunded
- Click Save
- Copy the Webhook ID and add it to your
.env:
PAYPAL_WEBHOOK_ID=your_webhook_id_here
Razorpay
Razorpay is popular in India and requires webhook configuration for payment confirmations.
Setup Steps:
- Log in to your Razorpay Dashboard
- Go to Settings → Webhooks
- Click Add New Webhook
- Enter the webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/razorpay - Create a Secret (a strong random string)
- Select events:
payment.capturedpayment.failedsubscription.chargedsubscription.cancelledsubscription.haltedrefund.created
- Click Create Webhook
- Add the secret to your
.env:
RAZORPAY_WEBHOOK_SECRET=your_webhook_secret_here
Paystack
Paystack is popular in Africa (Nigeria, Ghana, South Africa, Kenya).
Setup Steps:
- Log in to your Paystack Dashboard
- Go to Settings → API Keys & Webhooks
- Under Webhook URL, enter:
URL
https://yourdomain.com/api/webhooks/payment/paystack - Click Save
Paystack automatically sends the following events:
charge.success- Successful paymentsubscription.create- New subscriptionsubscription.disable- Subscription cancelledinvoice.payment_failed- Payment failedrefund.processed- Refund completed
Paystack webhooks are verified using your secret key. The signature is sent in the X-Paystack-Signature header.
Flutterwave
Flutterwave supports payments across Africa with multiple currencies.
Setup Steps:
- Log in to your Flutterwave Dashboard
- Go to Settings → Webhooks
- Enter the webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/flutterwave - Set your Secret Hash (this verifies webhooks)
- Add the secret hash to your
.env:
FLUTTERWAVE_SECRET_HASH=your_secret_hash_here
Flutterwave sends the secret hash in the verif-hash header for verification.
Mollie
Mollie is popular in Europe (Netherlands, Belgium, Germany, etc.).
Setup Steps:
- Log in to your Mollie Dashboard
- Go to Developers → Webhooks
- Enter the webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/mollie
Mollie doesn't use signature verification. Instead, when you receive a webhook, CoinTrail calls the Mollie API to verify the payment status automatically.
Cryptocurrency Payment Gateways
CoinGate
CoinGate allows you to accept Bitcoin, Ethereum, and 50+ other cryptocurrencies.
Setup Steps:
- Log in to your CoinGate Dashboard
- Go to Account → API → Callback URL
- Set the callback URL:
URL
https://yourdomain.com/api/webhooks/payment/coingate
CoinGate verifies callbacks using:
- IP Whitelisting - Only accepts callbacks from CoinGate's IP addresses
- Token verification - A unique token is included in each callback
NOWPayments
NOWPayments supports 150+ cryptocurrencies with instant exchange.
Setup Steps:
- Log in to your NOWPayments Dashboard
- Go to Store Settings → IPN
- Enable IPN Callback
- Set the IPN Callback URL:
URL
https://yourdomain.com/api/webhooks/payment/nowpayments - Copy your IPN Secret Key
- Add it to your
.env:
NOWPAYMENTS_IPN_SECRET=your_ipn_secret_key_here
NOWPayments uses HMAC-SHA512 signatures with sorted payload for verification. The signature is sent in the x-nowpayments-sig header.
Coinbase Commerce
Coinbase Commerce allows you to accept Bitcoin, Ethereum, Litecoin, and other popular cryptocurrencies.
Setup Steps:
- Log in to Coinbase Commerce
- Go to Settings → Webhooks
- Click Add an endpoint
- Enter the webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/coinbase_commerce - Copy the Shared Secret shown
- Add it to your
.env:
COINBASE_COMMERCE_WEBHOOK_SECRET=your_shared_secret_here
Coinbase Commerce uses HMAC-SHA256 signatures. The signature is sent in the X-CC-Webhook-Signature header.
Cryptomus
Cryptomus offers crypto payment processing with low fees.
Setup Steps:
- Log in to your Cryptomus Dashboard
- Go to Settings → Webhooks
- Set the callback URL:
URL
https://yourdomain.com/api/webhooks/payment/cryptomus
Cryptomus includes a sign parameter in the payload calculated as base64(MD5(json + api_key)).
Binance Pay
Binance Pay allows users to pay with crypto from their Binance wallet.
Setup Steps:
- Log in to Binance Merchant Portal
- Go to Account → Webhooks
- Add your webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/binance_pay
Binance Pay sends three headers for verification:
BinancePay-TimestampBinancePay-NonceBinancePay-Signature(HMAC-SHA512)
Regional Payment Gateways
Paytm (India)
- Log in to Paytm Dashboard
- Go to Developer Settings → Callback URL
- Set the callback URL:
URL
https://yourdomain.com/api/webhooks/payment/paytm
Paytm uses checksum verification with the CHECKSUMHASH parameter.
Instamojo (India)
- Log in to Instamojo Dashboard
- Go to Developers → Webhooks
- Add your webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/instamojo
Instamojo uses HMAC-SHA1 signatures with the mac parameter.
Monnify (Nigeria)
- Log in to Monnify Dashboard
- Go to Settings → Notifications
- Set the webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/monnify
Monnify includes a transactionHash (SHA512) for verification.
Skrill (Europe)
- Log in to your Skrill Merchant Account
- Go to Developer Settings → Status URL
- Set the status URL:
URL
https://yourdomain.com/api/webhooks/payment/skrill
Skrill uses MD5 signatures with the md5sig parameter.
2Checkout
- Log in to 2Checkout Dashboard
- Go to Integrations → Webhooks & API
- Under INS (Instant Notification Service), set the URL:
URL
https://yourdomain.com/api/webhooks/payment/2checkout
Authorize.net
- Log in to Authorize.net Merchant Interface
- Go to Account → Transaction Format Settings → Webhooks
- Click Add Webhook
- Set the webhook URL:
URL
https://yourdomain.com/api/webhooks/payment/authorize_net
Authorize.net uses HMAC-SHA512 signatures in the X-ANET-Signature header.
Testing Webhooks
Before going live, test your webhook configuration to ensure everything works correctly.
Stripe CLI (Recommended for Stripe)
The Stripe CLI allows you to forward webhooks to your local development environment:
# Install Stripe CLI
# macOS: brew install stripe/stripe-cli/stripe
# Windows: scoop install stripe
# Login to your Stripe account
stripe login
# Forward webhooks to your local server
stripe listen --forward-to http://localhost/api/webhooks/payment/stripe
# Trigger a test event
stripe trigger checkout.session.completed
ngrok (For All Gateways)
Use ngrok to expose your local server to receive webhooks during development:
# Install ngrok from https://ngrok.com/
# Expose your local server
ngrok http 80
# Use the generated URL (e.g., https://abc123.ngrok.io) in your gateway settings
Webhook.site (Quick Testing)
Use webhook.site to inspect webhook payloads before connecting to CoinTrail. This helps you understand the data structure each gateway sends.
Webhook Security
CoinTrail implements multiple security measures for webhooks:
Security Best Practices
- Signature Verification - All webhooks with signature support are verified before processing
- HTTPS Required - Always use HTTPS for webhook endpoints in production
- IP Whitelisting - Some gateways (like CoinGate) only send webhooks from specific IPs
- Idempotency - CoinTrail handles duplicate webhook events gracefully
- Logging - All webhook events are logged for debugging and audit purposes
Signature Headers by Gateway
| Gateway | Signature Header/Field | Algorithm |
|---|---|---|
| Stripe | Stripe-Signature | HMAC-SHA256 |
| PayPal | PAYPAL-TRANSMISSION-SIG | SHA256withRSA |
| Razorpay | X-Razorpay-Signature | HMAC-SHA256 |
| Paystack | X-Paystack-Signature | HMAC-SHA512 |
| Flutterwave | verif-hash | Secret hash comparison |
| Coinbase Commerce | X-CC-Webhook-Signature | HMAC-SHA256 |
| NOWPayments | x-nowpayments-sig | HMAC-SHA512 |
| Binance Pay | BinancePay-Signature | HMAC-SHA512 |
| Authorize.net | X-ANET-Signature | HMAC-SHA512 |
Troubleshooting
Common Issues
| Issue | Cause | Solution |
|---|---|---|
| Webhook returns 403 error | Signature verification failed | Verify the webhook secret/signing key in your .env file matches the gateway settings |
| Webhook returns 404 error | Wrong URL or gateway not enabled | Check the webhook URL and ensure the gateway is enabled in Admin Panel |
| Webhook returns 500 error | Server error during processing | Check storage/logs/laravel.log for detailed error messages |
| Subscription not updating | Webhook not reaching server | Check gateway dashboard for webhook delivery status; verify URL is correct |
| Duplicate transactions | Webhook retried multiple times | This is normal - CoinTrail handles idempotency automatically |
Viewing Webhook Logs
Check webhook activity in multiple places:
- Laravel Logs -
storage/logs/laravel.logcontains detailed webhook processing logs - Gateway Dashboard - Most gateways show webhook delivery history with request/response details
Temporarily set APP_DEBUG=true in your .env file to see detailed error messages in webhook responses. Remember to set it back to false in production.