GET /openapi/memorylake/admin/v1/billing/subscription/plan-change-preview
plan_id 的费用:立即收取的按比例折算金额、其明细项、变更生效时间以及下一张完整发票。proration_date 回显计算按比例折算所依据的时刻。无需费用的切换会返回 applicable 为 false 并附带原因。变更套餐本身需在控制台中完成。
所需权限:
subscription:manage查询参数
integer
required
要试算切换价格的目标套餐
curl -X GET 'https://app.memorylake.cn/openapi/memorylake/admin/v1/billing/subscription/plan-change-preview?plan_id=9e50b1aed525a8280e28b9662b6a7ba0' \
-H 'Authorization: Bearer sk_xxxxxx'
响应
object
Show Plan Change Preview 对象
Show Plan Change Preview 对象
boolean
false 表示无需计价:参见
reason。变更本身仍可能有效。array
integer
请求中指定的目标套餐
object
integer
变更的生效时间,Unix 秒级时间戳:升级为当前时间,降级到免费套餐为计费周期结束时
object
integer
计算按比例折算所依据的时间点,Unix 秒级时间戳。适用时返回。
string
无需计价的原因:
no_paid_subscription(当前订阅并非通过支付服务商付费)、downgrade_to_free(切换到免费套餐在计费周期结束时生效,不产生费用)、resume_only(目标为已设置取消的订阅的当前套餐:切回仅会恢复该订阅){
"success": true,
"message": "Operation completed successfully",
"data": {
"applicable": false,
"lines": [
{
"amount": {
"amount": 1999,
"currency": "usd"
},
"description": "Example description",
"proration": false,
"period_end": 1760000000,
"period_start": 1760000000
}
],
"plan_id": 1,
"amount_due": {
"amount": 1999,
"currency": "usd"
},
"effective_at": 1760000000,
"from_plan": {
"id": 1,
"name": "Example name"
},
"next_invoice": {
"amount": {
"amount": 1999,
"currency": "usd"
},
"date": 1
},
"proration_date": 1,
"reason": "no_paid_subscription",
"to_plan": {
"id": 1,
"name": "Example name"
}
}
}