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

Features

Subscriptions Available in test mode

Everything a recurring plan needs, through one resource: start it from checkout or a saved card, change the plan or the seats with a preview of the cost first, and cancel or take it back.

What it does

Per seat or flat

A per-seat plan is a price per seat bought with quantity; several items (up to 20 prices) on one subscription.

Preview, then change

The upcoming invoice shows the prorations and total before a change; pass its proration_date to charge exactly what the customer saw. create_prorations, none or always_invoice.

Trials

trial_period_days or trial_end, and end a trial now to charge the first period.

Cancel and undo

cancel_at_period_end keeps access until the period ends and can be taken back; DELETE cancels at once.

Failed payments

Stripe retries on its schedule; GET /v1/dunning lists past_due and unpaid subscriptions with their failed invoices, and you can try the card again now.

A nod past the limits

A subscription charged to a saved card, or a plan rise, past your standing limit waits for a person's approval. Checkout needs none: the customer pays themselves.

In code

Preview a move to four seats, then make it

TypeScript

// ducat(): the small fetch helper from the quickstart (/docs/quickstart)
const preview = await ducat("GET",
  `/v1/subscriptions/${subId}/upcoming-invoice?price=${priceId}&quantity=4`);
// show preview.total to the customer, then:
await ducat("PATCH", `/v1/subscriptions/${subId}`, {
  price: priceId,
  quantity: 4,
  proration_date: preview.proration_date,
});

Python

# ducat(): the small helper from the quickstart (/docs/quickstart)
preview = ducat("GET",
    f"/v1/subscriptions/{sub_id}/upcoming-invoice?price={price_id}&quantity=4")
# show preview["total"] to the customer, then:
ducat("PATCH", f"/v1/subscriptions/{sub_id}", {
    "price": price_id,
    "quantity": 4,
    "proration_date": preview["proration_date"],
})

curl

curl -s "https://api.ducatpay.dev/v1/subscriptions/sub_…/upcoming-invoice?price=price_…&quantity=4" \
  -H "authorization: Bearer $DUCAT_TOKEN"

curl -s -X PATCH https://api.ducatpay.dev/v1/subscriptions/sub_… \
  -H "authorization: Bearer $DUCAT_TOKEN" \
  -H "content-type: application/json" \
  -d '{"price": "price_…", "quantity": 4, "proration_date": 1800000000}'
Subscriptions endpoints
EndpointWhat
POST /v1/subscriptionson a saved card; trial_period_days, trial_end, promotion_code
GET | DELETE /v1/subscriptions/{id}read it; cancel now
PATCH /v1/subscriptions/{id}price, quantity, proration_behavior, or cancel_at_period_end alone
GET /v1/subscriptions/{id}/upcoming-invoicethe preview: prorations, total, proration_date
POST /v1/subscriptions/{id}/end-trialcharge the first period now
GET /v1/customers/{id}/subscriptionsnewest first, every status
GET /v1/dunning, POST /v1/invoices/{id}/payfailing subscriptions; pay an invoice now

Good to know

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

Related: Customer portal, Invoices, SaaS 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.