Test modeDucat runs on Stripe's test mode for now, so no real card is charged.

Features

Webhooks Available in test mode

Stripe's events reach Ducat signed, are recorded once and filed under the team that owns them. Ducat then pushes each one to your endpoint, signed with your own secret, or you poll them with a cursor. Both carry the same events.

What it does

Signed

Ducat-Signature uses Stripe's scheme: the hex HMAC-SHA256 of the timestamp and the raw body, keyed with your whsec_ secret. Check it in a few lines (the selling guide has the code).

In order, one at a time

Oldest first; the next waits until the one before is delivered. Answer 2xx to events you don't need.

At least once

Your place is kept in Ducat's store, so a restart carries on. Apply events idempotently: read the subscription back rather than trusting the payload.

Retries that back off

30 seconds, then 1, 2, 4 minutes and on, doubling up to a day. Nothing is dropped while your endpoint is down.

Health you can read

GET /v1/webhook-endpoint says ok, retrying or failing, the last error and the next attempt. Never the secret.

Public addresses only

Ducat refuses endpoints that are, or resolve to, loopback, private or link-local addresses, when set and at every delivery.

In code

Set your endpoint, then check a delivery's signature

TypeScript

// Ducat-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>
async function verify(secret: string, header: string, body: string) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.trim().split("=")));
  const t = Number(parts.t);
  if (!Number.isInteger(t) || Math.abs(Date.now() / 1000 - t) > 300) return false;
  const key = await crypto.subtle.importKey("raw", new TextEncoder().encode(secret),
    { name: "HMAC", hash: "SHA-256" }, false, ["verify"]);
  const mac = Uint8Array.from(parts.v1?.match(/../g) ?? [], (h) => parseInt(h, 16));
  return crypto.subtle.verify("HMAC", key, mac, new TextEncoder().encode(`${t}.${body}`));
}

Python

# Ducat-Signature: t=<unix>,v1=<hex HMAC-SHA256(secret, "<t>.<raw body>")>
import hashlib, hmac, time

def verify(secret: str, header: str, body: bytes) -> bool:
    parts = dict(p.strip().split("=", 1) for p in header.split(",") if "=" in p)
    try:
        t = int(parts.get("t", ""))
    except ValueError:
        return False
    if abs(time.time() - t) > 300:
        return False
    mac = hmac.new(secret.encode(), f"{t}.".encode() + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(mac, parts.get("v1", ""))

curl

curl -s -X PUT https://api.ducatpay.dev/v1/webhook-endpoint \
  -H "authorization: Bearer $DUCAT_TOKEN" \
  -H "content-type: application/json" \
  -d '{"url": "https://your.app/hooks/ducat"}'
# → {"url": "…", "created": 1800000000, "secret": "whsec_…"}  (shown once)
Webhooks endpoints
EndpointWhat
PUT /v1/webhook-endpoint{url}: answers the secret once; a second PUT rolls it
GET /v1/webhook-endpointstatus, failures, last_error, next_attempt, last_delivered
DELETE /v1/webhook-endpointstop pushes
GET /v1/events?after&limitthe same events, oldest first, with a cursor

Good to know

Available in test mode Works today on Stripe's test mode.

Related: Security: signatures, Selling guide, section 9, Subscriptions

More features

Start building in test mode

Sign up, make a key, and take a test payment in a few minutes. No card needed.