订阅更新预览
- Endpoint:
POST /aggregate-pay/api/gateway/subscriptionUpdatePreview - Tags: 收单/订阅计划管理
Description
订阅计划被激活后,在后续阶段商户可自助对该已激活的订阅计划进行更新,包括从低阶产品升级到高阶产品、从高阶产品降级到低阶产品、月付/年付周期切换,以及团队席位增减等场景。 第一步:先进行更新预览(本接口) 第二步:再对预览结果进行更新确认,参见subscriptionUpdate接口
Parameters
| Field | In | Type | Required | Constraints | Description |
|---|---|---|---|---|---|
Content-Type | header | string | Yes | ||
sign | header | string | Yes | 签名信息请参考技术文档 |
Parameter Examples
Content-Type:"application/json"sign:"FPFVT3o227JrFRbqu19boZCpVVTF9KznxyRawUmxpfXilHV/0yK46haPhAjNu1hPUMy7Vw/ILXhfzffNm4Fj0apWknlTY9OJxnSoQxS9BTFtc61tn5yV1q69x/kkBl82/qwg+XTJ4fOzy7Mar3VaC1E2PlDA6RkkKBUyNE6RYgsdB+Su7an4+4HVTNAnoe74WyvBgxTLMNg28igBTdqxaO3w/UBY6ObVp7vkqkQGdL1Y+HgmMYaAVwrM3+ALWGId0sJ+YqTY4WJ+0xCRGhaSnybiIjZsQEYyID68WNUfuavDLDsEhaMm/HfQvf5p0R1Ltovp3wwJnEbQcjY458iX5A=="
Request Body
Content-Type: application/json
| Field | Type | Required | Constraints | Description | Enum |
|---|---|---|---|---|---|
version | string | Yes | maxLength: 8 | 接口版本 当前值为:1.5 | |
keyVersion | string | Yes | maxLength: 8 | 密钥版本 当前值为:1 | |
requestTime | string | Yes | maxLength: 32 | 请求时间,符合rfc3339规范,格式:yyyy-MM-dd'T'HH:mm:ss.SSSXXX 时间需要在当前时间两分钟内 | |
appId | string | Yes | maxLength: 64 | 商户应用Id,PayerMax分配给商户应用的唯一标识 | |
merchantNo | string | No | maxLength: 32 | 商户号,商户与PayerMax业务签约时生成的唯一标识 | |
data | object | Yes | |||
data.subscriptionNo | string | Yes | maxLength: 64 | PMX生成的订阅单号。subscriptionRequestId和subscriptionNo至少填其一 | |
data.userId | string | Yes | maxLength: 64 | 用户id。 | |
data.effectiveMode | string | Yes | maxLength: 32 | 生效方式。IMMEDIATE立即生效、NEXT_CYCLE下周期生效 | |
data.billingCycleAnchor | string | No | maxLength: 32 | 账单周期处理方式。UNCHANGED按原计划(维持原账单日)、NOW重新计算周期 | |
data.frontCallbackUrl | string | Yes | maxLength: 1024 | 前端跳转地址。用户完成支付后的前端跳转地址 | |
data.mitManagementUrl | string | No | maxLength: 1024 | Mit管理地址。 注:当原计划的支付方式是APPLEPAY/GOOGLEPAY时,该字段是必传的 | |
data.subscriptionPlan | object | Yes | |||
data.subscriptionPlan.subject | string | Yes | maxLength: 256 | 标题 | |
data.subscriptionPlan.description | string | No | maxLength: 256 | 描述 | |
data.subscriptionPlan.totalPeriods | number | Yes | 变更后的计划要执行的周期数 | ||
data.subscriptionPlan.prices | array[object] | Yes | 价格和坐席列表 | ||
data.subscriptionPlan.prices[].priceId | string | Yes | maxLength: 64 | 价格ID | |
data.subscriptionPlan.prices[].quantity | number | Yes | 坐席或数量 |
Example
json
{
"version": "1.5",
"keyVersion": "1",
"requestTime": "2026-04-10T05:00:00+00:00",
"appId": "6666c8b036a245799744912345a123456",
"merchantNo": "P00213827211234",
"data": {
"subscriptionNo": "SUB20250417120949065211234",
"userId": "testUserId",
"effectiveMode": "IMMEDIATE",
"billingCycleAnchor": "UNCHANGED",
"frontCallbackUrl": "http://yourDomain2.com/xxxx2",
"subscriptionPlan": {
"subject": "subjectTest",
"description": "descriptionTest",
"totalPeriods": 12,
"prices": [
{
"quantity": 1,
"priceId": "PRICE00291776859198820136500001"
}
]
}
}
}Responses
200
| Field | Type | Required | Constraints | Description | Enum |
|---|---|---|---|---|---|
code | string | Yes | 返回码,’APPLY_SUCCESS’代表成功 | ||
msg | string | Yes | 返回描述,’Success.’ | ||
data | object | Yes | |||
data.previewId | string | Yes | maxLength: 64 | PMX 生成的唯一的预览单号 | |
data.subscriptionNo | string | Yes | maxLength: 64 | PMX生成的订阅单号。 | |
data.userId | string | Yes | maxLength: 64 | 用户号 | |
data.currentSubscriptionPlan | object | Yes | 当前订阅计划信息 | ||
data.currentSubscriptionPlan.periodAmount | object | Yes | 当前期扣款金额 | ||
data.currentSubscriptionPlan.periodAmount.amount | number | Yes | 金额 | ||
data.currentSubscriptionPlan.periodAmount.currency | string | Yes | maxLength: 3 | 币种 | |
data.currentSubscriptionPlan.periodRule | object | Yes | 扣款规则 | ||
data.currentSubscriptionPlan.periodRule.periodCount | number | Yes | 扣款频次。 | ||
data.currentSubscriptionPlan.periodRule.periodUnit | string | Yes | maxLength: 8 | 周期。 | |
data.currentSubscriptionPlan.prices | array[object] | Yes | 价格和坐席列表 | ||
data.currentSubscriptionPlan.prices[].priceId | string | Yes | maxLength: 64 | 价格 id | |
data.currentSubscriptionPlan.prices[].quantity | number | Yes | 坐席或数量 | ||
data.targetSubscriptionPlan | object | Yes | 目标订阅计划信息 | ||
data.targetSubscriptionPlan.periodAmount | object | Yes | 扣款金额 | ||
data.targetSubscriptionPlan.periodAmount.amount | number | Yes | 金额 | ||
data.targetSubscriptionPlan.periodAmount.currency | string | Yes | maxLength: 3 | 币种 | |
data.targetSubscriptionPlan.periodRule | object | Yes | 扣款规则 | ||
data.targetSubscriptionPlan.periodRule.periodCount | number | Yes | 扣款频次。 | ||
data.targetSubscriptionPlan.periodRule.periodUnit | string | Yes | maxLength: 8 | 周期。 | |
data.targetSubscriptionPlan.prices | array[object] | Yes | 价格和坐席列表 | ||
data.targetSubscriptionPlan.prices[].priceId | string | Yes | maxLength: 64 | 价格 id | |
data.targetSubscriptionPlan.prices[].quantity | number | Yes | 坐席或数量 | ||
data.billingPeriod | object | Yes | 不折算场景下,不返回该字段 | ||
data.billingPeriod.periodStartTime | string | Yes | maxLength: 64 | 当前账单开始时间 | |
data.billingPeriod.periodEndTime | string | Yes | 当前账单结束时间 | ||
data.billingPeriod. previewTime | string | Yes | maxLength: 64 | 本次预览时间 | |
data.billingPeriod.remainingDays | number | Yes | 当前周期剩余天数 | ||
data.billingPeriod.totalPeriodDays | number | Yes | 当前周期总天数 | ||
data.billingPeriod.remainingRatio | number | Yes | 当前周期剩余比例(4位小数) | ||
data.proration | object | Yes | 折算信息,不折算场景下,不返回该字段 | ||
data.proration.billingCycleAnchor | string | Yes | maxLength: 64 | 账单周期处理方式。UNCHANGED按原计划(维持原账单日)、NOW重新计算周期 | |
data.proration.unusedCurrentAmount | number | Yes | 当前计划未使用金额,可用于折扣 | ||
data.proration.remainingTargetAmount | number | Yes | 目标计划剩余周期费用 | ||
data.proration.netProrationAmount | number | Yes | 折算后的净额 | ||
data.proration.currency | string | Yes | maxLength: 3 | 币种 | |
data.amountSummary | object | Yes | 金额摘要 | ||
data.amountSummary.subTotalAmount | number | Yes | 本次目标计划产生的费用小计 | ||
data.amountSummary.creditAmount | number | Yes | 当前计划未使用金额抵扣 | ||
data.amountSummary.payableAmount | number | Yes | 本次需要支付金额 | ||
data.amountSummary.currency | string | Yes | maxLength: 3 | 币种 | |
data.nextInvoice | object | Yes | 下期账单信息 | ||
data.nextInvoice.amount | number | Yes | 下期预计应付金额 | ||
data.nextInvoice.currency | string | Yes | maxLength: 3 | 下期预计应付币种 | |
data.nextInvoice.periodStartTime | string | Yes | maxLength: 64 | 下期账单周期开始时间 | |
data.nextInvoice.periodEndTime | string | Yes | maxLength: 64 | 下期账单周期结束时间 |
Response Example
json
{
"code": "APPLY_SUCCESS",
"msg": "Success.",
"data": {
"previewId": "PVI202504171209490652111234",
"subscriptionNo": "SUB20250417120949065211234",
"userId": "xxx",
"currentSubscriptionPlan": {
"periodAmount": {
"amount": 3000,
"currency": "KRW"
},
"periodRule": {
"periodCount": 1,
"periodUnit": "M"
},
"prices": [
{
"quantity": 1,
"priceId": "PRICE0029177685919882013650001"
}
]
},
"targetSubscriptionPlan": {
"periodAmount": {
"amount": 4200,
"currency": "KRW"
},
"periodRule": {
"periodCount": 1,
"periodUnit": "M"
},
"prices": [
{
"quantity": 2,
"priceId": "PRICE0029177685919882013650002"
}
]
},
"billingPeriod": {
"periodStartTime": "2026-04-10T00:00:00+0000",
"periodEndTime": "2026-05-10T23:59:59+0000",
"previewTime": "2026-04-20T15:59:59+0000",
"remainingDays": 20,
"totalPeriodDays": 30,
"remainingRatio": 0.6667
},
"proration": {
"billingCycleAnchor": "UNCHANGED",
"unusedCurrentAmount": 2000,
"remainingTargetAmount": 2800,
"netProrationAmount": 800,
"currency": "KRW"
},
"amountSummary": {
"subTotalAmount": 2800,
"creditAmount": 2000,
"payableAmount": 800,
"currency": "KRW"
},
"nextInvoice": {
"periodStartTime": "2026-05-10T00:00:00+0000",
"periodEndTime": "2026-06-10T23:59:59+0000",
"amount": 4200,
"currency": "KRW"
}
}
}