跳转到主要内容
POST

授权

Authorization
string
header
必填

OAuth2 client_credentials 授权。access_token 到期后重新获取。

请求体

application/json

创建待激活订阅。客户引用与新客户资料二选一;新客户必须完整提供 firstName、lastName、emailAddress。订阅定义必须且只能选择手填、模板或 By agreement 一种。手填模式至少启用一个收费段;非模板模式必须提供 plan_name。推荐使用 customer、plan 嵌套参数。

merchant_id
string
必填

业务标识,由 BillBuddy 分配。

Required string length: 1 - 20
notify_email

是否允许本交易或订阅相关邮件通知。false 表示禁止,true 表示允许;省略或 null 时使用该业务的 API 邮件通知设置,默认关闭。实际发送受通知偏好和适用规则约束。 也兼容 0/1 和字符串 "0"/"1"。

notify_sms

是否允许本交易或订阅相关短信通知。false 表示禁止,true 表示允许;省略或 null 时使用该业务的 API 短信通知设置,默认关闭。实际发送受通知偏好和适用规则约束。 也兼容 0/1 和字符串 "0"/"1"。

customer
object

复用客户时传 customer_id;新建客户时传 firstName、lastName、emailAddress,二者互斥。

plan
object

恰好选择一种模式:recurring/one_off 手填;template_id 模板;schedule By agreement。

customer_id
string | null

仍支持的顶层替代参数;推荐使用 customer.customer_id。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

BillBuddy 客户标识,须为当前商户及业务范围内的有效客户。

Maximum string length: 32
firstName
string | null

仍支持的顶层替代参数;推荐使用 customer.firstName。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

新客户名字。创建新客户时必填。

Maximum string length: 100
lastName
string | null

仍支持的顶层替代参数;推荐使用 customer.lastName。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

新客户姓氏。创建新客户时必填。

Maximum string length: 100
emailAddress
string<email> | null

仍支持的顶层替代参数;推荐使用 customer.emailAddress。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

新客户主邮箱。创建新客户时必填;同一商户及业务范围内已有此邮箱时请改传已有 customer_id。

Maximum string length: 500
mobilePhoneNumber
string | null

仍支持的顶层替代参数;推荐使用 customer.mobilePhoneNumber。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

客户手机号。

Maximum string length: 20
addressLine1
string | null

仍支持的顶层替代参数;推荐使用 customer.addressLine1。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

客户地址第一行。

Maximum string length: 255
addressSuburb
string | null

仍支持的顶层替代参数;推荐使用 customer.addressSuburb。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

客户城市或区。

Maximum string length: 100
addressState
string | null

仍支持的顶层替代参数;推荐使用 customer.addressState。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

客户州或省。

Maximum string length: 100
addressPostCode
string | null

仍支持的顶层替代参数;推荐使用 customer.addressPostCode。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

客户邮编。

Maximum string length: 50
plan_name
string | null

仍支持的顶层替代参数;推荐使用 plan.plan_name。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

订阅名称;模板模式可省略或传 null 并继承模板名称,其他模式必填且不能为空。

Maximum string length: 255
description
string | null

仍支持的顶层替代参数;推荐使用 plan.description。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

说明。

Maximum string length: 500
recurring
object | null

仍支持的顶层替代参数;推荐使用 plan.recurring。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

周期订阅定义。

one_off
object | null

仍支持的顶层替代参数;推荐使用 plan.one_off。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

一次性付款定义;和 recurring 同启用时作为 Deposit,单独使用时为 One-off。

schedule
object | null

仍支持的顶层替代参数;推荐使用 plan.schedule。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

By agreement 首条扣费计划定义。与 recurring/one_off 手填模式、template_id 模式互斥。

surcharge_config
enum<string>[] | null

仍支持的顶层替代参数;推荐使用 plan.surcharge_config。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

附加费选项,建议提交字符串数组,可选项见 Schema 和示例。省略、null 或空数组表示全部关闭;非数组也按全部关闭处理,未知选项不启用收费。credit_card_surcharge 表示信用卡附加费分组。实际是否收取受商户业务规则及支付方式限制。 手填模式使用此设置;模板模式使用模板的附加费选项,本字段不覆盖模板;By agreement 的 schedule 模式不支持此设置。 卡类附加费受适用收费政策限制;政策不允许收费时,即使提交卡类选项也不启用收费。

附加费选项。

可用选项:
direct_debit_surcharge,
visa_domestic_surcharge,
visa_international_surcharge,
mastercard_domestic_surcharge,
mastercard_international_surcharge,
amex_domestic_surcharge,
amex_international_surcharge,
credit_card_surcharge
dishonour_fee_switch

仍支持的顶层替代参数;推荐使用 plan.dishonour_fee_switch。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

是否收取客户扣款退票费,省略或 null 默认关闭。启用须已有适用的正数费额配置,实际金额以签署条款为准。也兼容 0/1 和字符串 "0"/"1"。 仅适用于 recurring/one_off 手填模式;模板模式和 By agreement 的 schedule 模式不支持通过本字段设置。

template_id
string | null

仍支持的顶层替代参数;推荐使用 plan.template_id。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

可用模板 ID,来自 GET /api/v2/plan/list;只接受启用、ACTIVE、非阶梯且非 By agreement 的模板。

Maximum string length: 20
start_date
string<date> | null

仍支持的顶层替代参数;推荐使用 plan.start_date。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

模板中 recurring 段的日期覆盖值。模板含 recurring 时必填;至少服务业务时区的明天。

payment_date
string<date> | null

仍支持的顶层替代参数;推荐使用 plan.payment_date。同名嵌套字段与本字段同时提供时,以嵌套字段为准。

模板中 one_off 段的日期覆盖值。模板含 one_off 时必填;至少服务业务时区的明天。

响应

HTTP 200。成功、业务失败、参数校验失败或业务鉴权失败以响应体 code 区分。

成功响应。

code
enum<integer>
必填

0 表示订阅已创建,尚待客户激活。

可用选项:
0
message
string
必填

响应说明。

data
object
必填

已创建但尚未激活的 DDR。