Subscription states
A subscription is always in one of these states:State machine
Lifecycle events
New subscription
When a user subscribes through a checkout link:- Subscription created with
activestatus current_period_endset based on billing periodnext_billing_datescheduled for renewal- Webhook
subscription.createdsent
Successful renewal
When a subscription renews successfully:- Payment processed on
next_billing_date current_period_endextended by billing periodnext_billing_dateupdated- Webhook
subscription.payment_succeededsent
Failed payment
When a renewal payment fails:- Status changes to
past_due - User retains access during grace period
- Stash retries payment automatically
- Webhook
subscription.payment_failedsent
The default grace period is 48 hours with payment retries at 24h and 48h.
During this time, the user keeps access while Stash attempts to recover the
payment. Grace period duration and retry schedule can be configured based on
your needs.
- Status returns to
active - Webhook
subscription.payment_succeededsent
- Status changes to
expired - Webhook
subscription.expiredsent - User loses access
Cancellation
When a user cancels:- Status changes to
canceled cancel_at_period_endset totruecanceled_attimestamp recorded- Webhook
subscription.canceledsent - User keeps access until
current_period_end
- Status changes to
expired - Webhook
subscription.expiredsent
Plan change / upgrade checkout
Players can upgrade a subscription via a subscription change checkout link created with Create a subscription change checkout link (POST /sdk/subscriptions/{subscriptionId}/change-checkout-links). While active, trialing, or canceled but still before current_period_end, they can open that link and complete checkout; creating the link does not by itself reactivate a canceled subscription.
If they complete checkout successfully, Stash applies the change (and reactivates if they were canceled-in-period). If they abandon checkout, subscription state is unchanged.
Reactivation
A canceled subscription can be reactivated before it expires:- Call Reactivate Subscription, or complete a subscription change checkout successfully (upgrade flow).
- Status returns to
active cancel_at_period_endset tofalse- Webhook
subscription.reactivatedsent (when applicable)
Billing period
Theperiod object defines how often the subscription renews:
day, week, month, year
Examples:
- Weekly:
{ "value": 1, "unit": "week" } - Monthly:
{ "value": 1, "unit": "month" } - Quarterly:
{ "value": 3, "unit": "month" } - Yearly:
{ "value": 1, "unit": "year" }