Skip to content

Cryptonly sends a webhook to your server on every status change of an invoice, deposit, or withdrawal, not only when it reaches a final status. Each webhook is signed with HMAC-SHA256 so you can verify it came from Cryptonly.

ItemValue
MethodPOST
Content typeapplication/json
Signature headerx-webhook-signature
Signature formatLowercase hex string
EncodingUTF-8 JSON body
RedirectsNot followed

Request headers:

HeaderValue
Content-Typeapplication/json
User-AgentCryptonly-Webhooks/1
x-webhook-idDelivery id (UUID). The same on every attempt of one delivery, including retries and manual resends
x-webhook-timestampUnix time in seconds when this attempt was sent
x-webhook-eventEvent name, the same as event in the body
x-webhook-signatureHMAC-SHA256 of the raw body.

The timestamp field in the body is set when each attempt is sent, so a retry carries a newer timestamp and a different signature than the attempt before it.

Cryptonly sends a signed webhook whenever a resource status changes.

EventWhen Cryptonly sends it
invoice.statusChangedOn invoice create (initial created) and on every subsequent status transition
deposit.statusChangedOn each status transition of a standalone deposit (not on initial create)
withdrawal.statusChangedOn each post-commit status transition; the first webhook typically arrives when the withdrawal moves to processing

Deposit webhooks are not sent when a deposit is linked to an invoice (invoiceId is set). For invoice checkout payments, listen for invoice.statusChanged instead.

Every webhook body has the same envelope: the event name, the signed timestamp (ISO 8601), and data, the resource as the API returns it plus previousStatus. An invoice.statusChanged body looks like this:

{
"event": "invoice.statusChanged",
"timestamp": "2026-01-01T12:00:00.000Z",
"data": {
"id": "8f0c2d4e-1b7a-4c1e-9d3f-2a6b5c7d8e90",
"accountId": "3a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"orderId": "order_1001",
"status": "paid",
"previousStatus": "processing",
"amount": 25,
"fiatCurrencyCode": "USD",
"cryptoCurrencyCode": "USDT_TRC20",
"cryptoAmountExpected": 25.42,
"cryptoAmountReceived": 25.42,
"address": "TXYZ...",
"txHash": "a1b2c3...",
"settlement": {
"amountPaid": 25.42,
"commissionAmount": 0.25,
"netAmount": 24.75,
"completedAt": "2026-01-01T12:00:00.000Z"
},
"paymentPageUrl": "https://...",
"expiresAt": "2026-01-02T11:40:00.000Z",
"createdAt": "2026-01-01T11:40:00.000Z"
}
}

The example is shortened. See the OpenAPI reference for every field of invoice.statusChanged, deposit.statusChanged, and withdrawal.statusChanged.

Each webhook goes to the webhookUrl from the create request (or, for withdrawals, the commit request). Without one, Cryptonly uses the organization default for that resource type, which you set under Settings → Integration. If neither is set, no webhook is sent.

Default webhook URLs card with invoice and withdrawal URLs set and the deposit URL empty.Default webhook URLs card with invoice and withdrawal URLs set and the deposit URL empty.

Each account has its own webhook signing key. The Webhook signing key section on the account’s Security page shows a fingerprint of the current key. Members with the Owner, Admin or Developer role can rotate the key.

Webhook signing key section with the key fingerprint and a Rotate key button.Webhook signing key section with the key fingerprint and a Rotate key button.

How to obtain the key

  1. Open the Cryptonly Merchant Dashboard.
  2. Go to Accounts and select the account.
  3. Open the Settings tab, then Security.
  4. Find the Webhook signing key section.
  5. Click Rotate key.
  6. Confirm the rotation.
  7. Copy the new signing key immediately.
  8. Store it in your server environment variables.
Terminal window
CRYPTONLY_WEBHOOK_SECRET=your_signing_key_here

The x-webhook-signature header is HMAC-SHA256(rawBody, webhookSigningKey) as a lowercase hex string, where rawBody is the exact raw UTF-8 bytes of the request body and webhookSigningKey is the signing key of the account the resource belongs to.

Compute the signature over the body exactly as received. Parsing and re-serializing the JSON first changes the bytes and breaks verification.

Your webhook endpoint should follow this order:

  1. Receive the webhook request.
  2. Read the raw request body.
  3. Read the x-webhook-signature header.
  4. Calculate the expected signature using your webhook signing key.
  5. Compare signatures using a timing-safe comparison.
  6. Reject invalid signatures with 401 Unauthorized.
  7. Parse the JSON body only after signature verification succeeds.
  8. Optionally validate timestamp and deduplicate the event.
  9. Process the webhook.
  10. Return a 2xx response.

If you use the Cryptonly SDK, you can verify invoice, deposit, and withdrawal webhooks with helper functions.

import {
verifyInvoiceWebhook,
verifyWithdrawalWebhook,
verifyDepositWebhook,
} from '@cryptonly/sdk';
import type { Request, Response } from 'express';
export function cryptonlyWebhookHandler(req: Request, res: Response) {
const rawBody = req.body as Buffer;
const signature = req.headers['x-webhook-signature'];
const secret = process.env.CRYPTONLY_WEBHOOK_SECRET;
if (!secret) {
return res.status(500).json({
error: 'webhook secret is not configured',
});
}
const signatureHeader =
typeof signature === 'string' ? signature : undefined;
const invoiceResult = verifyInvoiceWebhook(
rawBody,
signatureHeader,
secret,
);
if (invoiceResult.ok) {
const { event, data, timestamp } = invoiceResult.envelope;
// Handle invoice.statusChanged.
// Optional: validate timestamp.
// Optional: deduplicate event.
return res.status(200).json({ received: true });
}
const withdrawalResult = verifyWithdrawalWebhook(
rawBody,
signatureHeader,
secret,
);
if (withdrawalResult.ok) {
const { event, data, timestamp } = withdrawalResult.envelope;
// Handle withdrawal.statusChanged.
// Optional: validate timestamp.
// Optional: deduplicate event.
return res.status(200).json({ received: true });
}
const depositResult = verifyDepositWebhook(
rawBody,
signatureHeader,
secret,
);
if (depositResult.ok) {
const { event, data, timestamp } = depositResult.envelope;
// Handle deposit.statusChanged.
// Optional: validate timestamp.
// Optional: deduplicate event.
return res.status(200).json({ received: true });
}
return res.status(401).json({
error: 'webhook verification failed',
});
}

Cryptonly expects your server to respond with a successful 2xx status code.

BehaviorDescription
SuccessAny 2xx response is treated as successful
FailureNon-2xx responses, including 3xx redirects, are treated as failed
TimeoutWebhook delivery has a 10-second timeout
Invalid signatureYour server should return 401 Unauthorized
Retry policyCryptonly makes up to 15 delivery attempts in total
Retry delayRetries use exponential backoff starting from 20 seconds
Not retriedAn invalid URL, or a URL that resolves to a private or reserved address

If your endpoint is temporarily unavailable, Cryptonly will retry delivery automatically.

The retry delay grows after each failed attempt. In practice, this means retries are spaced out approximately like this:

RetryApproximate delay after previous failed attempt
1st retry20 seconds
2nd retry40 seconds
3rd retry80 seconds
4th retryabout 2.7 minutes (160 seconds)
5th retryabout 5.3 minutes (320 seconds)
6th retryabout 10.7 minutes (640 seconds)
7th retryabout 21 minutes (1,280 seconds)
8th retryabout 43 minutes (2,560 seconds)
9th retryabout 85 minutes (5,120 seconds)
10th retryabout 2.8 hours (10,240 seconds)
11th retryabout 5.7 hours (20,480 seconds)
12th retryabout 11.4 hours (40,960 seconds)
13th retryabout 22.8 hours (81,920 seconds)
14th retryabout 45.5 hours (163,840 seconds)

With 15 total attempts, that is 1 initial delivery plus up to 14 retries. The last retry happens about 3 days 19 hours after the first attempt. After that the delivery is marked failed, and a member with the Owner, Admin or Developer role can still resend it from the delivery log.

Your handler should avoid long-running processing before responding. If needed, store the event and process it asynchronously.

Every webhook Cryptonly sends is listed in the Cryptonly Merchant Dashboard under Webhooks, Settings → Integration → Webhook delivery log, and View deliveries on a transaction.

Each entry shows the event, resource, endpoint URL, and status (pending, retrying, succeeded shown as Delivered, or failed), plus every attempt’s request and response. Filter by status, event, resource type, or date, and search by x-webhook-id, resource id, or orderId.

Members with the Owner, Admin or Developer role can Resend now a failed or succeeded delivery. The resend uses the recorded URL, the same x-webhook-id and data, the current signing key, and a new timestamp. A delivery that is still retrying cannot be resent until it finishes.

Webhooks page: the deliveries table with filters, delivered, retrying and failed deliveries, attempt counts and last responses.Webhooks page: the deliveries table with filters, delivered, retrying and failed deliveries, attempt counts and last responses.
Webhook delivery drawer: delivery details, the Resend now button, three attempts with a manual retry that returned HTTP 200, and the payload.Webhook delivery drawer: delivery details, the Resend now button, three attempts with a manual retry that returned HTTP 200, and the payload.

See Idempotency.

Before going live, make sure that:

  • your webhook URL uses HTTPS;
  • your server verifies x-webhook-signature;
  • invalid signatures are rejected with 401 Unauthorized;
  • verification uses the raw request body;
  • signature comparison is timing-safe;
  • the webhook signing key is stored securely;
  • replay protection or event deduplication is implemented;
  • webhook processing is idempotent;
  • test webhooks from Settings → Integration → Test webhooks pass. See Testing your integration.