Manage ongoing payment relationships with your customers using Flowglad Subscriptions.
active
, trialing
, past_due
, cancellation_scheduled
, unpaid
). This encourages simpler billing management. If you need customers to have multiple simultaneous subscriptions, you can enable the allow_multiple_subscriptions_per_customer
setting at the organization level in your Flowglad settings or by contacting support.billingCycleAnchorDate
(set from the startDate
on creation) determines the day of the month billing occurs. If this date doesn’t exist in a given month (e.g., the 31st in February), billing occurs on the last day of that month.startDate
, interval
(e.g., Month
, Year
), and intervalCount
. Flowglad automatically calculates the currentBillingPeriodStart
and currentBillingPeriodEnd
for each cycle.Subscription
record has one or more SubscriptionItem
records.
Subscription
Record: Holds the core details like the customer (customerId
), overall status, billing cycle information (interval
, intervalCount
, billingCycleAnchorDate
), trial period (trialEnd
), and potentially default/backup payment methods. It also has a primary priceId
which often corresponds to the initial item purchased. But note: the SubscriptionItem
s define the actual billing components.SubscriptionItem
Record: Represents a specific product or service line item within the subscription. Each item has its own priceId
, quantity
, and unitPrice
. This allows for subscriptions with multiple components, potentially added or changed over time. The sum of active subscription items determines the amount billed each period (for non-usage-based items).subscription
or usage
type price.
useBilling()
hook’s createCheckoutSession
method.createSubscriptionWorkflow
).
customerId
, priceId
, startDate
, interval
, and intervalCount
.defaultPaymentMethodId
or backupPaymentMethodId
. This is useful for starting customers on free trials without asking for card details upfront. The subscription status will initially be Incomplete
if autoStart
is false and there’s no trial or payment method. It becomes Trialing
if a trialEnd
date is provided, or Active
if autoStart
is true and a default payment method exists for the customer or is provided.SubscriptionStatus
):
Trialing
: Active during a free trial period. Considered a “current” subscription.Active
: The standard state for a paying, up-to-date subscription. Considered “current”.PastDue
: Payment failed, but Flowglad may retry. Considered “current”.Unpaid
: Payment failed after retries; requires manual intervention or updated payment method. Considered “current”.Incomplete
: Created but needs setup (e.g., payment method added) before becoming active. Not “current”.IncompleteExpired
: A related Checkout Session expired before completion. Not “current”.CancellationScheduled
: Will be canceled at a future date (usually the end of the current billing period). Considered “current” until the cancellation date.Canceled
: The subscription has ended and is no longer active. Not “current”.Active
, PastDue
, Trialing
, CancellationScheduled
, Unpaid
) using helper functions or by checking the status directly.
currentBillingPeriodEnd
, a transition occurs:
BillingRun
is generated.runBillingAtPeriodStart
: This boolean field on the Subscription
determines when the charge for a billing period is attempted.
subscription
Price Type: true
. Charges are typically attempted at the start of the billing period (e.g., paying for the upcoming month).usage
Price Type: false
. Charges are attempted at the end of the billing period after usage for that period has been recorded.currentBillingPeriodEnd
, at which point it transitions to Canceled
. The status becomes CancellationScheduled
until then.cancelSubscriptionImmediately
or scheduleSubscriptionCancellation
).@flowglad/react
or @flowglad/nextjs
) to embed cancellation and other billing management features directly into your application.useBilling()
hook’s cancelSubscription
function (ensure it’s used within a <FlowgladProvider>
context) to build a completely custom cancellation UI.