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

# Create Subscription Plan

> Create a subscription plan with name, amount, and billing frequency



## OpenAPI

````yaml post /v1/subscription-plan
openapi: 3.1.1
info:
  title: HitPay API
  description: >-
    Accept PayNow, FPX, QRIS, GrabPay, cards, and 40+ payment methods with a
    single API. Production base URL: https://api.hit-pay.com, Sandbox:
    https://api.sandbox.hit-pay.com
  version: '1.0'
servers:
  - url: https://api.hit-pay.com
    description: Production
  - url: https://api.sandbox.hit-pay.com
    description: Sandbox
security: []
paths:
  /v1/subscription-plan:
    post:
      summary: Create a Subscription Plan
      description: >-
        A subscription plan consists of basic information like plan name,
        amount, and frequency. An example of a subscription plan could be
        “Spotify Premium Membership” which is SGD 9.90 monthly.
      operationId: create-subscription-plan
      parameters:
        - name: X-BUSINESS-API-KEY
          in: header
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: b286daabf9921b5a01a4621f026c111e046f8911feba212996c92159b98427d
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - cycle
                - amount
              properties:
                name:
                  type: string
                  description: Plan name. It's required field
                description:
                  type: string
                  description: The description of subscription plan
                cycle:
                  type: string
                  description: >-
                    Billing frequency (weekly / monthly / yearly / custom). If
                    cycle = custom then the user has to send the fields
                    cycle_repeat and cycle_frequency
                  enum:
                    - weekly
                    - monthly
                    - yearly
                    - custom
                  default: monthly
                cycle_frequency:
                  type: string
                  description: >-
                    [This field is only applicable when cycle = custom] It's the
                    frequency of the cycle [day / week / month / year]
                  enum:
                    - day
                    - week
                    - month
                    - year
                cycle_repeat:
                  type: integer
                  description: >-
                    [This field is only applicable when cycle = custom] It's the
                    number of times the cycle will repeat.
                  format: int32
                currency:
                  type: string
                  example: SGD
                amount:
                  type: integer
                  description: >-
                    Min: Depend on the currency, Max: 999999.99. It's required
                    field
                  maximum: 999999.99
                  format: int32
                reference:
                  type: string
                  maxLength: 255
                  description: >-
                    Arbitrary reference number that you can map to your internal
                    reference number. This value cannot be edited by the
                    customer
                redirect_url:
                  type: string
                  description: The redirected URL after the payment
                start_date_method:
                  type: string
                  enum:
                    - sign_up_date
                    - customer_select_date
                    - fixed_date
                fixed_date:
                  type: number
                  minimum: 1
                  maximum: 28
                  description: it's required if start_date_method = fixed_date
                times_to_be_charged:
                  type: number
                  default: 1
                  minimum: 1
                  maximum: 100
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: |-
                    {
                        "id": "973ee344-6737-4897-9929-edbc9d7bf433",
                        "name": "Spotify Premium",
                        "description": "Spotify Monthly Subscription",
                        "cycle": "monthly",
                        "cycle_repeat": null,
                        "cycle_frequency": null,
                        "currency": "sgd",
                        "amount": 9.90,
                        "reference": "spotify_premium_2022",
                        "created_at": "2022-09-12T14:19:26",
                        "updated_at": "2022-09-12T14:19:26"
                    }
              schema:
                type: object
                properties:
                  id:
                    type: string
                    examples:
                      - 973ee344-6737-4897-9929-edbc9d7bf433
                  name:
                    type: string
                    examples:
                      - Spotify Premium
                  description:
                    type: string
                    examples:
                      - Spotify Monthly Subscription
                  cycle:
                    type: string
                    examples:
                      - monthly
                  cycle_repeat: {}
                  cycle_frequency: {}
                  currency:
                    type: string
                    examples:
                      - sgd
                  amount:
                    type: number
                    examples:
                      - 9.9
                    default: 0
                  reference:
                    type: string
                    examples:
                      - spotify_premium_2022
                  created_at:
                    type: string
                    examples:
                      - '2022-09-12T14:19:26'
                  updated_at:
                    type: string
                    examples:
                      - '2022-09-12T14:19:26'
        '422':
          description: '422'
          content:
            application/json:
              examples:
                Result:
                  value: |-
                    {
                        "message": "The given data was invalid.",
                        "errors": {
                            "name": [
                                "The name field is required."
                            ],
                            "amount": [
                                "The amount field is required."
                            ],
                            "cycle": [
                                "The cycle field is required."
                            ]
                        }
                    }
              schema:
                type: object
                properties:
                  message:
                    type: string
                    examples:
                      - The given data was invalid.
                  errors:
                    type: object
                    properties:
                      name:
                        type: array
                        items:
                          type: string
                          examples:
                            - The name field is required.
                      amount:
                        type: array
                        items:
                          type: string
                          examples:
                            - The amount field is required.
                      cycle:
                        type: array
                        items:
                          type: string
                          examples:
                            - The cycle field is required.
      deprecated: false
      security: []

````