Skip to main content

What are Webhooks?

Webhooks allow CWMPay to notify your server automatically when a payment event occurs — without you needing to poll or manually verify. When a payment is confirmed, CWMPay sends a POST request to your webhook URL with the payment details.

Setting Up Webhooks

  1. Login to app.cwmpay.in
  2. Go to Webhooks section from the sidebar
  3. Enter your HTTPS webhook URL
  4. Click Save Webhook
  5. Copy your Webhook Secret — store it safely

Option 2 — Per Payment

Pass webhookUrl in the Create Payment request:
Per-payment webhookUrl takes priority over the dashboard webhook URL.
HTTPS RequiredCWMPay only accepts HTTPS webhook URLs. HTTP URLs (including raw VPS IPs like http://192.168.1.1:3000) are not supported.Hosting on VPS without a domain? Use a free tunnel service to get an HTTPS URL:
Use the generated HTTPS URL as your webhook endpoint in the CWMPay dashboard.

Webhook Payload

CWMPay sends a POST request with Content-Type: application/json:

Payload Fields

Events

Handling Webhooks

Always respond with 200 status quickly. If your server takes too long to respond, CWMPay will retry the webhook. Process heavy tasks asynchronously after returning 200.

Retry Logic

If your webhook endpoint fails (non-2xx response or timeout), CWMPay will retry automatically.

Security

Always verify the webhook signature before processing. See Verify Signature for detailed instructions.
Never process a webhook without verifying the signature. An attacker could send fake payment success events to your endpoint.

Testing Webhooks

Use the Test Webhook button in your dashboard to send a test event to your webhook URL. Use webhook.site for quick testing during development.

Next Steps

Verify Signature

Learn how to verify webhook signatures

Error Reference

View all error codes