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

# Subscription Application

> Create subscription order

<div class="flex flex-col gap-4">
  <div class="api-section-heading flex flex-col gap-y-4 w-full">
    <div class="flex items-baseline border-b pb-2.5 border-gray-100 dark:border-gray-800 w-full">
      <h4 class="api-section-heading-title flex-1 mb-0">Secret Key & Private Key (Generate Signature)</h4>
    </div>

    <div />
  </div>

  <input id="secret-key" placeholder="Secret Key" class="px-3 py-2 border rounded-md" />

  <input id="private-key" placeholder="Private Key" class="px-3 py-2 border rounded-md" />
</div>

## Related Topics

* [Subscription Payment API](/docs/en/api/version2/Subscription)
* [HaiPay API Reference Overview](/docs/en/api-reference/overview)
* [HaiPay Configuration and Signature Guide](/docs/en/guide/config_settings_and_signature_rules_guide)


## 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: '0.5'
              callBackUrl: https://www.google.com
              appId: 10245
              partnerUserId: '123456'
              currency: USD
              name: John Doe
              phone: '1234567890'
              email: test@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: '1234567890'
                  subscriptionOrderNo: '1234567890'
                  payUrl: https://test.com
          headers: {}
      deprecated: false
      security: []

````