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

# Credit Card Subscription — Subscription Application

> Credit Card Subscription — Subscription Application endpoint (POST /subscription/apply) with request parameters including subscriptionOrderId, amount, phone, subject, signature verification, and response status.

> [!NOTE]
>
> All example requests on this page are based on the **sandbox (test) environment**. Please be careful to distinguish it from the production environment.

#### Secret Key & Private Key (Generate Signature)

## Related Topics

* [Subscription Payment API](https://doc.haipay.net/en/history/V20260701/payments/subscriptions/overview.md)
* [HaiPay API Reference Overview](https://doc.haipay.net/en/history/V20260701/api-reference/overview.md)
* [HaiPay Configuration and Signature Guide](https://doc.haipay.net/en/history/V20260701/guide/config_settings_and_signature_rules_guide.md)
* [Credit Card Subscription — Subscription Query (POST /subscription/query)](https://doc.haipay.net/en/history/V20260701/api-reference/subscription/subscription-query.md)
* [Handle Asynchronous Notifications and Verify Signatures](https://doc.haipay.net/en/operations/callback.md)
* [Look Up API Response Structure and Error Codes](https://doc.haipay.net/en/history/V20260701/guide/error_response_appendix.md)
* [Use Test Card Numbers for Successful and Failed Payments](https://doc.haipay.net/en/history/V20260701/testing/test-cards.md)


## OpenAPI

````yaml docs/en/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: Subscription Application
      description: 创建订阅订单
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                appId:
                  type: integer
                  description: >-
                    Business ID (obtained from the backend, must pass the
                    corresponding business ID according to the currency in the
                    URL)
                subscriptionOrderId:
                  type: string
                  description: Merchant order ID (must be unique, max length 48)
                  maxLength: 48
                amount:
                  type: string
                  description: >-
                    Transaction amount (accurate to two decimals; punctuation
                    such as “,” is not allowed)
                  pattern: ^\d+\.\d{2}$
                name:
                  type: string
                  description: >-
                    User name, recommended to use real name. Format: includes
                    firstName and lastName, separated by space. Example: John
                    Doe
                phone:
                  type: string
                  description: Real phone number
                email:
                  type: string
                  description: Real email
                  format: email
                subject:
                  type: string
                  description: Subscription title
                body:
                  type: string
                  description: Remark details
                inBankCode:
                  type: string
                  description: >-
                    CREDIT_CARD, GOOGLE_PAY, APPLE_PAY. Mutually exclusive with
                    paymentMethods.
                  enum:
                    - CREDIT_CARD
                    - GOOGLE_PAY
                    - APPLE_PAY
                payType:
                  type: string
                  description: SUBSCRIPTION
                  enum:
                    - SUBSCRIPTION
                callBackUrl:
                  type: string
                  description: Redirect URL after successful payment
                  format: uri
                notifyUrl:
                  type: string
                  description: Asynchronous notification URL
                  format: uri
                country:
                  type: string
                  description: Country
                currency:
                  type: string
                  description: 'Currency, currently supported: USD'
                  enum:
                    - USD
                partnerUserId:
                  type: string
                  description: >-
                    User unique identifier (e.g., userId). Used for risk
                    control. Must be real and valid, otherwise it will affect
                    the transaction. Format: digits, letters, or common symbols
                    -~!@#$%&*()_.
                  pattern: ^[A-Za-z0-9\-~!@#$%&*()_]+$
                recurringInterval:
                  type: string
                  description: Recurring cycle type D（day）,W（week）,M（month）,Y（year）
                  enum:
                    - D
                    - W
                    - M
                    - 'Y'
                recurringIntervalCount:
                  type: integer
                  description: Recurring cycle interval
                  minimum: 1
                recurringMaxNumber:
                  type: integer
                  description: >-
                    Maximum number of cycles. Regardless of cycle type, maximum
                    duration cannot exceed 3 years. Subscription will be
                    automatically canceled at expiration.
                  minimum: 1
                website:
                  type: string
                  description: Transaction website
                  format: uri
                retryTimes:
                  type: integer
                  description: Retry attempts for failed periodic deductions, default 3
                  minimum: 0
                  default: 3
                cancelUrl:
                  type: string
                  description: 用户取消支付URL，如果传递，用户可在支付页面点击返回到此页面
                  format: uri
                couponPeriod:
                  type: integer
                  description: >-
                    Discount Period (Currently only the first period discount
                    and the full period discount are supported, i.e.,
                    couponPeriod can only be equal to 1 or recurringMaxNumber)
                couponAmountPerPeriod:
                  type: string
                  description: Discount amount per period
                  pattern: ^\d+\.\d{2}$
                sign:
                  type: string
                  description: Signature
                paymentMethods:
                  type: string
                  description: >-
                    Supported payment methods list, separated by commas, e.g.,
                    CREDIT_CARD,GOOGLE_PAY,APPLE_PAY. Mutually exclusive with
                    inBankCode. Currently only supports the front-end component
                    combination mode.
              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 membership
              body: VIP membership monthly subscription
              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: normal, 0: exception'
                    default: '1'
                  error:
                    type: string
                    description: Error code
                    default: '00000000'
                  msg:
                    type: string
                    description: Error description
                    default: ''
                  data:
                    type: object
                    description: ''
                    properties:
                      subscriptionOrderId:
                        type: string
                        description: Merchant order ID
                      subscriptionOrderNo:
                        type: string
                        description: subscription order no.
                      payUrl:
                        type: string
                        description: payment URL
                    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.