Webhook Endpoint
CeyPay sends webhook notifications to your store’s WooCommerce API endpoint:The webhook URL is generated automatically by WooCommerce. You can find the
exact URL by checking the webhook configuration in your CeyPay dashboard or by
examining the
webhookUrl parameter in API requests.Webhook Events
CeyPay sends webhooks for the following payment status changes:| Status | Description | WooCommerce Action |
|---|---|---|
SUCCESS | Payment completed successfully | Order marked as “Processing” |
PAID | Payment confirmed (alias for SUCCESS) | Order marked as “Processing” |
EXPIRED | Payment window expired | Order marked as “Failed” |
FAILED | Payment was declined or errored | Order marked as “Failed” |
Webhook Payload
Request Headers
Each webhook request includes these headers for verification:| Header | Description |
|---|---|
X-Webhook-Signature | HMAC-SHA256 signature of the payload |
X-Webhook-Timestamp | Unix timestamp when the webhook was sent |
Content-Type | Always application/json |
Request Body
The webhook payload is a JSON object containing payment details:Unique identifier for the payment transaction. This is stored in the order
metadata as
_ceypay_transaction_id.Alternative field name for the payment ID. The plugin accepts either
paymentId or transactionId.Current payment status. One of:
SUCCESS, PAID, EXPIRED, FAILED.Example Payload
Signature Verification
All webhook requests are signed using HMAC-SHA256 to ensure authenticity. The plugin automatically verifies signatures before processing any webhook.How Signatures Work
- CeyPay concatenates the timestamp and JSON payload
- The combined string is hashed using HMAC-SHA256 with your webhook secret
- The resulting signature is included in the
X-Webhook-Signatureheader
Verification Process
The plugin verifies signatures using this logic:Test Mode Signatures
When Test Mode is enabled, the plugin uses a predefined secret (mock_secret_key) for signature verification. This allows the test server to send valid webhooks without configuring your production credentials.
Order Matching
The plugin matches incoming webhooks to WooCommerce orders using the transaction ID stored in order metadata.Lookup Process
- Extract
paymentIdortransactionIdfrom webhook payload - Query WooCommerce orders for meta key
_ceypay_transaction_id - If found, update the order status based on payment status
- If not found, log the error (order may have been deleted)
Stored Order Metadata
The following metadata is stored on each order:| Meta Key | Description |
|---|---|
_ceypay_transaction_id | CeyPay transaction identifier |
_ceypay_provider | Selected payment provider (BYBIT, BINANCE, KUCOIN) |
_ceypay_qr_code_url | QR code content URL |
_ceypay_deep_link | Deep link URL for mobile wallets |
Handling Webhook Responses
Success Response
Return HTTP200 OK to acknowledge successful webhook processing:
Error Responses
| Status Code | Meaning |
|---|---|
400 Bad Request | Invalid or malformed payload |
401 Unauthorized | Signature verification failed |
405 Method Not Allowed | Non-POST request received |
500 Internal Server Error | Webhook secret not configured |
Debugging Webhooks
Enable Logging
In Test Mode, webhook activity is automatically logged to WooCommerce logs. Access logs at: WooCommerce > Status > Logs → Select files prefixed withceypay-
Log Entries
Typical log entries include:Common Issues
Signature Mismatch
Signature Mismatch
Cause: Webhook secret doesn’t match between CeyPay dashboard and plugin settings.Solution: Copy the webhook secret directly from your CeyPay dashboard and paste it into the plugin settings. Avoid adding extra spaces or characters.
Order Not Found
Order Not Found
Cause: The order was deleted, or the customer abandoned checkout before the QR code was generated.Solution: This is usually expected behavior for abandoned checkouts. No action required.
Webhooks Not Received
Webhooks Not Received
Cause: Server firewall blocking incoming requests, or site not accessible from internet.Solution: Ensure your site has a valid SSL certificate and is publicly accessible. Check server firewall rules.
Security Best Practices
Keep Secret Secure
Never expose your webhook secret in client-side code, version control, or
public logs.
Use HTTPS
Always use HTTPS for your webhook endpoint. HTTP webhooks should be
rejected.
Verify Signatures
Always verify webhook signatures. The plugin does this automatically.
Idempotency
Handle duplicate webhooks gracefully. The plugin checks order status before
updating.
Retry Policy
If your webhook endpoint is unavailable, CeyPay may retry the webhook. The plugin handles this by checking if the order is already processed before making changes.Next Steps
Troubleshooting
Solutions for common webhook and integration issues.
Configuration
Review all available plugin settings.