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

Features

Usage billing Beta

Charge for what customers use: report usage against a meter, put a per-unit price on it, and Stripe Billing Meters total it on the invoice. Each report counts once, even when your job retries.

What it does

Meters

sum of the values, count of the events, or the last value; deactivate a meter when a plan retires.

Metered prices

A per-unit price on a meter, monthly or on another interval; subscribe a customer to it like any price.

Once per identifier

Each report carries an identifier, or an Idempotency-Key: a retry never bills twice, even past Stripe's own 24 hours.

Usage so far

A customer's aggregated usage over any range, for a usage page in your product.

In code

Report a day of API calls for one customer

TypeScript

// ducat(): the small fetch helper from the quickstart (/docs/quickstart)
await ducat("POST", `/v1/meters/${meterId}/events`, {
  customer: customerId,
  value: callsToday,
  identifier: `acme-${day}`, // the same day reported twice counts once
});

Python

# ducat(): the small helper from the quickstart (/docs/quickstart)
ducat("POST", f"/v1/meters/{meter_id}/events", {
    "customer": customer_id,
    "value": calls_today,
    "identifier": f"acme-{day}",  # the same day reported twice counts once
})

curl

curl -s https://api.ducatpay.dev/v1/meters/mtr_…/events \
  -H "authorization: Bearer $DUCAT_TOKEN" \
  -H "content-type: application/json" \
  -d '{"customer": "cus_…", "value": 6200, "identifier": "acme-2026-12-05"}'
Usage billing endpoints
EndpointWhat
POST /v1/meters{name, display_name, aggregation: sum | count | last}
POST /v1/meters/{id}/pricesa metered price
POST /v1/meters/{id}/events{customer, value, identifier, timestamp}
GET /v1/meters/{id}/usage?customer&start&endthe total over a range
POST /v1/meters/{id}/deactivatetake no more events

Good to know

Beta Built and tested against a simulated Stripe; not yet run on Stripe's test mode.

Related: Subscriptions, SaaS subscriptions, Agents guide, story 4c

More features

Start building in test mode

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