创建订阅计划接口(待上线)
用于创建一个新的订阅产品计划。
请求地址(POST)
实时 API: https://api.futurepay.global/auto/createSubscriptionPlan
沙盒 API: https://api.futurepay-develop.com/auto/createSubscriptionPlan
请求参数
Request Body
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| productName | String | 是 | 订阅产品名称(最多50字符) |
| retryLimit | Integer | 是 | 扣款失败允许的重试次数,-1 表示无限次 |
| subscriptionCycle | String | 是 | 订阅周期单位:year、month、week、day |
| subscriptionCycles | Integer | 是 | 订阅周期数量 |
| regularPrice | Decimal | 是 | 正式订阅金额 |
| regularCurrency | String | 是 | 正式订阅币种(ISO4217,如 USD) |
| isTrialSubscription | Integer | 否 | 是否开启试用订阅:0 未开启,1 开启 |
| trialPrice | Decimal | 否 | 试用订阅金额 |
| trialCurrency | String | 否 | 试用订阅币种 |
| trialCycle | String | 否 | 试用周期单位:year、month、week、day、hour |
| trialCycles | Integer | 否 | 试用周期数量 |
| trialBillingMode | String | 否 | 试用计费模式:PERIODIC 或 INTERVAL |
试用订阅规则
当 isTrialSubscription = 1 时,以下字段必须填写:
| 参数 | 规则 |
|---|---|
| trialPrice | 不能为空 |
| trialCurrency | 必须与 regularCurrency 相同 |
| trialCycle | 不能为空 |
| trialCycles | 不能为空 |
| trialBillingMode | 只能是 PERIODIC 或 INTERVAL |
| trialPrice | 不能大于 regularPrice |
请求示例
POST /createSubscriptionPlan
Content-Type: application/json
{
"productName": "Netflix 月度订阅",
"retryLimit": 3,
"subscriptionCycle": "month",
"subscriptionCycles": 1,
"regularPrice": 9.99,
"regularCurrency": "USD",
"isTrialSubscription": 1,
"trialPrice": 0,
"trialCurrency": "USD",
"trialCycle": "day",
"trialCycles": 7,
"trialBillingMode": "INTERVAL"
}返回结果
返回参数
| 参数 | 类型 | 说明 |
|---|---|---|
| code | Integer | 返回状态码 |
| message | String | 返回信息 |
| data | Object | 订阅计划信息 |
data 字段说明
| 字段 | 类型 | 说明 |
|---|---|---|
| productsId | Long | 订阅计划ID |
| productName | String | 产品名称 |
| merchantId | Long | 商户ID |
| merchantName | String | 商户名称 |
| regularPrice | Decimal | 正式订阅金额 |
| regularCurrency | String | 订阅币种 |
| subscriptionCycle | String | 订阅周期单位 |
| subscriptionCycles | Integer | 订阅周期数量 |
| istate | String | 状态(active) |
| createdTime | Date | 创建时间 |
返回示例
{
"code": 200,
"message": "success",
"data": {
"productsId": 1938472394823,
"productName": "Netflix 月度订阅",
"merchantId": 10001,
"merchantName": "Netflix Inc",
"regularPrice": 9.99,
"regularCurrency": "USD",
"subscriptionCycle": "month",
"subscriptionCycles": 1,
"istate": "active",
"createdTime": "2026-03-09 15:10:00"
}
}错误返回示例
{
"code": 500,
"message": "Regular price cannot be null and must be greater than 0",
"data": null
}Updated about 3 hours ago