Skip to Content
Docs

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 need a payment method saved for off-session use. See Save a payment method for setup instructions.

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 paymentsSubscriptions
Charge triggerYou call POST /v1/chargesPay.com charges automatically
ScheduleYour systemDefined on the price
Retry logicYou implementYour subscription settings, or the price's
Webhook eventscharge.succeeded, charge.failedsubscription.charged, subscription.unpaid, and others
Use whenYou need full control over timing and amountYou 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 frequencyintervalinterval_count
Weeklyweek1
Monthlymonth1
Quarterlymonth3
Annualyear1
Every 14 daysday14

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:

FieldDescription
retry_after_daysThe 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_actionAction taken after the last retry fails. cancel ends the subscription, pause suspends billing, and leave_unpaid leaves it unpaid.
grace_daysThe 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:

  1. Recurring price created
  2. Subscription created
    • Subscription canceled at period end, You cancel it
  3. 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:

StatusMeaning
draftNot started yet. The subscription waits for its start date, or an external engine is still setting it up.
trialingIn a trial, until trial_end. The customer has access, and nothing is due until the trial ends.
activeBilling normally. Pay.com charges on each scheduled date and advances the current period.
unpaidA renewal failed. Pay.com retries on your failed_payment rules, or you can retry it yourself.
pausedBilling 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.
canceledThe subscription has ended. No further charges are made.
failedThe 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:

MethodRequestWhen it ends
End of periodPOST /v1/subscriptions/{subscription_id}/cancel with an empty bodyAt the end of the current billing period
Specific datePOST /v1/subscriptions/{subscription_id}/cancel with cancel_atOn 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:

ValueCause
requestedYou or the customer canceled it.
endedIt reached its cancel_at date.
withdrawnThe customer withdrew from the contract. See Withdrawal.
payment_failedRetries were used up, with final_action set to cancel.
disputeA 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

Was this page helpful?