Why Webhooks?
Get real-time notifications when payments complete, fail, or change status. Webhooks keep your system in sync without polling.Instant Updates
Know immediately when payments complete or fail
Reliable Delivery
Automatic retries ensure you never miss events
Efficient
No need to constantly poll for status updates
Complete Information
Each webhook includes full payment details
Setup
1
Create an Endpoint
Create a route on your server to receive webhook POST requests.
2
Configure Your Webhook in Cheqpay Suite
Sign in to Cheqpay Suite, open Settings (bottom-left), then select Webhooks in the side menu. Click the cog icon to manage your webhook URL and secret. We recommend managing this yourself; alternatively, you can contact our support team if you prefer they configure it for you.
3
Verify Signatures
Always validate that webhooks come from Cheqpay (see security below).
Configure in Cheqpay Suite
Cheqpay Suite is the control platform we provide to our registered clients to manage and monitor their operations. Access is typically granted as part of the contract signing process. If you do not yet have Suite access, contact our support team at support@cheqpay.mx. They will confirm your account and guide you through the steps to get started. Once you have access:- Sign in to your Cheqpay Suite session.
- Open Settings from the bottom-left of the sidebar.
- In the side menu, select Webhooks.
- Click the cog icon on the Webhook card to manage your webhook URL and secret.
Webhook settings in Cheqpay Suite
You can view, copy, and update your webhook URL and secret directly from Cheqpay Suite. Keep your webhook secret secure and never commit it to version control.
Webhook Events
Payment Events
Subscription Events
Webhook Format
Payment Events
Each webhook includes event details and payment information:paymentMethod field looks like this:
paymentMethod field looks like this:
paymentMethod field looks like this:
CIE references are 8 digits.
Common Fields
Handle Webhooks Properly
Requirements
Respond Quickly
Respond Quickly
Return
200 OK within 5 seconds. Process data asynchronously.Verify Signatures
Verify Signatures
Always check authenticity before processing events.
Process Async
Process Async
Queue work for background processing. Don’t block the response.
Handle Duplicates
Handle Duplicates
Events may be sent multiple times. Make your handler idempotent.
Example Handler (Node.js)
Example Handler (Python)
Security
Verify every webhook to ensure it’s from Cheqpay.New merchants use the enriched signature by default. Every newly created merchant has enriched webhook signatures enabled automatically. Existing merchants keep the legacy signature unless enriched signatures are enabled for their account.
How Signatures Work
Cheqpay signs webhooks using HMAC-SHA256 with specific payload fields joined by a pipe (|) delimiter, plus the full webhook JSON body as the final part. The signature is sent in the x-webhook-signature header.
Including the full body ensures each delivery produces a unique signature (for example when the same amount and payment method appear on different orders), which improves reconciliation and tamper detection.
For payment events, the signed fields are:
JSON.stringify(payload) must be the full webhook body you received (id, event, and data), stringified with standard JSON serialization.
Signature Verification (Node.js)
Signature Verification (Python)
Legacy Signatures
Legacy. The field-only signature below applies to existing merchants that do not have enriched webhook signatures enabled. New merchants do not use this scheme.
How Legacy Signatures Work
Cheqpay signs webhooks using HMAC-SHA256 with specific payload fields joined by a pipe (|) delimiter. The signature is sent in the x-webhook-signature header. The full webhook body is not included.
For payment events, the signed fields are:
Legacy Signature Verification (Node.js)
Legacy Signature Verification (Python)
PAYCASH Order Status Change Example
When a PayCash deposit is reconciled, you’ll receive a status change event similar to this:CIE Cash Net Order Status Change Example
When a CIE Cash Net deposit is reconciled, you’ll receive a status change event similar to this:Handle Duplicate Events
Cheqpay uses payload hashing to prevent duplicate events, but your handler should still be idempotent:Event-Specific Handling
Payment Captured
Payment Authorization Failed
Refund Processed
Subscription Plan Changed
Triggered when a customer changes their subscription plan. Includes complete proration details and whether the change was an upgrade or downgrade.Payload Structure
Payload Fields
Subscription Signature Verification
Use the enriched scheme below (default for new merchants). For legacy merchants without enriched signatures, omitJSON.stringify(payload) from the signed string — see Legacy Signatures.
Example Handler
Proration can be null if the merchant used
prorationBehavior: "none" when changing the plan. Always check if proration exists before accessing its properties.Automatic Retries
If your endpoint is unavailable, Cheqpay retries automatically with up to 10 attempts.Test Mode (Sandbox)
Retries every 60 minutes for up to 10 attempts.Live Mode (Production)
1
Initial Attempt
Webhook is sent to your endpoint.
2
Retries 1-4
Every 5 minutes (at 5, 10, 15, and 20 minutes after initial attempt).
3
Retries 5-10
Every 60 minutes until max retries are exhausted.
4
Failed
After all retries are exhausted, the webhook is marked as failed.
Testing Locally
Use ngrok to test webhooks during development:Remember to update to your production URL before going live.
Monitoring and Debugging
Log All Webhooks
Monitor Webhook Health
Track webhook delivery and processing:Best Practices
Use HTTPS Only
Use HTTPS Only
Always use HTTPS endpoints for production. Cheqpay will not send webhooks to HTTP URLs in live mode.
Verify All Signatures
Verify All Signatures
Never skip signature verification. This protects against spoofed webhooks.
Return 200 Quickly
Return 200 Quickly
Respond within 5 seconds. Use background jobs for actual processing.
Handle Duplicates
Handle Duplicates
Use the webhook
id to track processed events and avoid duplicate processing.Monitor Failures
Monitor Failures
Set up alerts for webhook failures. Investigate and fix issues quickly.
Log Everything
Log Everything
Log all webhook events for debugging and audit trails.
Webhook Endpoint Requirements
HTTPS Required
Must use secure HTTPS connection in production
Public Access
Endpoint must be publicly accessible
Fast Response
Return 200 OK within 5 seconds
Signature Verification
Verify signatures on all requests
Next Steps
View Payment Orders
Learn about payment statuses
Handle Refunds
Process refund webhooks
Testing Guide
Test webhooks in sandbox
Error Handling
Handle webhook errors gracefully