> ## 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.

# 信用卡订阅 — 订阅申请

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

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

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

## 相关主题

* [订阅支付接口](https://doc.haipay.net/zh/history/V20260701/payments/subscriptions/overview.md)
* [HaiPay API 文档简介](https://doc.haipay.net/zh/history/V20260701/api-reference/overview.md)
* [HaiPay 配置与签名指南](https://doc.haipay.net/zh/history/V20260701/guide/config_settings_and_signature_rules_guide.md)
* [信用卡订阅 — 查询订阅 (POST /subscription/query)](https://doc.haipay.net/zh/history/V20260701/api-reference/subscription/subscription-query.md)
* [处理异步通知并验证签名](https://doc.haipay.net/zh/operations/callback.md)
* [查阅接口响应结构与错误码](https://doc.haipay.net/zh/history/V20260701/guide/error_response_appendix.md)
* [使用测试卡号模拟支付成功、拒付与争议场景](https://doc.haipay.net/zh/history/V20260701/testing/test-cards.md)


## OpenAPI

````yaml docs/zh/V20260701/api-reference/subscription/subscription.openapi.json POST /subscription/apply
openapi: 3.0.1
info:
  title: 默认模块
  description: ''
  version: 1.0.0
servers: []
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
              appId: 10245
              partnerUserId: '123456'
              currency: USD
              name: Emily Chen
              phone: '02012345678'
              email: emily.chen@gmail.com
              subscriptionOrderId: '202506181112003554578260'
              subject: VIP会员
              body: VIP会员月付
              inBankCode: CREDIT_CARD
              payType: SUBSCRIPTION
              notifyUrl: https://www.google.com
              recurringInterval: M
              recurringIntervalCount: 1
              recurringMaxNumber: 12
              retryTimes: 3
              sign: EA66451051A2A96D3284D09DE4A5B78D
        required: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: '1: 正常, 0: 异常'
                    default: '1'
                  error:
                    type: string
                    description: 错误代码
                    default: '00000000'
                  msg:
                    type: string
                    description: 错误描述
                    default: ''
                  data:
                    type: object
                    description: ''
                    properties:
                      subscriptionOrderId:
                        type: string
                        description: 商户订单号
                      subscriptionOrderNo:
                        type: string
                        description: 平台订单号
                      payUrl:
                        type: string
                        description: 支付链接
                    required:
                      - subscriptionOrderId
                      - subscriptionOrderNo
                      - payUrl
                required:
                  - status
                  - error
                  - msg
                  - data
              example:
                status: '1'
                error: '00000000'
                msg: SUCCESS
                data:
                  subscriptionOrderId: '6022111516571001'
                  subscriptionOrderNo: '6022111516571002'
                  payUrl: https://test.com
          headers: {}
      deprecated: false
      security: []

````

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