Subscriptions or one-off
mode subscription for recurring prices, mode payment for one-time prices; up to 20 line items, each with a quantity (per seat or flat).
Test modeDucat runs on Stripe's test mode for now, so no real card is charged.
Features
A checkout session opens Stripe's hosted, mobile-ready payment page for your prices. Ducat makes the session for your team, tells you when it's paid, and keeps every session your own.
mode subscription for recurring prices, mode payment for one-time prices; up to 20 line items, each with a quantity (per seat or flat).
Ducat passes on Stripe's payment_status: paid, unpaid or no_payment_required. A bank debit that's complete but still clearing reads unpaid, so you never switch a plan on early.
A code your customer typed applies at checkout. Only codes made for your team, or for everyone, work.
Expire an open session so its page can't be paid any more. A completed one answers 409.
An Idempotency-Key on any POST goes to Stripe scoped to your team, so a retry never makes or charges twice.
metadata on the session is copied onto the subscription it makes, so your own ids reach every later event.
TypeScript
// ducat(): the small fetch helper from the quickstart (/docs/quickstart)
const session = await ducat("POST", "/v1/checkout-sessions", {
customer: customerId,
mode: "subscription",
line_items: [{ price: priceId, quantity: 3 }],
success_url: "https://your.app/billing?session={CHECKOUT_SESSION_ID}",
cancel_url: "https://your.app/pricing",
metadata: { team: "org_acme" },
}, "checkout:org_acme:1");
return Response.redirect(session.url, 303); // Stripe's pagePython
# ducat(): the small helper from the quickstart (/docs/quickstart)
session = ducat("POST", "/v1/checkout-sessions", {
"customer": customer_id,
"mode": "subscription",
"line_items": [{"price": price_id, "quantity": 3}],
"success_url": "https://your.app/billing?session={CHECKOUT_SESSION_ID}",
"cancel_url": "https://your.app/pricing",
"metadata": {"team": "org_acme"},
}, idempotency_key="checkout:org_acme:1")
return redirect(session["url"], code=303) # Stripe's pagecurl
curl -s https://api.ducatpay.dev/v1/checkout-sessions \
-H "authorization: Bearer $DUCAT_TOKEN" \
-H "content-type: application/json" \
-H "idempotency-key: checkout:org_acme:1" \
-d '{"customer": "cus_…", "mode": "subscription",
"line_items": [{"price": "price_…", "quantity": 3}],
"success_url": "https://your.app/billing?session={CHECKOUT_SESSION_ID}",
"cancel_url": "https://your.app/pricing",
"metadata": {"team": "org_acme"}}'| Endpoint | What |
|---|---|
POST /v1/checkout-sessions | customer, mode, line_items, success_url, cancel_url, metadata, promotion_code |
GET /v1/checkout-sessions/{id} | status, payment_status, subscription |
POST /v1/checkout-sessions/{id}/expire | close an open session's page |
POST /v1/prices | a fixed price, monthly, yearly or once |
POST /v1/payment-links | a reusable link to a price; list, read, deactivate |
Available in test mode Works today on Stripe's test mode.
Related: Subscriptions, Webhooks, Selling guide, section 3
Sign up, make a key, and take a test payment in a few minutes. No card needed.