Integration
Notifications and fulfillment
Verify events, deduplicate work, and recover delivery after an outage.
Before the connection check
Create a public HTTPS POST endpoint on your own server. Read the raw request body and verify the signature with your webhook secret. For integration.check, return 200 after verification; do not create or fulfill an order. Save this endpoint in Integration settings, then send the check.
Configure webhook URL ↗Verify the raw body
Notifications include x-checkout-timestamp and x-checkout-signature headers. The signature is hex HMAC-SHA256 over timestamp + "." + rawBody. The SDK rejects timestamps outside a five-minute window. Verify before JSON parsing or business processing. Do not stringify a parsed object to reconstruct the body.
import { verifyWebhook } from '@whitechain-checkout/server';
const valid = verifyWebhook(
process.env.CHECKOUT_WEBHOOK_SECRET,
timestampHeader,
rawBody,
signatureHeader,
);
if (!valid) {
// Respond with 401 before processing the event.
}Event fields
Both payment.confirmed and refund.confirmed contain these fields. The separate integration.check event contains id, type, merchantId and createdAt; verify its signature and return 2xx without fulfilling an order. amount is the amount for this event, not the cumulative refund total.
- id
- Stable event ID; use a unique constraint to deduplicate.
- type
- payment.confirmed or refund.confirmed.
- checkoutId
- Internal checkout UUID for fulfillment calls.
- orderId
- Your original order reference.
- amount
- Token base units as a string.
- transactionHash / chainId
- Settlement reference and network.
Persist, fulfill, acknowledge
Deliveries are at least once. Persist event handling and business fulfillment with durable uniqueness constraints. Respond with 2xx after durable acceptance. Call checkout.fulfill(event.checkoutId) after completing the order. If acknowledgement fails after business fulfillment, retry the acknowledgement without repeating the business operation.
Read the durable booking implementation ↗Retries and recovery
Failed HTTP deliveries are retried with the same event ID and a fresh timestamp/signature. A 2xx response stops automatic retries. Inspect GET /v1/merchant/deliveries or the workspace, then use POST /v1/merchant/deliveries/:id/retry to replay an event. Manual replay can duplicate a previously accepted event, so your receiver must remain idempotent.