BillingConcepts
Subscription
The Subscription entity in Billing.
A Subscription is a recurring charge agreement between a customer and the merchant. It binds a customer (identity_id) and a payment instrument to one or more priced items, and the billing engine generates invoices on each cycle and attempts collection automatically.
Lifecycle
incomplete— created without a usable instrument or before initial payment confirmation. Resolves toactiveonce payment succeeds, or toincomplete_expiredif it lapses.trialing— created withtrial_period_daysortrial_end. No invoices are generated until the trial ends. Emitssubscription.trial_will_endahead of expiry.active— invoices are generated at eachcurrent_period_endand charged againstinstrument_id. Emitssubscription.createdthensubscription.updatedon item, quantity, or status changes.past_due/unpaid— payment failed. Dunning takes over (see Dunning config). Terminal action is governed bysubscription_terminal_action.paused— payment collection suspended viapauseSubscription. Emitssubscription.paused;subscription.resumedon resume.canceled— terminated bycancelSubscription(immediate) orcancel_at_period_end: true(deferred). Emitssubscription.deletedonceended_atis set.
Relationships
A subscription belongs to a Customer (identity_id) and references a payment instrument (instrument_id). Each SubscriptionItem points at a Price which belongs to a Product. Generated Invoices are linked back via latest_invoice_id. Discounts attach via SubscriptionDiscount and reference a coupon or promotion code.
Fields that matter
status(SubscriptionStatus) — drives billing behavior; one ofincomplete,incomplete_expired,trialing,active,past_due,unpaid,canceled,paused.items(SubscriptionItem[]) — the priced lines that produce invoice line items each cycle. Mutate withaddSubscriptionItem/updateSubscriptionItem/removeSubscriptionItem.current_period_start/current_period_end(ISO datetime) — bounds of the current billing window. Next invoice is generated atcurrent_period_end.cancel_at_period_end(boolean) — whentrue, the subscription continues untilcurrent_period_end, then transitions tocanceled.pause_collection({ behavior, resumes_at } | null) — populated while paused;behaviorcontrols how draft invoices during the pause are handled.pending_update(SubscriptionPendingUpdate | null) — staged item changes awaiting trial-end or next renewal.