> ## Documentation Index
> Fetch the complete documentation index at: https://doc.haipay.net/llms.txt
> Use this file to discover all available pages before exploring further.

# 信用卡订阅 — 订阅申请（历史导航 V20260628）

> 历史版本（V20260628）信用卡订阅 — 订阅申请（历史导航 V20260628）（POST /subscription/apply）：创建订阅订单；关键请求参数含 subscriptionOrderId、amount、phone、subject。

> [!NOTE]
>
> 本页所有示例请求均基于**沙盒（测试）环境**，请注意区分正式环境。

#### 密钥私钥(生成签名)

## 相关主题

* [订阅支付接口](https://doc.haipay.net/zh/history/V20260628/api/version2/Subscription.md)
* [HaiPay API 文档简介](https://doc.haipay.net/zh/history/V20260628/api-reference/overview.md)
* [HaiPay 配置与签名指南](https://doc.haipay.net/zh/history/V20260628/guide/config_settings_and_signature_rules_guide.md)


## OpenAPI

````yaml docs/zh/api-reference/subscription/subscription.openapi.json POST /subscription/apply
openapi: 3.0.1
info:
  title: 默认模块
  description: ''
  version: 1.0.0
servers:
  - url: https://uat-interface.haipay.asia
    description: 测试-interface
security: []
tags: []
paths:
  /subscription/apply:
    post:
      tags: []
      summary: 订阅申请
      description: 创建订阅订单
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                appId:
                  type: integer
                  description: 业务ID（后台获取，需要根据参数currency传递对应的业务ID）
                subscriptionOrderId:
                  type: string
                  description: 商户订单号(必须保证唯一性，长度不超过48)
                  maxLength: 48
                amount:
                  type: string
                  description: 交易金额（精确到小数点后两位；禁止添加标点符号，例如：","）
                  pattern: ^\d+\.\d{2}$
                name:
                  type: string
                  description: 用户姓名，推荐使用真实姓名，格式：包含firstName和lastName，以空格分割的，示例：John Doe
                phone:
                  type: string
                  description: 真实手机号（格式参考电话号码格式）
                email:
                  type: string
                  description: 真实电子邮件
                  format: email
                subject:
                  type: string
                  description: 订阅标题
                body:
                  type: string
                  description: 备注详情
                inBankCode:
                  type: string
                  description: 支付方式编码，与 paymentMethods 二选一
                  enum:
                    - CREDIT_CARD
                    - GOOGLE_PAY
                    - APPLE_PAY
                payType:
                  type: string
                  description: 支付方式类型
                  enum:
                    - SUBSCRIPTION
                callBackUrl:
                  type: string
                  description: 用户支付成功后跳转地址
                  format: uri
                notifyUrl:
                  type: string
                  description: 异步通知地址
                  format: uri
                country:
                  type: string
                  description: 国家
                currency:
                  type: string
                  description: 币种，目前支持：USD
                  enum:
                    - USD
                partnerUserId:
                  type: string
                  description: >-
                    用户唯一标识（如用户ID
                    userId），用于风控系统，必须真实有效，否则会影响交易。格式要求：数字、大小写字母或常用符号-~!@#$%&*()_。
                  pattern: ^[A-Za-z0-9\-~!@#$%&*()_]+$
                recurringInterval:
                  type: string
                  description: 循环周期类型 D（天）,W（周）,M（月）,Y（年）
                  enum:
                    - D
                    - W
                    - M
                    - 'Y'
                recurringIntervalCount:
                  type: integer
                  description: 循环周期间隔
                  minimum: 1
                recurringMaxNumber:
                  type: integer
                  description: 最大循环次数，无论循环周期是哪个，最长时间不能超过三年，到期订阅自动取消
                  minimum: 1
                website:
                  type: string
                  description: 交易网站
                  format: uri
                retryTimes:
                  type: integer
                  description: 定期扣款失败重试次数，默认为3
                  minimum: 0
                  default: 3
                cancelUrl:
                  type: string
                  description: 用户取消支付URL，如果传递，用户可在支付页面点击返回到此页面
                  format: uri
                couponPeriod:
                  type: integer
                  description: >-
                    优惠期数(暂时只支持首期优惠与全期优惠，即couponPeriod只能等于1或者等于recurringMaxNumber)
                couponAmountPerPeriod:
                  type: string
                  description: 每期优惠金额
                  pattern: ^\d+\.\d{2}$
                sign:
                  type: string
                  description: 签名
                paymentMethods:
                  type: string
                  description: >-
                    支持的支付方式列表，英文逗号分隔，如 CREDIT_CARD,GOOGLE_PAY,APPLE_PAY，与
                    inBankCode 二选一，暂时仅支持前置组件组合模式使用
              required:
                - appId
                - subscriptionOrderId
                - amount
                - phone
                - subject
                - inBankCode
                - payType
                - callBackUrl
                - notifyUrl
                - country
                - currency
                - partnerUserId
                - recurringInterval
                - recurringIntervalCount
                - recurringMaxNumber
                - website
                - retryTimes
                - sign
              additionalProperties: false
            example:
              country: USA
              website: https://test.com
              amount: '19.99'
              callBackUrl: https://www.google.com
              inBankCode: CREDIT_CARD
              subject: Test subscription
              subscriptionOrderId: '1736739758574'
              recurringIntervalCount: 1
              sign: >-
                JeJR4N40eKncoohebUN31aNqPqpBxR799rmMutqrSmMaBn0Sjmqbskl4Wiitmatvvx6tqvuwkOYtk6ryrYj7YqJxDeNfDqthWzOxv2ixkKY0YDoWEAra9sWc4CnXBBssP0VIKg0jSTMNzdvmvuNBa7sLEQj5YjgswUnCGtYCmsz154JHSSRpdeYDLL+Nt5b96pzQn8WyRr6b/9SSCrLCWSdt22gJmY5sQh7cc9OcJfAGb5E1XflTq5Va78cV+fw9hHhaZmFzKncg4wxrdaatxg9tCElMJpL1OuWO7XLfcfqgA/8Y/qRCWmNf11Ji3ZSrr7rU4+V7Egrfu1Fcr5DTlw==
              partnerUserId: H20241231
              payType: SUBSCRIPTION
              phone: '0845632145871'
              appId: 1724
              name: Emily Chen
              notifyUrl: https://www.google.com
              currency: USD
              email: emily.chen@gmail.com
              recurringInterval: D
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: 状态码
                  error:
                    type: string
                    description: 错误码
                  msg:
                    type: string
                    description: 返回信息
                  data:
                    type: object
                    properties:
                      subscriptionOrderId:
                        type: string
                        description: 商户订阅号(必须保证唯一性)
                      subscriptionNo:
                        type: string
                        description: 平台订阅号
                      appId:
                        type: string
                        description: 业务ID
                      subject:
                        type: string
                        description: 支付备注
                      payType:
                        type: string
                        description: 订阅固定为SUBSCRIPTION
                      inBankCode:
                        type: string
                        description: 银行编码
                      amount:
                        type: string
                        description: 金额
                      payUrl:
                        type: string
                        description: 授权链接
                      recurringInterval:
                        type: string
                        description: 循环周期 W,M,Y
                        enum:
                          - W
                          - M
                          - 'Y'
                      recurringIntervalCount:
                        type: string
                        description: 环周期间隔
                      status:
                        type: string
                        description: '订阅状态(-1: 订阅异常, 1: 处理中, 2: 订阅成功, 3: 订阅失败, 4: 订阅取消)'
                        enum:
                          - '-1'
                          - '1'
                          - '2'
                          - '3'
                          - '4'
                      clientToken:
                        type: string
                        description: 在JavaScript Web SDK中使用的客户端令牌(见HaiPaySDK.js)
                      sign:
                        type: string
                        description: 签名
                additionalProperties: false
              example:
                status: '1'
                error: '00000000'
                msg: ''
                data:
                  subscriptionNo: '4025011311423010028'
                  subscriptionOrderId: '1736739758574'
                  appId: 1724
                  subject: Test subscription
                  payType: SUBSCRIPTION
                  inBankCode: CREDIT_CARD
                  amount: 0.5
                  recurringInterval: D
                  recurringIntervalCount: 1
                  status: '2'
                  sign: >-
                    QrOo7yPJMTRk92bP9WU8P0ATdRvCm8dWElhbxqV6qmZEWZDRXeJAwUvd3839zErg+3tN/U4Rwyru219AkXg9CJZtocna3fiYj7uLxwD6bpAp+i9DGz5ZKV9ab5mwIEPWIQXKuY6wATzmlz6W4TvAkRqgGtqLkwYUaeqsmgJrh4WlIMK13GW/zvoCmYfFD6pNZUByVixpll8JPeZG7F9d+x7yjDigJZ2S1wm4F307OzZJkUSKSvQn6Q0lOvp1JS0feXSC+hwCfrdllFXIE10TDV0itoPY5G7+3QdmHpINWp3kWmepR/1pOsN+09hLxe8xKAIZrX2GFHY00xo3QnxBIw==
          headers: {}
      deprecated: false
      security: []

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.