Subscriptions let you sell ongoing access with automated renewals. Use flexible billing cycles, free trials, plan changes, and add‑ons to tailor pricing for each customer.
Upgrade & Downgrade
Control plan changes with proration and quantity updates.
On‑Demand Subscriptions
Authorize a mandate now and charge later with custom amounts.
Customer Portal
Let customers manage plans, billing, and cancellations.
Subscription Webhooks
React to lifecycle events like created, renewed, and canceled.
What Are Subscriptions?
Subscriptions are recurring products customers purchase on a schedule. They’re ideal for:- SaaS licenses: Apps, APIs, or platform access
- Memberships: Communities, programs, or clubs
- Digital content: Courses, media, or premium content
- Support plans: SLAs, success packages, or maintenance
Key Benefits
- Predictable revenue: Recurring billing with automated renewals
- Flexible cycles: Monthly, annual, custom intervals, and trials
- Plan agility: Proration for upgrades and downgrades
- Add‑ons and seats: Attach optional, quantifiable upgrades
- Seamless checkout: Hosted checkout and customer portal
- Developer-first: Clear APIs for creation, changes, and usage tracking
Creating Subscriptions
Create subscription products in your Dodo Payments dashboard, then sell them through checkout or your API. Separating products from active subscriptions lets you version pricing, attach add‑ons, and track performance independently.Subscription product creation
Configure the fields in the dashboard to define how your subscription sells, renews, and bills. The sections below map directly to what you see in the creation form.Product details
- Product Name (required): The display name shown in checkout, customer portal, and invoices.
- Product Description (required): A clear value statement that appears in checkout and invoices.
- Product Image (required): PNG/JPG/WebP up to 3 MB. Used on checkout and invoices.
- Brand: Associate the product with a specific brand for theming and emails.
- Tax Category (required): Choose the category (for example, SaaS) to determine tax rules.
Pricing
- Pricing Type: Choose Subscription (this guide). Alternatives are Single Payment and Usage Based Billing.
- Price (required): Base recurring price with currency.
- Discount Applicable (%): Optional percentage discount applied to the base price; reflected in checkout and invoices.
- Repeat payment every (required): Interval for renewals, e.g., every 1 Month. Select the cadence (months or years) and quantity.
- Subscription Period (required): Total term for which the subscription remains active (e.g., 10 Years). After this period ends, renewals stop unless extended.
- Trial Period Days (required): Set trial length in days. Use 0 to disable trials. The first charge occurs automatically when the trial ends.
- Select add‑on: Attach up to 10 add‑ons that customers can purchase alongside the base plan.
Add‑ons are ideal for quantifiable extras such as seats or storage. You can control allowed quantities and proration behavior when customers change them.
Advanced settings
- Tax Inclusive Pricing: Display prices inclusive of applicable taxes. Final tax calculation still varies by customer location.
- Generate license keys: Issue a unique key to each customer after purchase. See the License Keys guide.
- Digital Product Delivery: Deliver files or content automatically after purchase. Learn more in Digital Product Delivery.
- Metadata: Attach custom key–value pairs for internal tagging or client integrations. See Metadata.
Subscription Trials
Trials let customers access subscriptions without immediate payment. The first charge occurs automatically when the trial ends.Configuring Trials
Set Trial Period Days in the product pricing section (use0 to disable). You can override this when creating subscriptions:
Detecting Trial Status
To determine if a subscription is in trial, retrieve the list of payments for the subscription. If there is exactly one payment with amount 0, the subscription is in trial period:Updating Trial Period
Extend the trial by updatingnext_billing_date:
Subscription Plan Changes
Plan changes let you upgrade or downgrade subscriptions, adjust quantities, or migrate to different products. Depending on the proration mode you select, a change may trigger an immediate charge, create credit, or apply no billing adjustment.Product Collections
Group related products into collections to enable seamless upgrade/downgrade paths in the Customer Portal.
Proration Modes
Choose how customers are billed when changing plans:Quick comparison of the four proration modes:
prorated_immediately | difference_immediately | full_immediately | do_not_bill | |
|---|---|---|---|---|
| 升级 | 剩余天数的按比例收费 | 收取价格差额的全额 | 收取全新计划的全额 | 无需收费 — 立即切换 |
| 降级 | 剩余天数的按比例信用 | 全额价格差作为信用 | 无信用,全额收费 | 无信用 — 立即切换 |
| 计费周期 | 重置为今天 | 重置为今天 | 重置为今天 | 保持不变 |
| 最佳用途 | 公平的基于时间的计费 | 简单的阶梯更改 | 计费周期重置 | 免费迁移或礼节性切换 |
prorated_immediately
Charges prorated amount based on remaining time in the current billing cycle. Best for fair billing that accounts for unused time.
difference_immediately
Charges the price difference immediately (upgrade) or adds credit for future renewals (downgrade). Best for simple upgrade/downgrade scenarios.
Credits from downgrades using
difference_immediately are subscription-scoped and auto-applied to future renewals. They’re distinct from Credit-Based Billing entitlements.difference_immediately, the unused value becomes a subscription-scoped credit that automatically offsets future renewals:
full_immediately
Charges full new plan amount immediately, ignoring remaining time. Best for resetting billing cycles.
do_not_bill
Switches to the new plan without any billing adjustment. No proration charges, no credits — the customer simply moves to the new plan. Best for courtesy migrations, free plan switches, or scenarios where you want to absorb the cost difference.
Example: Prorated upgrade calculation
Example: Prorated upgrade calculation
Scenario: Customer on Basic (80/month) on day 16 of a 30-day cycle using 下一次续订日期为2月15日(1月16日 + 30天):$80.00/月。
prorated_immediately.Example: Downgrade credit calculation
Example: Downgrade credit calculation
Scenario: Customer on Pro (20/month) using The $60 credit auto-applies to future renewals:
difference_immediately.- Renewal 1: 20 (credit) = **40 credit remaining)
- Renewal 2: 20 (credit) = **20 credit remaining)
- Renewal 3: 20 (credit) = $0.00 (credit exhausted)
- Renewal 4: $20.00 (full price)
Learn more about how credits are managed in the Upgrade & Downgrade Guide.
Changing Plans with Add-ons
Modify add-ons when changing plans. Add-ons are included in proration calculations:Plan changes trigger immediate charges. Failed charges may move the subscription to
on_hold status. Track changes via subscription.plan_changed webhook events.Previewing Plan Changes
Before committing to a plan change, preview the exact charge and resulting subscription:Preview Change Plan API
Preview plan changes before committing to them.
Subscription States
订阅在其生命周期中会经历一组定义的状态。本表提供每个状态的参考,其原因,以及您可以如何(或是否)恢复它。状态机
暂停状态
订阅进入on_hold 状态时:
- 续订付款失败(资金不足、卡片过期等)
- 计划更改费用失败
- 支付方式授权失败
从暂停状态重新激活
要从on_hold 状态重新激活订阅,更新支付方式。这会自动:
- 为未付金额创建扣款
- 生成发票
- 使用新支付方式处理付款
- 成功付款后将订阅重新激活到
active状态
成功更新
on_hold 状态订阅的支付方式后,您将收到 payment.succeeded 随后是 subscription.active 的 Webhook 事件。按转换发送的 Webhook 事件
每次转换都会发出一个 Webhook,因此您可以在无需轮询的情况下驱动授权逻辑:| 转换 | 事件 |
|---|---|
| 订阅激活 | subscription.active |
| 续订成功 | subscription.renewed |
| 续订失败 → 暂停 | subscription.on_hold |
| 创建失败 | subscription.failed |
| 计划升级/降级 | subscription.plan_changed |
| 已取消 | subscription.cancelled |
| 期限结束 | subscription.expired |
| 任一字段更改 | subscription.updated |
Subscription Webhook Payloads
查看订阅生命周期事件的完整负载架构。
API 管理
Create subscriptions
Create subscriptions
使用
POST /subscriptions 从产品中以编程方式创建订阅,带有可选的试用期和附加组件。API Reference
查看创建订阅的 API。
Update subscriptions
Update subscriptions
使用
PATCH /subscriptions/{id} 更新数量、在下一个计费日期取消或修改元数据。API Reference
了解如何更新订阅详细信息。
Change plans (proration)
Change plans (proration)
使用比例分配控制更改活动产品和数量。
API Reference
查看计划更改选项。
On‑demand charges
On‑demand charges
对于按需订阅,按需收取特定金额。
API Reference
收取按需订阅费用。
List and retrieve
List and retrieve
使用
GET /subscriptions 列出所有订阅,使用 GET /subscriptions/{id} 检索一个订阅。API Reference
浏览列表和检索 API。
Usage history
Usage history
获取按量计费或混合定价模型的记录使用情况。
API Reference
查看使用历史 API。
Update payment method
Update payment method
更新订阅的支付方式。对于活动订阅,这会更新未来续订的支付方式。对于处于
on_hold 状态的订阅,这会通过为剩余金额创建扣款来重新激活订阅。当生成新的支付方式链接(New 请求类型)时,您可以传递 allowed_payment_method_types 来限制客户在该页面上看到的支付方式。客户永远不会看到列表中没有的方法,虽然包括一种方法并不保证它会出现(可用性仍然取决于客户位置和您的业务设置等因素)。API Reference
了解如何更新支付方式并重新激活订阅。
常见使用案例
- SaaS 和 API:提供分级访问及增加席位或用量的附加组件
- 内容和媒体:每月访问,带有入门试用
- B2B 支持计划:年度合同,带有高级支持附加组件
- 工具和插件:许可证密钥和版本发布
集成示例
结帐会话(订阅)
创建结帐会话时,请包含您的订阅产品和可选的附加组件:具有比例分配的计划更改
升级或降级订阅并控制比例分配行为:在下一个计费日期取消
安排在当前计费周期结束时生效的取消:按需订阅
创建按需订阅,并在需要时收取费用:更新活动订阅的支付方式
更新活动订阅的支付方式:从暂停状态重新激活订阅
重新激活由于未付款而处于暂停状态的订阅:具有 RBI 合规授权的订阅
UPI 和印度卡订阅在 RBI(印度储备银行)法规下运行,具有特定的授权要求:授权限制
授权类型和金额取决于您的订阅的定期收费:- 费用低于授权下限(默认 ₹15,000): 我们为下限金额创建按需授权。根据您的订阅频率按期收取订阅金额,最高可达授权限额。
- 费用达到或超过授权下限: 我们为精确订阅金额创建订阅授权(或按需授权)。
mandate_min_amount_inr_paise (INR paise)进行配置。银行登记的金额为 max(mandate_floor, billing_amount) - 因此,下限实际上成为每次计费较低时面向客户的授权上限。
有关 RBI 合规授权和印度支付方式可配置授权下限的详细信息,请参阅印度支付方式页面。
升级和降级注意事项
重要: 升级或降级订阅时,要仔细考虑授权限额:- 如果升级/降级导致的收费金额超过 ₹15,000 并超出现有按需付款限额,交易将可能失败。
- 在这种情况下,客户可能需要更新其支付方式或再次更改订阅以建立具有正确限额的新授权。
高值收费的授权
对于达到或超过 ₹15,000 的订阅费用:- 客户将被其银行提示授权交易。
- 如果客户未能授权交易,交易将失败,订阅将被暂停。
48 小时处理延迟
处理时间表: 印度卡和 UPI 订阅的定期扣费遵循特有的处理模式:- 根据您的订阅频率,在计划日期发起收费。
- 从付款发起后48 小时起,客户帐户的实际扣款才会发生。
- 此 48 小时窗口可能会根据银行的 API 响应延长 2-3 小时。
授权取消窗口
在 48 小时的处理窗口:- 客户可以通过他们的银行应用取消授权。
- 如果客户在此期间取消授权,订阅将保持活动(这是印度卡和 UPI 自动支付订阅特有的边缘情况)。
- 但是,实际扣款可能会失败,在这种情况下,我们将把订阅置为暂停状态。
- 在付款确认前推迟优惠激活
- 实施宽限期或临时访问
- 监控订阅状态以应对授权取消
- 在应用逻辑中处理订阅暂停状态
最佳实践
- 从明确的层级开始:2-3 个计划,各具明显区别
- 传达定价信息:显示总计、比例分配和下次续订
- 谨慎使用试用期:通过引导转化,而不仅仅是时间
- 利用附加组件:保持基础计划简单,并追加销售额外功能
- 测试更改:在测试模式下验证计划更改和分配
订阅是可灵活用于创建定期收入的基础。开始简单,彻底测试,并根据采用、流失和扩展指标进行迭代。