Subscriptions
Create and manage subscriptions to accept recurring payments. A subscription ties a customer to one or more prices and bills them on a schedule.
The subscription lifecycle
flowchart LR A[incomplete] --> B[trialing] A --> C[active] B --> C C --> D[past_due] D --> C D --> E[canceled] C --> E
Create a subscription
const subscription = await ledgerline.subscriptions.create({ customer: 'cus_Qm8xT2vLp0aZ', items: [{ price: 'price_monthly_pro' }], payment_behavior: 'default_incomplete', trial_period_days: 14, expand: ['latest_invoice.payment_intent'],});Statuses
Status | What it means | What you should do |
|---|---|---|
| In a free trial | Provision access |
| Paid and current | Provision access |
| The latest payment failed | Ask the customer to update their card |
| Ended | Revoke access |
Use the hosted customer portal to let customers change plans, update cards and download invoices without writing any UI.
Updated
Was this page helpful?