Verify signed payment webhooks

Dedyx delivers signed PAID events to your required HTTPS endpoint. Verify first, then fulfil.

Configure an endpoint

PUT/api/v1/merchant/webhook

Rate limit: 10 requests / 60 seconds (shared webhook settings · per merchant). Shared counters and additional IP limits.

cURL
curl -X PUT https://api.dedyx.com/api/v1/merchant/webhook \
  -H 'X-API-Key: YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://your-company.example/webhooks/dedyx"}'

Use a public HTTPS URL on port 443 without embedded credentials or a fragment. Private networks, loopback, metadata addresses, HTTP and redirects are rejected. No global URL allowlist is required.

Your first response includes a merchant-specific signing_key and key_id. Save the full whsec_... string. Later PUT requests update the URL and retain the existing key.

GET/api/v1/merchant/webhook

Rate limit: 120 requests / 60 seconds (shared reads · per merchant). Shared counters and additional IP limits.

Read the current settings without exposing the signing secret.

Payment event

POST · example payload
{
  "event_id": "evt_example",
  "payment_id": "pay_0123456789abcdef0123456789abcdef",
  "status": "PAID",
  "expected_amount": "49.00",
  "transaction_id": "9f3c7a2e8b104d65c0a9f1726e83b4d5a7610c2f94e8b36d5a07c1e2694f83bd",
  "transaction_event_index": 0,
  "description": "Order #1024"
}

Match the payment to your own order records. Multiple USDT Transfer events may share a transaction ID; transaction_event_index identifies the position in the full receipt log.

Verify the signature

HeaderPurpose
X-Dedyx-TimestampUnix seconds; refreshed for each attempt.
X-Dedyx-Signaturev1= + hex HMAC-SHA256 of timestamp + "." + raw body.
X-Dedyx-Event-IDStable event ID across retries.
X-Dedyx-Key-IDSelects your saved signing key.
Python · signature verification
import hashlib
import hmac
import time

def verify_webhook(raw_body, timestamp, signature, signing_key):
    if not timestamp.isdigit() or len(timestamp) > 12:
        return False
    if abs(int(time.time()) - int(timestamp)) > 300:
        return False
    expected = "v1=" + hmac.new(
        signing_key.encode(),
        timestamp.encode() + b"." + raw_body,
        hashlib.sha256,
    ).hexdigest()
    return hmac.compare_digest(expected, signature)

Verify against the raw request bytes before parsing JSON, using the entire signing key string. Then validate the order, amount, status and matching header/payload event IDs.

Handle retries and duplicates

Only 2xx means delivery succeeded. Requests can repeat if a response is lost. Atomically save event_id with your business action. Return 2xx without repeating fulfilment for an already processed event. Working PostgreSQL example.

Delivery normally retries up to eight times with backoff. Exhausted events remain available for authenticated merchant retry or operator recovery. A failed webhook does not undo the payment. Reconcile through authenticated payment details; Inspect delivery with GET /api/v1/payments/{payment_id}/webhooks and retry an exhausted event with POST /api/v1/merchant/webhook/events/{event_id}/retry. Pending and delivered events cannot be retried. The retry limit is five requests per hour per merchant; each retry is audited and retains its event ID and payload.

Rotate the signing key

POST/api/v1/merchant/webhook/rotate-key

Rate limit: 10 requests / 60 seconds (shared webhook settings · per merchant). Shared counters and additional IP limits.

The new secret is shown once. New delivery attempts immediately use the new key ID. Keep the previous key available for five minutes for requests already in flight. This rotation does not change your API key.

Next: Errors & limits

Delivery diagnostics and retry

Read your payment events with GET /api/v1/payments/{payment_id}/webhooks. The response is a bounded list (up to 100 events) with event_id, payment_id, status, attempts, timestamps and error_category. Status is pending, delivered or failed; pending also includes an in-flight attempt. No callback URL, payload or signing secret is returned. This endpoint shares the merchant read limit.

Use POST /api/v1/merchant/webhook/events/{event_id}/retry with X-API-Key and no body to start a new cycle for an exhausted undelivered event. Pending/delivered returns 409; another merchant’s or missing event returns 404. Five requests per fixed 3600-second window per merchant (starting at the first request), including 404 and 409 responses; 429 includes Retry-After. Attempts reset to zero for the new cycle. Event ID and payload stay unchanged. Delivery uses your current receiver and signing key. Audit and retry are atomic; no new payment or creation quota is used.

A timeout can mean that your receiver processed the event but its response was lost. Deduplicate event_id and fulfillment by order even after a manual retry.

Troubleshoot a webhook integration

Start with authenticated payment details and delivery history. PAID confirms payment; delivered confirms HTTP 2xx, not the issue of your product.

SymptomCheckSafe next action
No webhook after saving the URLRegistration sends no event.Create a separate sandbox order and simulate payment. A test event must never fulfil a live order.
Signature rejectedVerify raw request bytes, timestamp, event ID and key ID before parsing JSON.Use the complete signing key for this environment, check server time and select the key by X-Dedyx-Key-ID. Never disable verification or log secrets.
Failures after key rotationNew attempts use the current key; an older request may still be in flight.Select keys by ID and retain the previous signing key for five minutes. Keep live and sandbox keys separate.
Timeout, network or HTTP errorRead status, attempts and error_category in authenticated delivery history; inspect your own receiver logs for the cause.Check public HTTPS on port 443, DNS and the receiver. A timeout can follow a committed action: deduplicate before processing any retry.
PAID with pending or failed deliverypending includes queued, retrying and in-flight attempts; failed means the delivery cycle was exhausted. The payment remains paid.Let pending delivery finish. Fix failed delivery, then retry the existing event through the authenticated endpoint. Keep the event ID; do not create a replacement payment.
Duplicate event or lost acknowledgementYour business transaction may have committed before the HTTP response was lost.Atomically record event_id with fulfilment and enforce one action per order. Return 2xx for a valid duplicate without issuing again.
Delivered but no product appearedHTTP 2xx proves only that your receiver acknowledged the request.Reconcile authenticated payment details with your order and fulfilment record. Investigate the business transaction; do not ask the customer to pay again.
Manual retry returns 409, 429 or 404Pending/delivered events return 409; 429 includes Retry-After; 404 can mean another merchant or a missing event.Check the merchant/environment and respect Retry-After. Never expose an API key in a browser to solve an access error.

For support, share payment ID, event ID, environment, approximate UTC time and safe error category through the established support channel. Do not send API keys, signing secrets or full customer payloads.

Sandbox quickstart

Before accepting real payments, run the sandbox flow with separate test keys, orders and webhook signing secrets.

Sandbox quickstart