Skip to Content
Payrudder

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_idstringrequired

The customer.

plan_codestringrequired

The package.

plan_versioninteger

0 or left out is the latest.

start_timestring

When it starts.

trial_daysinteger

Overrides the trial of the package version.

intervalstring

SUBSCRIPTION_INTERVAL_MONTH or SUBSCRIPTION_INTERVAL_YEAR.

currencystring

The currency to bill in.

quantityinteger

Seats, 1 to 100 000.

coupon_codestring

A coupon to redeem.

States

state is one of:

StateMeaning
SUBSCRIPTION_STATE_TRIALINGin the trial; no fixed fee until it ends (trial_end_time)
SUBSCRIPTION_STATE_ACTIVErunning
SUBSCRIPTION_STATE_PAST_DUEa payment failed; the subscription is still billed (Failed payments and retries)
SUBSCRIPTION_STATE_PAUSEDthe fixed fee is stopped until it is resumed; usage is still billed
SUBSCRIPTION_STATE_CANCELLEDended (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

Change one

CallEffect
POST /v1/subscriptions/{id}/change-previewwhat a change would cost, with the same calculation as the change, so the preview is what is then billed
POST /v1/subscriptions/{id}/changemove to another package version and/or interval, or change the seats
POST /v1/subscriptions/{id}/change-planthe simpler call: move to another version now, prorating the fixed fee
DELETE /v1/subscriptions/{id}/scheduled-changewithdraw a change that is waiting for the end of the period
POST /v1/subscriptions/{id}/pausestop the fixed fee
POST /v1/subscriptions/{id}/resumestart the fixed fee again
POST /v1/subscriptions/{id}/end-trialend 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-endend at the close of the period
DELETE /v1/subscriptions/{id}/cancel-at-period-endtake 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}/couponredeem a coupon on a subscription that has none
DELETE /v1/subscriptions/{id}/coupontake the coupon off (the redemption is not given back)

When a change takes effect

ChangeTakes effect
An upgrade, or monthly to yearlyimmediately, prorated
A downgrade, or yearly to monthlyat the end of the period the customer has paid for; shows on the subscription as a scheduled change
quantity alone, more seats or fewerimmediately, 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.

Next steps