Skip to content

Subscription

A Subscription is a Customer’s standing acceptance of an Offer, billed each Period until canceled.

A Subscription is a Customer’s standing acceptance of a recurring Offer, renewed and billed each period until canceled.

Properties

PropertyTypeRequiredDescription
statusstringrequiredOne of active, trialing, pastDue, paused, incomplete, or canceled.
renewsAtdatetimeWhen it next renews.
quantityintegerHow many units of the Offer’s Price it holds, such as 12 members; 1 by default.
trialEndsAtdatetimeWhen a trial ends and the first paid period starts.
termEndsAtdatetimeWhen a committed term ends; the Renewal and the renewal notice read it.

Object

JSON
{
  "$id": "https://api.sb/routewise.dev/subscriptions/subscription_1",
  "$type": "Subscription",
  "status": "active",
  "renewsAt": "2026-10-22T12:00:00Z",
  "quantity": 1,
  "trialEndsAt": "2026-10-22T12:00:00Z",
  "termEndsAt": "2026-10-22T12:00:00Z"
}

Relationships

Lifecycle

Subscription lifecycle: incomplete, trialing, active, pastDue, paused, canceled (ends)incomplete → trialing: Offer.trialincomplete → active: on Invoice.collectedincomplete → canceled: Subscription.unsubscribetrialing → active: Subscription.renewtrialing → canceled: Subscription.unsubscribeactive → paused: Subscription.pauseactive → pastDue: on Invoice.overdueactive → canceled: Subscription.unsubscribepastDue → active: on Invoice.collectedpastDue → canceled: on Invoice.overduepaused → active: Subscription.resumepaused → canceled: Subscription.unsubscribeincompletetrialingactivepastDuepausedcanceled
StateMeaningMoves to
incomplete (first)The Subscription exists and its first period is billed but not yet paid.trialing by Offer.trial; active on Invoice.collected when the Invoice bills this Subscription’s first period; canceled by Subscription.unsubscribe
trialingThe Customer uses the Offer free until trialEndsAt.active by Subscription.renew; canceled by Subscription.unsubscribe
activeThe Subscription renews each period and its Entitlements hold.paused by Subscription.pause; pastDue on Invoice.overdue when the Invoice bills this Subscription; canceled by Subscription.unsubscribe
pastDueA renewal Invoice is unpaid while its retries run; Entitlements still hold.active on Invoice.collected when the Invoice bills this Subscription; canceled on Invoice.overdue when every retry on the Startup’s retry schedule has failed
pausedBilling and Entitlements stop until the pause ends, and the term moves by the paused days.active by Subscription.resume; canceled by Subscription.unsubscribe
canceledThe Subscription has ended; the Customer starts again with a new one.None: it ends here.

Verbs

  1. createCreates a Subscription.
    POST /{namespace}/subscriptionsdoSubscription.created
  2. getReturns one Subscription by id.
    GET /{namespace}/subscriptions/{id}readNo Event
  3. listReturns Subscriptions, newest first, one page at a time.
    GET /{namespace}/subscriptionsreadNo Event
  4. updateChanges the given properties of a Subscription.
    PATCH /{namespace}/subscriptions/{id}doSubscription.updated
  5. keepKeep takes back a cancel before the period closes, so the Subscription renews on its date at the same terms.
    POST /{namespace}/subscriptions/{subscription}/keepdoSubscription.kept
  6. pausePause stops billing and Entitlements on a Subscription until a date, without ending it.
    POST /{namespace}/subscriptions/{subscription}/pausedoSubscription.paused
  7. renewRenew starts a Subscription’s next period and bills it at the Offer Version the Customer accepted.
    POST /{namespace}/subscriptions/{subscription}/renewdoSubscription.renewed
  8. resizeResize changes how many units a Subscription holds and prorates the current period.
    POST /{namespace}/subscriptions/{subscription}/resizedoSubscription.resized
  9. resumeResume restarts billing and Entitlements on a paused Subscription before its pause ends.
    POST /{namespace}/subscriptions/{subscription}/resumedoSubscription.resumed
  10. switchSwitch moves a Subscription to another Offer and prorates the current period.
    POST /{namespace}/subscriptions/{subscription}/switchdoSubscription.switched
  11. unsubscribeUnsubscribe ends a Subscription at the close of its current period, and the Customer keeps access until then.
    POST /{namespace}/subscriptions/{subscription}/unsubscribedoSubscription.unsubscribed

Events

Events no Verb emits. Each Verb’s Event is in the Verbs table above; every Event is delivered in the same shape.

Subscription.pastDue

A Subscription moved to pastDue because its renewal Invoice went overdue. Raised by a state change.

FieldTypeRequiredDescription
namestringrequiredSubscription.pastDue.
atdatetimerequiredWhen it happened.
seqintegerIts position in the namespace, one more than the Event before; any seq is a cursor into the history.
datajsonrequiredThe Thing as the Action left it.
data.subscriptionSubscriptionrequiredThe Subscription as the change left it.
data.subscription.statusstringrequiredOne of active, trialing, pastDue, paused, incomplete, or canceled.
data.subscription.renewsAtdatetimeWhen it next renews.
data.subscription.quantityintegerHow many units of the Offer’s Price it holds, such as 12 members; 1 by default.
data.subscription.trialEndsAtdatetimeWhen a trial ends and the first paid period starts.
data.subscription.termEndsAtdatetimeWhen a committed term ends; the Renewal and the renewal notice read it.
data.invoiceInvoicerequiredThe overdue renewal Invoice.
data.previous.statusstringrequiredThe status before this Event: active.
JSON
{
  "$id": "https://api.sb/routewise.dev/events/event_1",
  "$type": "Event",
  "name": "Subscription.pastDue",
  "at": "2026-10-22T12:00:00Z",
  "data": {
    "subscription": {
      "$id": "https://api.sb/routewise.dev/subscriptions/subscription_1",
      "$type": "Subscription",
      "status": "pastDue",
      "renewsAt": "2026-10-22T12:00:00Z",
      "quantity": 1,
      "trialEndsAt": "2026-10-22T12:00:00Z",
      "termEndsAt": "2026-10-22T12:00:00Z"
    },
    "invoice": {
      "$id": "https://api.sb/routewise.dev/invoices/invoice_1",
      "$type": "Invoice",
      "total": {
        "amount": 25,
        "currency": "USD"
      },
      "due": "2026-10-22"
    },
    "previous": {
      "status": "active"
    }
  },
  "seq": 1
}

Permissions

Which Access level may call each Verb. One-way Verbs wait their delay window.

Operationowneradminmemberviewer
Subscription.createYesYesYesNo
Subscription.getYesYesYesYes
Subscription.listYesYesYesYes
Subscription.updateYesYesYesNo
Subscription.keepYesYesYesNo
Subscription.pauseYesYesYesNo
Subscription.renewYesYesYesNo
Subscription.resizeYesYesYesNo
Subscription.resumeYesYesYesNo
Subscription.switchYesYesYesNo
Subscription.unsubscribeYesYesYesNo

Stripe

Subscription (subscription). The source of truth is db.sb, and Stripe holds a copy written from it.

PropertyStripe fieldSource of truth
statusstatusStripe
renewsAtitems.data[].current_period_endStripe
quantityitems.data[].quantitydb.sb
trialEndsAttrial_enddb.sb
StateStripe status
incompleteincomplete
trialingtrialing
activeactive
pastDuepast_due
pausedpaused
canceledcanceled

Call it

Text
Renew the latest subscription.

Example

A dental office's Subscription to the $99 monthly reminders Offer renews on the 1st and bills one Invoice each month until the office unsubscribes.