1. 订阅
Merchant API Documentation
  • 引言
  • 签名算法
  • 信用测试卡
  • 开启正式模式
  • 本地付测试
  • 代付
    • 代付申请接口_ PAY_PAL
      POST
    • 代付申请接口_ ACH_DEBIT
      POST
    • 代付申请接口_CASHAPP
      POST
    • 检索代付交易接口
      GET
    • 代付取消申请接口
      POST
  • 客户
    • 创建客户
      POST
    • 更新客户
      PUT
    • 检索客户
      GET
    • 删除客户
      DELETE
    • 列出所有客户
      GET
  • 代收(收款)
    • 收银台
      POST
    • 本地支付(直连)
      POST
    • 信用卡支付(直连)【PCI】
      POST
    • Web SDK-V2
      POST
    • 检索代收交易接口
      GET
    • Google Pay SDK
      POST
  • 退款申请
    • 退款申请接口
      POST
    • 检索退款接口
      GET
  • 余额查询
    • 检索余额接口
  • 异步通知
    • 代收异步通知
    • 代付异步通知
  • 订阅
    • 创建订阅
      POST
    • 检索订阅
      GET
    • 取消订阅
      POST
  • 重复性支付
    • 首次重复性支付(直连)
    • 首次重复性支付【收银台】
    • 首次重复性支付【SDK】
    • 后续重复性支付
  • 数据模型
    • 代收模型
      • 信用卡信息
        • CARD
        • 设备信息
      • 代收请求体
      • 代收响应体
      • option配置项
      • option配置项
    • 资金模型
      • 资金响应体
    • 客户模型
      • 客户请求体
      • 客户响应体
      • 收货地址 shipping
      • 产品/服务信息 product
    • 退款模型
      • 退款请求体
      • 退款响应体
    • 代付模型
      • 代付请求体
      • 代付响应体
      • 代付取消请求体
    • 订阅模型
      • 订阅请求体
      • 订阅响应体
      • 订阅计划请求体
      • 订阅计划响应体
      • 其他订阅请求体
    • 响应体基本模型
    • 请求头
  1. 订阅

创建订阅

POST
/pay-api/v1/billing/subscriptions

请求参数

Authorization
Header 参数

Body 参数application/json

示例
{
    "plan": {
        "product": {
            "name": "T-Shirt",
            "sku": "test_sku",
            "description": "Cotton XL",
            "quantity": "1",
            "price": "9.99",
            "url": "https://test.com/test_260a61ca16a8"
        },
        "name": "plan 1",
        "intervalUnit": "month",
        "intervalCount": 1,
        "currency": "USD",
        "amount": 9.99
    },
    "customer": {
        "firstname": "Thiago",
        "lastname": "Gabriel",
        "email": "thiago@example.com",
        "phone": "12345678901",
        "country": "US",
        "state": "CA",
        "city": "San Francisco",
        "address": "310  Park Street",
        "zipcode": "94107",
        "shipping": {
            "firstname": "Thiago",
            "lastname": "Gabriel",
            "email": "thiago@example.com",
            "phone": "12345678901",
            "country": "BR",
            "state": "SP",
            "city": "sao paulo",
            "address": "Rua 9 de setembro",
            "zipcode": "04849333"
        }
    },
    "description": "",
    "metadata": "test"
}

请求示例代码

Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location '/pay-api/v1/billing/subscriptions' \
--header 'Idempotent-Key: {{$string.uuid}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "plan": {
        "product": {
            "name": "T-Shirt",
            "sku": "test_sku",
            "description": "Cotton XL",
            "quantity": "1",
            "price": "9.99",
            "url": "https://test.com/test_260a61ca16a8"
        },
        "name": "plan 1",
        "intervalUnit": "month",
        "intervalCount": 1,
        "currency": "USD",
        "amount": 9.99
    },
    "customer": {
        "firstname": "Thiago",
        "lastname": "Gabriel",
        "email": "thiago@example.com",
        "phone": "12345678901",
        "country": "US",
        "state": "CA",
        "city": "San Francisco",
        "address": "310  Park Street",
        "zipcode": "94107",
        "shipping": {
            "firstname": "Thiago",
            "lastname": "Gabriel",
            "email": "thiago@example.com",
            "phone": "12345678901",
            "country": "BR",
            "state": "SP",
            "city": "sao paulo",
            "address": "Rua 9 de setembro",
            "zipcode": "04849333"
        }
    },
    "description": "",
    "metadata": "test"
}'

返回响应

🟢200成功
application/json
Bodyapplication/json

示例
{
    "code": 0,
    "data": {
        "merNo": "2500000000",
        "subToken": "sub_202508021903265863917",
        "plan": {
            "planToken": "plan_202508021903266087685",
            "productToken": "prod_202508021903265947002",
            "name": "plan 1",
            "intervalUnit": "month",
            "intervalCount": 1,
            "currency": "USD",
            "amount": 9.99,
            "metadata": null,
            "remark": null
        },
        "description": "",
        "status": 0,
        "code": "requires_action",
        "message": "Please redirect to 'redirectUrl'",
        "redirectUrl": "http://localhost:5173/checkout/pay_202508021903266348356",
        "paymentMethod": null,
        "firstTradeNo": "pay_202508021903266348356",
        "startTime": null,
        "cancelTime": null,
        "expireTime": null,
        "createTime": 1754132606723,
        "metadata": "test",
        "remark": null
    },
    "msg": "",
    "livemode": false
}
🔴500失败
修改于 2026-06-16 07:26:34
上一页
代付异步通知
下一页
检索订阅
Built with