How subscriptions work
Automate recurring billing with recurring prices, saved payment methods, and rules for failed renewals and disputes.
A subscription charges a customer's saved payment method on a schedule. On Pay.com's engine, Pay.com runs the whole billing cycle. It charges on time, retries failed payments, and tracks each change of state. This page covers how Pay.com's engine bills a subscription. For how subscriptions fit into Commerce, with external engines, entitlements, and the customer portal, see Subscriptions.
A subscription bills one or more recurring prices from your catalog. Each price defines how much to charge and how often, and the subscription links a customer and their payment method to the prices it bills. Your subscription settings define what happens when a renewal fails or a payment is disputed.
Subscriptions vs. recurring payments
Both models use saved payment methods to charge customers without them being present. The difference is in who manages the schedule.
| Recurring payments | Subscriptions | |
|---|---|---|
| Charge trigger | You call POST /v1/charges | Pay.com charges automatically |
| Schedule | Your system | Defined on the price |
| Retry logic | You implement | Your subscription settings, or the price's |
| Webhook events | charge.succeeded, charge.failed | subscription.charged, subscription.unpaid, and others |
| Use when | You need full control over timing and amount | You want Pay.com to manage the billing lifecycle |
Recurring prices
A recurring price is a reusable billing term. You create it once, for a product, and use it for any number of subscriptions. A change to its amount adds a version of the price, and live subscriptions keep the version they were sold at until you schedule a price change for them. See Products and prices.
Billing schedule and amount
A price's schedule sets how often it bills, with interval and
interval_count.
| Billing frequency | interval | interval_count |
|---|---|---|
| Weekly | week | 1 |
| Monthly | month | 1 |
| Quarterly | month | 3 |
| Annual | year | 1 |
| Every 14 days | day | 14 |
Each period, the subscription charges each price's unit_amount times the
item's quantity. Amounts are in the smallest currency unit, so 1999 is
$19.99 USD.
Failed renewals
When a renewal fails, the subscription moves to unpaid and Pay.com starts
retrying. The failed_payment rules in your
subscription settings
control the retries and what follows them:
| Field | Description |
|---|---|
retry_after_days | The days after the failed renewal for each retry, up to 8, for example [3, 5, 7]. Pay.com also retries soon after the customer updates their card. |
final_action | Action taken after the last retry fails. cancel ends the subscription, pause suspends billing, and leave_unpaid leaves it unpaid. |
grace_days | The days the customer keeps access while the subscription is unpaid. |
These rules retry three times and then cancel the subscription, with a week of access while it's unpaid:
{
"failed_payment": {
"retry_after_days": [3, 5, 7],
"final_action": "cancel",
"grace_days": 7
}
}A price can override the rules for the subscriptions on it, in its own
subscription_options.failed_payment. Only Pay.com's engine applies them,
because Pay.com never retries a charge another system retries.
Disputes
When one of a subscription's payments is disputed, Pay.com applies the
disputes rule in your subscription settings. Its action is cancel,
pause, or none. A price can override it in its own
subscription_options.disputes.
Trials
Set trial in subscription_options when you create the subscription, with
interval and interval_count, for example
{ "interval": "day", "interval_count": 14 }, or with end_at. The
subscription starts as trialing, with the trial's end in trial_end, and
nothing is due until the trial ends. See
Trials, plan changes, and canceling.
Subscription term
To end a subscription on a set date, send cancel_at in
subscription_options when you create it. When that date comes, the
subscription moves to canceled with cancellation_reason set to ended.
Leave cancel_at unset for a subscription that runs until it's canceled.
Billing lifecycle
A subscription moves from setup through billing cycles, failure handling, and cancellation:
- Recurring price created
- Subscription created
- Subscription canceled at period end, You cancel it
- Billing date reached
- Subscription charged, cycle repeats, Charge succeeded
- Subscription unpaid, Charge failed
- Subscription active, cycle resumes, Retry succeeded
- Subscription canceled, Retries used up,
final_action: "cancel" - Subscription paused, Retries used up,
final_action: "pause"
Subscription statuses
A subscription moves through these statuses as billing events occur:
| Status | Meaning |
|---|---|
draft | Not started yet. The subscription waits for its start date, or an external engine is still setting it up. |
trialing | In a trial, until trial_end. The customer has access, and nothing is due until the trial ends. |
active | Billing normally. Pay.com charges on each scheduled date and advances the current period. |
unpaid | A renewal failed. Pay.com retries on your failed_payment rules, or you can retry it yourself. |
paused | Billing is suspended after retries are used up with final_action set to pause, after a dispute with disputes.action set to pause, or after a trial ends without a payment method when trial.missing_payment_method is pause. |
canceled | The subscription has ended. No further charges are made. |
failed | The first payment was declined. Pay.com sends subscription.failed. |
Subscription events
Pay.com sends an event each time a subscription changes, such as
subscription.charged for a paid renewal and subscription.unpaid for a
failed one. See Commerce events
for every subscription event.
Cancellation
A subscription doesn't end the moment you cancel it. You choose when the cancellation takes effect:
| Method | Request | When it ends |
|---|---|---|
| End of period | POST /v1/subscriptions/{subscription_id}/cancel with an empty body | At the end of the current billing period |
| Specific date | POST /v1/subscriptions/{subscription_id}/cancel with cancel_at | On the date you specify, after the current period ends |
cancel_at accepts an ISO 8601 datetime string (for example,
2026-12-31T00:00:00Z). The customer keeps access until the subscription
ends. Customers can also cancel in the
customer portal, at the end of the period.
canceled_at is set and subscription.canceled fires when the cancellation
takes effect, not when you make the cancellation request. Scheduling a future
cancellation doesn't fire a webhook until that date is reached.
The cancellation_reason field records why the subscription ended:
| Value | Cause |
|---|---|
requested | You or the customer canceled it. |
ended | It reached its cancel_at date. |
withdrawn | The customer withdrew from the contract. See Withdrawal. |
payment_failed | Retries were used up, with final_action set to cancel. |
dispute | A dispute canceled it, with the disputes action set to cancel. |
Refunds and disputes
Renewals don't create orders, so you refund a renewal through its invoice.
See Refunds go through what billed them.
A dispute on a subscription payment also applies your
disputes rule.
Next steps
- Create a subscription: create a recurring price and attach a customer's saved payment method.
- Manage subscriptions: list subscriptions, handle failed charges, update payment methods, and cancel.
- Choose a subscription engine: run subscriptions on Pay.com's engine or an external one.