Webhooks let you receive real-time notifications in your application whenever a PayOrder changes status. Rather than polling the CoinVoyage API for updates, you register an HTTPS endpoint and CoinVoyage delivers aDocumentation Index
Fetch the complete documentation index at: https://coinvoyage-3c99945b.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
POST request with the event details each time something happens — payment received, confirmed on-chain, completed, refunded, and more.
Set up a webhook
Register and manage your webhook endpoints in the CoinVoyage Dashboard under the Developers section.Navigate to Developers → Webhooks
Open the CoinVoyage Dashboard and select Developers in the sidebar, then click Webhooks.
Select the events to subscribe to
Choose which PayOrder lifecycle events should trigger delivery to your endpoint. Subscription event identifiers use uppercase
ORDER_* format (for example, ORDER_COMPLETED).The
type field in the delivered JSON payload uses lowercase payorder_* values — for example, subscribing to ORDER_COMPLETED results in payloads with "type": "payorder_completed". See Webhook Events for the full mapping.Your endpoint must be publicly accessible and respond with a
2xx status code within 30 seconds. Responses outside this window are treated as delivery failures.Verify webhook signatures
Every webhook request includes aCoinVoyage-Webhook-Signature header containing an HMAC-SHA256 signature of the raw request body, encoded in Base64. Always verify this signature before parsing or acting on the payload.
The example below shows a complete Next.js Route Handler that verifies the signature and dispatches on the event type:
app/api/webhook/route.ts
Read the raw request body with
req.text() before calling JSON.parse. The HMAC is computed over the raw bytes, so parsing first will not affect correctness here, but reading the body twice is not possible in the Web Fetch API — always read it once as text, verify, then parse.Security best practices
- Verify the signature before parsing. Compute the HMAC-SHA256 of the raw request body and compare it to the
CoinVoyage-Webhook-Signatureheader before you inspect any payload fields. - Use HTTPS in production. Plain HTTP exposes the request body and signature to interception. CoinVoyage only delivers to HTTPS endpoints in production environments.
- Store your Webhook Secret securely. Keep it in an environment variable (for example,
COIN_VOYAGE_WEBHOOK_SECRET). Never commit it to source code or expose it in client-side bundles. - Respond quickly. Return a
2xxresponse as soon as the signature is verified. Offload any heavy processing to a background job so you don’t risk hitting the 30-second timeout. - Implement proper error handling. Return a non-
2xxstatus only when delivery should be retried. Return200even for unrecognized event types you choose to ignore.