预览计划变更
在确认之前预览订阅计划变更的影响。返回即时收费金额和新的订阅详情,而不进行任何实际更改。
用例
- 结账确认:在客户确认更改计划前显示按比例分配的费用
- 价格计算器:在您的应用程序中构建升级/降级计算器
- 客户自助服务:让客户以准确的价格探索计划选项
- 折扣验证:预览累加的折扣代码如何影响计划更改的定价
discount_codes(最多20个代码的数组,按顺序应用)以查看累加折扣如何在提交更改前影响即时费用和新计划定价。单个 discount_code 字段已弃用,但仍支持向后兼容;我们建议继续使用 discount_codes。响应字段
预览响应包括:| 字段 | 描述 |
|---|---|
immediate_charge | 将立即创建的费用,包括各项和摘要 |
new_plan | 显示更改计划后的完整订阅对象 |
授权
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
路径参数
Subscription Id
请求体
Unique identifier of the product to subscribe to
Proration Billing Mode
prorated_immediately, full_immediately, difference_immediately, do_not_bill Number of units to subscribe for. Must be at least 1.
x >= 0Whether adaptive currency fees should be included in the price (true) or added on top (false). If not specified, uses the subscription's stored setting.
Addons for the new plan. Note : Leaving this empty would remove any existing addons
DEPRECATED: Use discount_codes instead. Cannot be used together with discount_codes.
Stacked discount codes to apply to the new plan. Max 20. Cannot be used together with discount_code. If provided, replaces any existing discount codes. Empty array removes all discounts. If not provided (None), existing discounts with preserve_on_plan_change=true are preserved.
When to apply the plan change.
immediately(default): Apply the plan change right awaynext_billing_date: Schedule the change for the next billing date
immediately, next_billing_date Metadata for the payment. If not passed, the metadata of the subscription will be taken
Controls behavior when the plan change payment fails.
prevent_change: Keep subscription on current plan until payment succeedsapply_change(default): Apply plan change immediately regardless of payment outcome
If not specified, uses the business-level default setting.
prevent_change, apply_change