Subscriptions
Tie a customer to a package version, choose how and when they pay, and change, pause or end it.
A subscription ties a customer to a version of a package and says when they start paying and how. A customer has at most one overlapping subscription.
Create one
POST /v1/subscriptions makes a subscription.
customer_external_idstringrequiredThe customer.
plan_codestringrequiredThe package.
plan_versioninteger0 or left out is the latest.
start_timestringWhen it starts.
trial_daysintegerOverrides the trial of the package version.
intervalstringSUBSCRIPTION_INTERVAL_MONTH or SUBSCRIPTION_INTERVAL_YEAR.
currencystringThe currency to bill in.
quantityintegerSeats, 1 to 100 000.
coupon_codestringA coupon to redeem.
States
state is one of:
| State | Meaning |
|---|---|
SUBSCRIPTION_STATE_TRIALING | in the trial; no fixed fee until it ends (trial_end_time) |
SUBSCRIPTION_STATE_ACTIVE | running |
SUBSCRIPTION_STATE_PAST_DUE | a payment failed; the subscription is still billed (Failed payments and retries) |
SUBSCRIPTION_STATE_PAUSED | the fixed fee is stopped until it is resumed; usage is still billed |
SUBSCRIPTION_STATE_CANCELLED | ended (end_time) |
cancel_at_period_end is true while an end at the close of the current period is waiting.
The webhook events for every step are in Webhooks: subscription.created, subscription.changed, subscription.paused, subscription.cancelled, subscription.trial_will_end and more.
What is billed, and when
SUBSCRIPTION_INTERVAL_MONTH or SUBSCRIPTION_INTERVAL_YEAR. A new subscription renews on the day it started (its anniversary), not on the first of the month.
fee_timing | Fixed fee |
|---|---|
FEE_TIMING_ADVANCE (the default) | invoiced at the start of each period as its own invoice |
FEE_TIMING_ARREARS (monthly only) | on the invoice with the month's usage |
Usage is billed in arrears: one invoice for each calendar month, also for a yearly subscription, so usage is never held for a year.
quantity (1 to 100 000) multiplies the fixed fee; usage prices are not multiplied. Only for a subscription Payrudder runs and bills in advance.
owner is payrudder or provider. A provider that renews subscriptions itself (Paddle) bills the fee; Payrudder mirrors what the provider does, and some of the calls below are refused for it. provider names the payment provider that sells it (the account's default when left out).
Change one
| Call | Effect |
|---|---|
POST /v1/subscriptions/{id}/change-preview | what a change would cost, with the same calculation as the change, so the preview is what is then billed |
POST /v1/subscriptions/{id}/change | move to another package version and/or interval, or change the seats |
POST /v1/subscriptions/{id}/change-plan | the simpler call: move to another version now, prorating the fixed fee |
DELETE /v1/subscriptions/{id}/scheduled-change | withdraw a change that is waiting for the end of the period |
POST /v1/subscriptions/{id}/pause | stop the fixed fee |
POST /v1/subscriptions/{id}/resume | start the fixed fee again |
POST /v1/subscriptions/{id}/end-trial | end a running trial now: the subscription is active, its first fee is due now and the package's normal limits apply at once (subscription.updated) |
POST /v1/subscriptions/{id}/cancel-at-period-end | end at the close of the period |
DELETE /v1/subscriptions/{id}/cancel-at-period-end | take that back |
DELETE /v1/subscriptions/{id} | end now, or at an end_time; with credit_unused=true the fee paid in advance for the rest of the period goes to the customer's credit balance |
POST /v1/subscriptions/{id}/coupon | redeem a coupon on a subscription that has none |
DELETE /v1/subscriptions/{id}/coupon | take the coupon off (the redemption is not given back) |
When a change takes effect
| Change | Takes effect |
|---|---|
| An upgrade, or monthly to yearly | immediately, prorated |
| A downgrade, or yearly to monthly | at the end of the period the customer has paid for; shows on the subscription as a scheduled change |
quantity alone, more seats or fewer | immediately, prorated |
Whatever moves money is invoiced, or becomes a credit balance when the new price is lower than the unused old time was worth (Credits and balances). A change during a trial moves no money.
An immediate change ends the subscription and starts its successor in one step; the new one's changed_from_id names the old one.
change answers 409 ABORTED if the fee of the current period has not been invoiced yet: try again in a moment.
Which version a subscription is on, and how to move many at once, is in Packages and plans.
In the console this is Subscriptions: the list, a sheet for each, and the change dialog with the live preview.