Subscriptions

Create, change, pause, resume and cancel subscriptions from your own code. Each period a subscription issues an invoice its customer pays by card, and its status tells you who has paid.

On this page

The subscription object

A subscription bills one customer again each period: a price, how often it bills and when it starts. It's the same subscription you make under Subscriptions in the dashboard, and it shows up there. For each period it issues an ordinary invoice (in latest_invoice, and in GET /v1/invoices?subscription=sub_…), which Railbed can email to the customer with reminders. The customer pays it by card on the invoice's page.

Railbed stores no card, so nothing is charged automatically: a period counts as paid only when its invoice is paid. A customer who doesn't pay goes past due and, after the days you chose, the subscription ends. The customer's own page, url, shows what they pay, their invoices, and Cancel where you allow it. Subscriptions add no fee of their own. For a walkthrough, see Recurring billing with subscriptions.

FieldTypeDescription
idstringThe subscription's id, sub_…
objectstring"subscription"
livemodebooleanfalse for Test mode, true for Live mode
namestringThe plan's name, or the name you gave it
planobject or nullThe plan it was made from: id (spl_…) and name. null for one made without a plan
statusstringWhere it stands, as the dashboard shows it. See Statuses
stored_statusstringpending, trialing, active, past_due, paused or canceled. Decide access from this. See Who to serve
customerobjectid (cus_…, the saved customer), name, email, company and phone
currencystringUSD, EUR, GBP, CAD, AUD, INR or SEK
linesarrayWhat each period bills: each line's description, quantity, unit_amount and amount
subtotal, discount, tax, amountstringEach period's invoice: the lines added up, the discount, the tax, and the total it asks for
discount_percent, tax_percent, tax_labelstring or nullThe discount's and tax's rates, and the tax's name
mrrstringIts price as a monthly figure, before tax
counts_in_mrrbooleanWhether it counts in your recurring revenue now: it has started, and is active or past due
intervalobjectHow often it bills: unit (day, week, month or year) and count
anchor_datestringThe first paid period's first day, YYYY-MM-DD. Every period is counted from it, in UTC calendar days; a monthly one started on the 31st bills on the last day of shorter months
trial_days, trial_endintegerFree days before the first paid period, and when the trial ends (Unix seconds, or null)
billingobjectHow each invoice is sent and collected. See The billing object
memo, terms, referencestring or nullPrinted on each invoice: your note, your terms, and your own id
current_periodobject or nullThe latest period billed: index (from 0), start and end (the next period's start), in Unix seconds. null before the first invoice
next_invoiceobject or nullThe next invoice: at (when it goes out), period_start and period_end. null when none is scheduled
latest_invoiceobject or nullThe latest invoice: id, number, status, period_index, period_start, period_end, total, amount_due, due_date, issued_at, paid_at and url (the customer's page, where they pay it)
paid_throughinteger or nullThe end of the latest paid period, in Unix seconds: the customer has paid up to here
cycles_paidintegerHow many periods have been paid
total_paidstringPaid toward its invoices so far, tips apart
activated_at, last_paid_atinteger or nullWhen its first paid period began, and when an invoice of it was last paid
cancel_at_period_endbooleanIt's set to end when the time paid for does
ends_atinteger or nullWith cancel_at_period_end: when it ends
canceled_atinteger or nullWhen it ended
cancel_reasonstring or nullrequested (you canceled it), customer (they did), unpaid (an invoice stayed unpaid past the cancel day), expired (its first invoice was never paid) or erased (you deleted the customer's details)
cancel_feedbackstring or nullThe reason a customer chose when they canceled: too_expensive, not_using, missing_features, switched, temporary or other
paused_at, pause_reasoninteger or null, string or nullWhen it was paused (Unix seconds), and why: requested, or billing_failed when its invoices couldn't be issued seven times in a row
billing_problemstring or nullWhy the next invoice couldn't be issued, in words, such as a removed payout wallet. null when billing is fine
urlstringThe customer's subscription page, https://pay.railbed.io/sub/…
sourcestringWhere it was made: dashboard, api, plan_page (a sign-up on a plan's page) or mcp
ownerobject or nullThe person on your team it belongs to: id, name and email
versionintegerGoes up with each update by you or your team, never with billing. Send it back as expected_version. It doesn't order events: use the event's created
created, updatedintegerWhen it was made and last changed, in Unix seconds
warningsarrayOn create and update only, and only when there is something to say: what the card providers' minimums mean for this amount. See Provider minimums
A subscription
{
  "id": "sub_Lq4nX7tR2mVc9KzW5pHd",
  "object": "subscription",
  "livemode": false,
  "name": "Pro",
  "plan": {
    "id": "spl_8Hq2mVx5RtLc3NwZb7Ks",
    "name": "Pro"
  },
  "status": "awaiting_payment",
  "stored_status": "pending",
  "customer": {
    "id": "cus_Rk8mW3pZ6tQv1NxLc4Ys",
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "company": "Analytical Engines Ltd",
    "phone": null
  },
  "currency": "USD",
  "lines": [
    {
      "description": "Pro",
      "quantity": "2",
      "unit_amount": "49.00",
      "amount": "98.00"
    }
  ],
  "subtotal": "98.00",
  "discount": "0.00",
  "discount_percent": null,
  "tax": "0.00",
  "tax_percent": null,
  "tax_label": null,
  "amount": "98.00",
  "mrr": "98.00",
  "counts_in_mrr": false,
  "interval": {
    "unit": "month",
    "count": 1
  },
  "anchor_date": "2026-09-25",
  "trial_days": 0,
  "trial_end": null,
  "billing": {
    "lead_days": 7,
    "terms_days": 3,
    "cancel_after_days": 14,
    "reminders": [
      -3,
      0,
      3,
      7
    ],
    "send_emails": true,
    "email_receipts": true,
    "allow_customer_cancel": true
  },
  "memo": null,
  "terms": "Cancel any time from your subscription page.",
  "reference": "PO-1042",
  "current_period": {
    "index": 0,
    "start": 1790294400,
    "end": 1792886400
  },
  "next_invoice": null,
  "latest_invoice": {
    "id": "in_Tz6pQ3wN8kHr1VbX5mLc",
    "number": "INV-0043",
    "status": "sent",
    "period_index": 0,
    "period_start": 1790294400,
    "period_end": 1792886400,
    "total": "98.00",
    "amount_due": "98.00",
    "due_date": "2026-09-28",
    "issued_at": 1790380525,
    "paid_at": null,
    "url": "https://pay.railbed.io/i/9a3f6c2e7b1d4085c6e2f9a1b7d3c8e4"
  },
  "paid_through": null,
  "cycles_paid": 0,
  "total_paid": "0.00",
  "activated_at": null,
  "last_paid_at": null,
  "cancel_at_period_end": false,
  "ends_at": null,
  "canceled_at": null,
  "cancel_reason": null,
  "cancel_feedback": null,
  "paused_at": null,
  "pause_reason": null,
  "billing_problem": null,
  "url": "https://pay.railbed.io/sub/2d7e9b4a6c1f4e83a0b5d8c2f6e1a9b3",
  "source": "api",
  "owner": null,
  "version": 0,
  "created": 1790380525,
  "updated": 1790380525
}
200 OK

Statuses

status is the label the dashboard shows. stored_status is the state underneath it.

statusstored_statusMeaning
scheduledpendingNothing to pay yet: it starts on a later date
awaiting_paymentpendingIts first invoice is out and unpaid. It hasn't started, so it isn't past due
trialingtrialingIn its free trial
activeactiveThe latest invoice is paid, or isn't due yet
past_duepast_dueAn invoice is unpaid after its due date. It ends on the cancel day unless paid
endingactive, past_due or trialingCanceled at the end of the time paid for. It's still running until ends_at
pausedpausedNo invoices go out until it's resumed. One already out stays payable
canceledcanceledEnded. Start a new subscription to bill the customer again

Who to serve

Serve a customer while stored_status is trialing or active, plus past_due if you give a grace period, or until paid_through (trial_end in a trial). Never treat ending as ended: the customer has paid until ends_at. Key access on the subscription's id, and read it back with Retrieve a subscription when you need to be sure: version only counts edits, so it can't tell you which of two events is newer.

Create a subscription

POST /v1/subscriptions

Makes a subscription in the credential's mode, for one customer. Give a plan, or give its own name, currency, lines and interval. One that starts today issues its first invoice before the response comes back, in latest_invoice: send the customer its url, or let Railbed's email reach them. One with a trial or a later start date issues nothing until its first invoice is due to go out.

ParameterTypeDescription
customerobject Requiredname and email (both required), company, phone and billing_address. Pass id (cus_…) for a saved customer, as on Create an invoice
planstringA plan id, spl_…. The plan decides the name, currency, line and interval, and its trial and settings are copied unless you send your own
quantitystringWith plan: how many (seats, units), from "0.01" to "99999". Default "1"
namestringWithout plan: what the customer sees, up to 80 characters
currencystringWithout plan: USD, EUR, GBP, CAD, AUD, INR or SEK
linesarrayWithout plan: what each period bills, as on Create an invoice
intervalobjectWithout plan: unit and count, every 1–365 days, 1–52 weeks, 1–24 months or 1–3 years
discount, taxobjectAs on an invoice, on each period's invoice
memostringA note on each invoice, up to 800 characters
terms, referencestringPrinted on each invoice
start_datestringThe first paid period's first day, YYYY-MM-DD, from today to 365 days ahead. Default today. Ignored with a trial, which starts today
trial_daysinteger0–365 free days before the first paid period. Overrides the plan's
billingobjectOver the plan's, or the interval's defaults. See The billing object
owner_id, owner_emailstringWho on your team it belongs to: an owner, manager or salesperson, by user id or sign-in email. Not both
routing, collect, success_url, payout_wallet_idAs on Create an invoice, for each period's invoice

A field subscriptions don't have is refused with 400 unknown_field, and the message names the one you probably meant when it's a near miss. The plan's id goes in plan: plan_id is refused.

curl https://pay.railbed.io/v1/subscriptions \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-ada-pro" \
  -d '{
    "plan": "spl_8Hq2mVx5RtLc3NwZb7Ks",
    "quantity": "2",
    "customer": { "name": "Ada Lovelace", "email": "ada@example.com", "company": "Analytical Engines Ltd" },
    "reference": "PO-1042"
  }'
Response
{
  "id": "sub_Lq4nX7tR2mVc9KzW5pHd",
  "object": "subscription",
  "livemode": false,
  "name": "Pro",
  "plan": {
    "id": "spl_8Hq2mVx5RtLc3NwZb7Ks",
    "name": "Pro"
  },
  "status": "awaiting_payment",
  "stored_status": "pending",
  "customer": {
    "id": "cus_Rk8mW3pZ6tQv1NxLc4Ys",
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "company": "Analytical Engines Ltd",
    "phone": null
  },
  "currency": "USD",
  "lines": [
    {
      "description": "Pro",
      "quantity": "2",
      "unit_amount": "49.00",
      "amount": "98.00"
    }
  ],
  "subtotal": "98.00",
  "discount": "0.00",
  "discount_percent": null,
  "tax": "0.00",
  "tax_percent": null,
  "tax_label": null,
  "amount": "98.00",
  "mrr": "98.00",
  "counts_in_mrr": false,
  "interval": {
    "unit": "month",
    "count": 1
  },
  "anchor_date": "2026-09-25",
  "trial_days": 0,
  "trial_end": null,
  "billing": {
    "lead_days": 7,
    "terms_days": 3,
    "cancel_after_days": 14,
    "reminders": [
      -3,
      0,
      3,
      7
    ],
    "send_emails": true,
    "email_receipts": true,
    "allow_customer_cancel": true
  },
  "memo": null,
  "terms": "Cancel any time from your subscription page.",
  "reference": "PO-1042",
  "current_period": {
    "index": 0,
    "start": 1790294400,
    "end": 1792886400
  },
  "next_invoice": null,
  "latest_invoice": {
    "id": "in_Tz6pQ3wN8kHr1VbX5mLc",
    "number": "INV-0043",
    "status": "sent",
    "period_index": 0,
    "period_start": 1790294400,
    "period_end": 1792886400,
    "total": "98.00",
    "amount_due": "98.00",
    "due_date": "2026-09-28",
    "issued_at": 1790380525,
    "paid_at": null,
    "url": "https://pay.railbed.io/i/9a3f6c2e7b1d4085c6e2f9a1b7d3c8e4"
  },
  "paid_through": null,
  "cycles_paid": 0,
  "total_paid": "0.00",
  "activated_at": null,
  "last_paid_at": null,
  "cancel_at_period_end": false,
  "ends_at": null,
  "canceled_at": null,
  "cancel_reason": null,
  "cancel_feedback": null,
  "paused_at": null,
  "pause_reason": null,
  "billing_problem": null,
  "url": "https://pay.railbed.io/sub/2d7e9b4a6c1f4e83a0b5d8c2f6e1a9b3",
  "source": "api",
  "owner": null,
  "version": 0,
  "created": 1790380525,
  "updated": 1790380525
}
201 Created

Retries. Send an Idempotency-Key (1–120 printable ASCII characters) with every create: the same key with the same body (compared as sent, in any field order) answers the subscription it made, with 200, for 24 hours; the same key with a different body is 409 idempotency_conflict.

ErrorCause
400 unknown_fieldA field subscriptions don't have, here or inside interval or billing. field names it
400 invalid_plan, 409 plan_archivedplan isn't one of your plans in this mode, or it's archived
400 customer_requiredThe customer's name or email is missing. field names it
400 missing_name, 400 invalid_interval, 400 invalid_quantityWithout a plan: no name, or an interval outside its bounds; with one, a quantity out of range
400 invalid_start_date, 400 invalid_trialNot a date from today to 365 days ahead, or a trial that isn't 0–365 days
400 invalid_billing, 400 invalid_reminders, 400 invalid_valueA billing value isn't one of its choices or doesn't fit the interval. field names it, such as billing.terms_days
400 invalid_amount, 400 invalid_lines, 400 invalid_owner and the other invoice field errorsAs on Create an invoice
409 idempotency_conflict, 409 idempotency_in_progressThe key was used with a different body, or its first request hasn't finished: retry after Retry-After
409 no_payout_wallet, 409 account_review, 409 payout_wallet_unusableLive mode, and the account (or the chosen wallet) can't take Live payments yet
409 commerce_paused, 403 integration_disabledThe account has paused payments, or payment links or the API are turned off for it

Retrieve a subscription

GET /v1/subscriptions/:id

Returns one of your subscriptions in the credential's mode, brought up to date first: one whose next invoice was due to go out has it. One in the other mode is 404 not_found, and the message says which mode it's in.

cURL
curl https://pay.railbed.io/v1/subscriptions/sub_Lq4nX7tR2mVc9KzW5pHd \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY"

To see every invoice it has issued, use List invoices with subscription=sub_…; each of them carries subscription with its period.

Update a subscription

PATCH /v1/subscriptions/:id

Changes what each period bills, the customer's details, the collection settings and the owner. A change applies from the next invoice issued, never to one already out. Send only the fields you change; customer merges into the details it has. name, customer, lines, discount, tax, memo, terms, reference, billing, owner_id or owner_email, routing, collect, success_url and payout_wallet_id take the values of Create a subscription. Its plan, interval, start date and trial can't change (400 unknown_field): cancel it and start a new one.

ParameterTypeDescription
expected_versionintegerThe version you read. If anyone changed it since, it answers 409 subscription_changed instead of overwriting their change
cURL
curl -X PATCH https://pay.railbed.io/v1/subscriptions/sub_Lq4nX7tR2mVc9KzW5pHd \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "lines": [{ "description": "Pro", "quantity": "3", "unit_amount": "49.00" }],
    "expected_version": 0
  }'

If its next invoice couldn't be issued (billing_problem), an update tries again at once, since the change may be what fixes it. Its subscription.updated event follows.

ErrorCause
409 subscription_changedSomeone changed it since expected_version, or it kept changing while the request ran. Read it again, then retry
409 subscription_canceledIt has ended
400 invalid_expected_versionNot a whole number
409 commerce_pausedThe account has paused payments

The create errors apply to the fields you send.

List subscriptions

GET /v1/subscriptions

Returns your subscriptions in the credential's mode, newest first.

ParameterTypeDescription
limitinteger1–100. Default 20
starting_afterstringA subscription id from the previous page's next_cursor
statusstringOne status; or paying for those that count in your recurring revenue (started, and active or past due); or open for every one not canceled
planstringOnly those on this plan, spl_…
customerstringOnly this customer's, cus_…
ownerstringOnly those this person owns, usr_…, or none for those nobody owns
qstringText in the name, the customer's name, email or company, or the reference, up to 100 characters
cURL
curl "https://pay.railbed.io/v1/subscriptions?status=past_due" \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY"
Response
{
  "data": [
    {
      "id": "sub_Lq4nX7tR2mVc9KzW5pHd",
      "object": "subscription",
      "livemode": false,
      "name": "Pro",
      "plan": {
        "id": "spl_8Hq2mVx5RtLc3NwZb7Ks",
        "name": "Pro"
      },
      "status": "awaiting_payment",
      "stored_status": "pending",
      "customer": {
        "id": "cus_Rk8mW3pZ6tQv1NxLc4Ys",
        "name": "Ada Lovelace",
        "email": "ada@example.com",
        "company": "Analytical Engines Ltd",
        "phone": null
      },
      "currency": "USD",
      "lines": [
        {
          "description": "Pro",
          "quantity": "2",
          "unit_amount": "49.00",
          "amount": "98.00"
        }
      ],
      "subtotal": "98.00",
      "discount": "0.00",
      "discount_percent": null,
      "tax": "0.00",
      "tax_percent": null,
      "tax_label": null,
      "amount": "98.00",
      "mrr": "98.00",
      "counts_in_mrr": false,
      "interval": {
        "unit": "month",
        "count": 1
      },
      "anchor_date": "2026-09-25",
      "trial_days": 0,
      "trial_end": null,
      "billing": {
        "lead_days": 7,
        "terms_days": 3,
        "cancel_after_days": 14,
        "reminders": [
          -3,
          0,
          3,
          7
        ],
        "send_emails": true,
        "email_receipts": true,
        "allow_customer_cancel": true
      },
      "memo": null,
      "terms": "Cancel any time from your subscription page.",
      "reference": "PO-1042",
      "current_period": {
        "index": 0,
        "start": 1790294400,
        "end": 1792886400
      },
      "next_invoice": null,
      "latest_invoice": {
        "id": "in_Tz6pQ3wN8kHr1VbX5mLc",
        "number": "INV-0043",
        "status": "sent",
        "period_index": 0,
        "period_start": 1790294400,
        "period_end": 1792886400,
        "total": "98.00",
        "amount_due": "98.00",
        "due_date": "2026-09-28",
        "issued_at": 1790380525,
        "paid_at": null,
        "url": "https://pay.railbed.io/i/9a3f6c2e7b1d4085c6e2f9a1b7d3c8e4"
      },
      "paid_through": null,
      "cycles_paid": 0,
      "total_paid": "0.00",
      "activated_at": null,
      "last_paid_at": null,
      "cancel_at_period_end": false,
      "ends_at": null,
      "canceled_at": null,
      "cancel_reason": null,
      "cancel_feedback": null,
      "paused_at": null,
      "pause_reason": null,
      "billing_problem": null,
      "url": "https://pay.railbed.io/sub/2d7e9b4a6c1f4e83a0b5d8c2f6e1a9b3",
      "source": "api",
      "owner": null,
      "version": 0,
      "created": 1790380525,
      "updated": 1790380525
    }
  ],
  "has_more": false,
  "next_cursor": null
}
200 OK

Cancel a subscription

POST /v1/subscriptions/:id/cancel

Ends it. By default it ends when the time paid for does: it reads ending, carries on until ends_at, and can be kept until then. With nothing paid yet, or while paused, it ends now. An invoice already out for a later period stays payable but sends no more reminders, and the customer doesn't have to pay it: unpaid, it's voided when the subscription ends; paid, the subscription runs to the end of that period.

ParameterTypeDescription
whenstringperiod_end (the default) or now
keep_open_invoicebooleanWith when: "now": leave its unpaid invoice open, because the customer still owes it. Default false, which voids it
commentstringWhy, for its history in the dashboard, up to 500 characters. Never shown to the customer
cURL
curl -X POST https://pay.railbed.io/v1/subscriptions/sub_Lq4nX7tR2mVc9KzW5pHd/cancel \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "when": "now" }'
Response
{
  "id": "sub_Lq4nX7tR2mVc9KzW5pHd",
  "object": "subscription",
  "livemode": false,
  "name": "Pro",
  "plan": {
    "id": "spl_8Hq2mVx5RtLc3NwZb7Ks",
    "name": "Pro"
  },
  "status": "canceled",
  "stored_status": "canceled",
  "customer": {
    "id": "cus_Rk8mW3pZ6tQv1NxLc4Ys",
    "name": "Ada Lovelace",
    "email": "ada@example.com",
    "company": "Analytical Engines Ltd",
    "phone": null
  },
  "currency": "USD",
  "lines": [
    {
      "description": "Pro",
      "quantity": "2",
      "unit_amount": "49.00",
      "amount": "98.00"
    }
  ],
  "subtotal": "98.00",
  "discount": "0.00",
  "discount_percent": null,
  "tax": "0.00",
  "tax_percent": null,
  "tax_label": null,
  "amount": "98.00",
  "mrr": "98.00",
  "counts_in_mrr": false,
  "interval": {
    "unit": "month",
    "count": 1
  },
  "anchor_date": "2026-09-25",
  "trial_days": 0,
  "trial_end": null,
  "billing": {
    "lead_days": 7,
    "terms_days": 3,
    "cancel_after_days": 14,
    "reminders": [
      -3,
      0,
      3,
      7
    ],
    "send_emails": true,
    "email_receipts": true,
    "allow_customer_cancel": true
  },
  "memo": null,
  "terms": "Cancel any time from your subscription page.",
  "reference": "PO-1042",
  "current_period": {
    "index": 0,
    "start": 1790294400,
    "end": 1792886400
  },
  "next_invoice": null,
  "latest_invoice": {
    "id": "in_Tz6pQ3wN8kHr1VbX5mLc",
    "number": "INV-0043",
    "status": "void",
    "period_index": 0,
    "period_start": 1790294400,
    "period_end": 1792886400,
    "total": "98.00",
    "amount_due": "98.00",
    "due_date": "2026-09-28",
    "issued_at": 1790380525,
    "paid_at": null,
    "url": "https://pay.railbed.io/i/9a3f6c2e7b1d4085c6e2f9a1b7d3c8e4"
  },
  "paid_through": null,
  "cycles_paid": 0,
  "total_paid": "0.00",
  "activated_at": null,
  "last_paid_at": null,
  "cancel_at_period_end": false,
  "ends_at": null,
  "canceled_at": 1790384125,
  "cancel_reason": "requested",
  "cancel_feedback": null,
  "paused_at": null,
  "pause_reason": null,
  "billing_problem": null,
  "url": "https://pay.railbed.io/sub/2d7e9b4a6c1f4e83a0b5d8c2f6e1a9b3",
  "source": "api",
  "owner": null,
  "version": 0,
  "created": 1790380525,
  "updated": 1790384125
}
200 OK

The body is optional. Canceling works even while the account has paused payments, since it stops invoices rather than asking for money. An end at the period's end sends subscription.updated; an end now sends subscription.canceled, and invoice.voided for an invoice it voids.

ErrorCause
409 subscription_canceledIt has already ended
400 invalid_when, 400 invalid_keep_open_invoicewhen isn't now or period_end, or keep_open_invoice isn't true or false or came without when: "now"
400 invalid_comment, 400 too_longcomment isn't text, or is over 500 characters

Keep a subscription

POST /v1/subscriptions/:id/keep

Takes back a cancel at the end of the paid time, whoever made it: the subscription carries on, its next invoice goes out on its day, and an invoice already out reminds again. No body is needed. One with no end set comes back as it is. It sends subscription.updated.

cURL
curl -X POST https://pay.railbed.io/v1/subscriptions/sub_Lq4nX7tR2mVc9KzW5pHd/keep \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY"

A canceled subscription can't be kept (409 subscription_canceled). While the account has paused payments, keeping is refused with 409 commerce_paused.

Pause a subscription

POST /v1/subscriptions/:id/pause

Stops issuing invoices until it's resumed. An invoice already out stays payable, and a cancel scheduled for the end of the paid time still ends it on that day. No body is needed, and one already paused comes back as it is. Pausing works even while the account has paused payments. It sends subscription.paused.

cURL
curl -X POST https://pay.railbed.io/v1/subscriptions/sub_Lq4nX7tR2mVc9KzW5pHd/pause \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY"

Railbed also pauses a subscription itself when its invoices couldn't be issued seven times in a row (pause_reason: "billing_failed"): fix what billing_problem says, then resume it.

Resume a subscription

POST /v1/subscriptions/:id/resume

Starts billing again. By default billing starts with the next period and the rest of the current one is free. Periods that passed entirely while paused are skipped, never billed. An unpaid invoice that went overdue while paused gets a new due date: the resume day plus the subscription's payment terms. It sends subscription.resumed.

ParameterTypeDescription
bill_nowbooleanBill the period under way now, in full. Default false
cURL
curl -X POST https://pay.railbed.io/v1/subscriptions/sub_Lq4nX7tR2mVc9KzW5pHd/resume \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "bill_now": true }'
ErrorCause
409 not_pausedIt isn't paused
409 subscription_canceledIt has ended
400 invalid_bill_nowNot true or false
409 commerce_pausedThe account has paused payments

Advance a Test subscription

POST /v1/subscriptions/:id/advance

Test mode only: issues the next period's invoice now, so you can try a renewal without waiting. It's the dashboard's Renew now. No body is needed. Pay the invoice from its page and subscription.renewed arrives. See Try it in Test mode.

cURL
curl -X POST https://pay.railbed.io/v1/subscriptions/sub_Lq4nX7tR2mVc9KzW5pHd/advance \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY"
ErrorCause
409 live_subscriptionIt's a Live subscription: its invoices go out on their dates
409 invoice_openIts latest invoice is still unpaid. Pay it first
409 subscription_pausedIt's paused. Resume it first
409 nothing_to_issue, 409 not_billableIt's set to end before the next period, or can't issue invoices in its state
409 subscription_canceledIt has ended

Retrieve subscription metrics

GET /v1/subscription_metrics

Returns recurring revenue in the key's mode, per currency, as Subscriptions → Revenue shows it: MRR and ARR, the period's movements (new, reactivation, expansion, contraction, churn, paused, resumed), churn and net retention, trials, how invoices were collected, a series and monthly cohorts. Figures are never added across currencies. They come from each subscription's own history, so editing an invoice doesn't change them.

ParameterTypeDescription
periodstringThe window the movements, rates, series and cohorts cover: 30d (default), 90d or 12m
cURL
curl "https://pay.railbed.io/v1/subscription_metrics?period=90d" \
  -H "Authorization: Bearer $RAILBED_SECRET_KEY"
Response
{
  "object": "subscription_metrics",
  "livemode": false,
  "period": "30d",
  "as_of": 1790380525,
  "subscriptions": 14,
  "plans": 2,
  "currencies": [
    {
      "currency": "USD",
      "mrr": "637.00",
      "arr": "7644.00",
      "mrr_start": "539.00",
      "mrr_change": {
        "amount": "98.00",
        "percent": 18.2
      },
      "subscribers": {
        "paying": 12,
        "active": 11,
        "past_due": 1,
        "trialing": 1,
        "paused": 0,
        "pending": 1
      },
      "paying_start": 10,
      "movements": {
        "new": {
          "count": 3,
          "mrr": "147.00"
        },
        "reactivation": {
          "count": 0,
          "mrr": "0.00"
        },
        "expansion": {
          "count": 1,
          "mrr": "49.00"
        },
        "contraction": {
          "count": 0,
          "mrr": "0.00"
        },
        "churn": {
          "count": 1,
          "mrr": "98.00"
        },
        "paused": {
          "count": 0,
          "mrr": "0.00"
        },
        "resumed": {
          "count": 0,
          "mrr": "0.00"
        }
      },
      "net_new_mrr": "98.00",
      "subscriber_churn": 0.1,
      "revenue_churn": 0.182,
      "net_retention": 0.909,
      "arpu": "53.08",
      "ltv": "530.83",
      "trials": {
        "started": 2,
        "ended": 1,
        "converted": 1,
        "rate": 1
      },
      "collection": {
        "due": 12,
        "paid_on_time": 10,
        "paid_late": 1,
        "unpaid": 1,
        "voided": 0,
        "rate": 0.917,
        "on_time_rate": 0.833,
        "median_days_to_pay": 2,
        "collected": "588.00"
      },
      "past_due": {
        "count": 1,
        "amount": "49.00"
      },
      "upcoming": {
        "count": 4,
        "amount": "196.00"
      },
      "series": [
        {
          "at": 1787788800,
          "mrr": "539.00",
          "paying": 10
        },
        {
          "at": 1789084800,
          "mrr": "588.00",
          "paying": 11
        },
        {
          "at": 1790380525,
          "mrr": "637.00",
          "paying": 12
        }
      ],
      "cohorts": [
        {
          "month": "2026-08",
          "size": 4,
          "retained": [
            4,
            3
          ]
        },
        {
          "month": "2026-09",
          "size": 3,
          "retained": [
            3
          ]
        }
      ]
    }
  ]
}
200 OK

Rates are fractions (0.25 is 25%) and null when there's nothing to divide by; mrr_change.percent alone is a percentage. A pause is never churn. ltv stays null until the year has enough cancellations to say. A period's invoice counts toward collection once it comes due.

Webhooks

Choose the subscription events for an endpoint, in Developers or with events on Create a webhook endpoint: subscription.created, subscription.activated, subscription.invoice_issued, subscription.renewed, subscription.past_due, subscription.paused, subscription.resumed, subscription.updated and subscription.canceled. They go only to endpoints that name them, so a receiver written before subscriptions never sees one. Each carries the subscription as data.subscription, in this page's shape. Each period's invoice also sends the invoice events to endpoints that chose them, and each payment toward it its payment.* events. Order events by the event's created, or read the subscription back. See Subscription events.

Access

Retrieving, listing and reading the metrics need the payments:read scope, which Read only keys have. Creating, changing, canceling, keeping, pausing, resuming and advancing need checkouts:write, which Full access keys and agents with full access have. A change made with a key is recorded on the subscription's history as the key's, under its name, never as a person's.

Updated · This page as Markdown