{"object":"doc","slug":"subscriptions","title":"Subscriptions and invoices","summary":"How a subscription and its invoices behave: statuses, when the period moves, holds while a charge is being confirmed, plan changes, cancels, refunds, the customer portal, and what runs only on test clocks in this release.","tags":["concept","billing","subscriptions","invoices"],"body":"# Subscriptions and invoices\n\nA subscription (`sub_...`) charges one customer's saved card for one recurring price, billed every 1 month or every 1 year. Every charge is a payment (`pay_...`) on an invoice (`in_...`). Amounts are integer cents (2900 = $29.00) and times are Unix seconds. The objects use Stripe's field names; [Billing webhooks](billing-webhooks.md) lists where they differ.\n\n## Test mode only in this release\n\nBilling runs in test mode. A subscription's first charge happens when it is created, but the scheduler that renews subscriptions on real time is not switched on yet. Renewals, retries, reminders (`invoice.upcoming`) and period ends run when you advance a [test clock](test-billing-with-test-clocks.md). A live merchant is refused with `billing_unavailable`. Do not promise your users live billing until ZeroPoint switches it on for your platform; [going-live](going-live.md) says what that will take.\n\n## Two ways to start one\n\n- Hosted checkout with `mode: subscription`: the buyer types a card on ZeroPoint's page, the card is saved and charged, and `checkout.session.completed` names the subscription. Start here: [Sell a subscription in five calls](build-subscriptions.md).\n- `POST /v1/subscriptions` (MCP `create_subscription`) when your customer already has a saved card (`pm_...`), for example a plan change from a free tier.\n\n## Statuses\n\n| Status | Meaning | Access |\n|---|---|---|\n| `incomplete` | The first payment was declined (or is still being confirmed). The customer can pay `latest_invoice` with another card within 23 hours. A declined hosted checkout also leaves one, with no event: it becomes `active` when a later card on that session is captured, or `incomplete_expired` when the session expires | No |\n| `incomplete_expired` | The first payment never succeeded. Final | No |\n| `active` | Paid for the current period | Yes |\n| `past_due` | A renewal was declined; retries are scheduled. The last declined retry takes the final action at once | Your choice: a grace period, or a banner asking for a new card |\n| `unpaid` | Retries are over and the merchant's final action is `unpaid`; the invoice stays payable until its period ends | No |\n| `canceled` | Ended. Final | No |\n\nGate access on `status`, never on `current_period_end`. The period moves forward only in the change that proves a renewal was captured, so a declined renewal shows `past_due` with the period that has ended. Code that compares `current_period_end` with now cuts a customer off at the first decline, and grants nothing during a hold.\n\n## Holds: a charge whose outcome is unknown\n\nA charge has three outcomes: captured, declined, or unknown (a timeout, or a processor answer that cannot be confirmed). Unknown is never treated as declined. While a charge is unknown:\n\n- the subscription keeps its status and `payment_hold` is set (`{invoice, since}`);\n- the invoice stays `open` with `collection_status: reconciling`;\n- no `invoice.payment_failed`, no status change and no cancel;\n- paying or voiding the invoice answers `409 invoice_reconciling` with `Retry-After: 300`; a plan change answers `409 renewal_due` with `Retry-After: 120`. While the charge is still in flight, before the hold, pay and void answer `409 invoice_payment_in_progress` with `Retry-After: 30`.\n\nA `customer.subscription.updated` whose only change is `payment_hold` means \"a charge is being confirmed\": do nothing. When the outcome is proven, the hold clears and the usual events follow (`invoice.paid`, or `invoice.payment_failed`).\n\n## Retrying a create or a change\n\nA create, a plan change and an invoice payment take a key (the `Idempotency-Key` header, or `request_key` on the MCP tools). A retry with the same key and the same body returns the first answer and never charges twice, also after a 502 or a lost answer. Never retry a create with a new key: a new key is a new subscription. If you lost the answer, retry with the same key, or list the customer's subscriptions.\n\n## Plan changes and cancels\n\n- Upgrade (same interval, dearer price) or monthly to annual: charged now, the prorated difference in integer cents. The plan changes only after that payment is proven captured. A difference below the minimum charge (50 cents by default) applies the plan now and is added to the next renewal.\n- Downgrade, lateral change, annual to monthly: scheduled for `current_period_end` (`scheduled_change`); nothing is charged or credited now.\n- `cancel_at_period_end: true`: active until the period ends, then canceled. While `past_due`, `unpaid` or `incomplete` it cancels at once.\n- `DELETE /v1/subscriptions/{subscription_id}`: cancels now. Nothing is refunded.\n\nDetails and examples: [Upgrades, downgrades and cancel](upgrades-downgrades-and-cancel.md).\n\n## Refunds and voids do not end a subscription\n\nA refund or a void of a subscription payment uses the payment routes (`POST /v1/payments/{payment_id}/void` before settlement, `POST /v1/payments/{payment_id}/refund` after it). It never cancels or changes the subscription by itself: the invoice stays `paid` with `amount_paid` unchanged and no refund mark, and the portal's history still reads Paid. The reversal shows only on the payment (`amount_refunded_cents`, its refunds and its receipt) and in `refund.succeeded`. If service should end, cancel the subscription yourself. An upgrade later credits only money still held.\n\n## Promotion codes on renewals\n\nA subscription has at most one discount. A `once` coupon applies to the first invoice only; `repeating` for its number of months from the start; `forever` always. The window is fixed when the subscription starts and never restarts. Known revenue leak, the same as Stripe: a customer inside a repeating window who switches monthly to annual gets the discount on the whole year's invoice. If that matters, end the discount before you offer the switch.\n\n`discounts` on the subscription (`coupon`, `promotion_code`, `start`, `end`) keeps listing a `repeating` discount after its window has ended: `end` is then a time in the past, and the renewal, the preview and the portal charge the full price. Compare `discounts[].end` with now before you show a discount as active.\n\n## The customer portal\n\n`POST /v1/billing_portal/sessions` (MCP `create_portal_session`) returns a one-time `url` to a hosted page where your customer sees their plan and next charge, cancels at period end (and undoes it), updates their card and pays an open invoice. Redirect your signed-in user to it at once: it works once and expires 5 minutes after it was created. Never email it, store it or show it; create a new session per click.\n\n## ZeroPoint sends no email to your customers\n\nRenewal reminders, receipts and failed-payment notices are yours to send. Send them from the [billing events](billing-events.md): `invoice.upcoming` (3 days before a renewal by default), `invoice.paid`, `invoice.payment_failed` (read its `billing_reason`: only `subscription_cycle` is a failed renewal), `customer.subscription.deleted`.\n\n## `object_version`\n\nBilling events carry `data.object_version`, which rises with each change of the object. Use it only to decide whether to overwrite your stored copy (overwrite when the event's version is greater than or equal to yours). Never use it to skip a handler: one change can send two events at the same version.\n\n## Not available yet\n\nTrials, quantities above 1, several items per subscription, metered or tiered prices, `billing_cycle_anchor`, pausing collection, subscription schedules, tax, and previewing a brand-new subscription before it is created. Previewing a plan change works: `POST /v1/invoices/create_preview` with `subscription` and `subscription_details` (MCP `preview_invoice`; [Upgrades, downgrades and cancel](upgrades-downgrades-and-cancel.md)).\n\nNext: [Sell a subscription in five calls](build-subscriptions.md).","updated":1795275945}