Subscriptions automate recurring billing by linking customers to plans. Define billing cycles, trial periods, and pricing once—PayNext handles charges, renewals, and failed payment recovery automatically.Documentation Index
Fetch the complete documentation index at: https://docs.paynext.com/llms.txt
Use this file to discover all available pages before exploring further.
Before creating subscriptions, set up a recurring plan in your Dashboard. See Plans to learn how to configure billing cycles, trial periods, and pricing.
The Subscription Lifecycle
When a customer completes checkout with a recurring plan, PayNext creates a subscription and manages it through these stages:Subscription Statuses
| Status | Description | Your Action |
|---|---|---|
trial | In trial period, no charge yet | Provision access |
active | Billing successful, good standing | Maintain access |
past_due | Renewal failed, retrying for 30 days | Keep access, notify customer |
scheduled_for_cancellation | Cancellation queued for cycle end | Maintain access until cycle ends |
cancelled | Permanently ended (terminal) | Revoke access |
Create a Subscription
Include a recurringplan.id in your client session. When checkout completes, PayNext creates the subscription automatically.
subscription.created webhook and schedules future renewals based on the plan’s billing cycle.
Manage Subscriptions
Change Plans
Upgrade or downgrade active subscriptions:- Dashboard — Select subscription → Change Plan
- SDK/API — See Change Subscription Plan
Cancel
You can cancel subscriptions immediately or schedule cancellation for the end of the billing cycle.Schedule cancellation (recommended)
Customer keeps access until the current billing cycle ends, then transitions tocancelled.
- Dashboard — Select subscription → Cancel → At end of billing cycle
- API —
POST /subscriptions/schedule-cancel/{id}
scheduled_for_cancellation and automatically transitions to cancelled when the cycle ends.
Cancel immediately
Ends the subscription now. Customer loses access immediately.- Dashboard — Select subscription → Cancel → Immediately
- API —
POST /subscriptions/cancel/{id}
Reactivate
If a customer changes their mind before the billing cycle ends (scheduled_for_cancellation):
For
past_due or cancelled subscriptions, you must collect payment first. See Recover Subscriptions.Handle Failed Payments
When a renewal payment fails, PayNext automatically retries up to 8 times. During this period, the subscription remainspast_due.
Automatic retry
PayNext attempts recovery automatically. Track progress via thesubscription.updated webhook:
| Field | Description |
|---|---|
attempt_count | Number of recovery attempts made so far |
max_attempts_count | Maximum attempts before subscription cancels |
Billing date on recovery
When recovery succeeds, the next billing date shifts to the recovery date plus one billing interval—not from the original renewal date. Example: A 28-day subscription was due to renew on Dec 1, but the payment failed. Recovery succeeds on Dec 5. The next billing date is Jan 2 (Dec 5 + 28 days), not Dec 29 (Dec 1 + 28 days).Recovery exhausted
If all 8 retry attempts fail, the subscription automatically transitions tocancelled.
Webhook Events
Listen for these events to keep your system in sync:| Event | When it fires |
|---|---|
subscription.created | New subscription created |
subscription.updated | Status changed, plan changed, or recovery attempt made |
subscription.cancelled | Subscription ended (recovery exhausted or cancelled) |