HitPay Subscription Plan API

The Subscription Plan API from HitPay — 2 operation(s) for subscription plan.

OpenAPI Specification

hitpay-subscription-plan-api-openapi.yml Raw ↑
openapi: 3.1.1
info:
  title: HitPay Account Status Subscription Plan 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
tags:
- name: Subscription Plan
paths:
  /v1/subscription-plan:
    get:
      summary: Get All Subscription Plan
      description: Use this API to get all subscription plans details.
      operationId: get-all-subscription-plan
      parameters:
      - name: X-BUSINESS-API-KEY
        in: header
        required: true
        style: simple
        explode: false
        schema:
          type: string
          example: b286daabf9921b5a01a4621f026c111e046f8911feba212996c92159b98427d
      - name: per_page
        in: query
        description: The number of per page
        schema:
          type: number
          default: 20
      - name: page
        in: query
        description: The page index
        schema:
          type: number
          default: 1
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"data\": [\n        {\n            \"id\": \"975b1909-38f6-44f3-a0b1-c198b7478978\",\n            \"name\": \"subscription-plan_new_1664175178\",\n            \"description\": \"New_Description_1664175178\",\n            \"cycle\": \"custom\",\n            \"cycle_repeat\": 1,\n            \"cycle_frequency\": \"day\",\n            \"currency\": \"sgd\",\n            \"price\": 123.45,\n            \"amount\": 123.45,\n            \"reference\": null,\n            \"created_at\": \"2022-09-26T14:52:58\",\n            \"updated_at\": \"2022-09-26T14:52:58\"\n        },\n        {\n            \"id\": \"97533e84-4f48-4625-83de-1d2b3e3ae17b\",\n            \"name\": \"subscription-plan_new_1663837869\",\n            \"description\": \"New_Description_1663837869\",\n            \"cycle\": \"custom\",\n            \"cycle_repeat\": 1,\n            \"cycle_frequency\": \"day\",\n            \"currency\": \"sgd\",\n            \"price\": 9999999.99,\n            \"amount\": 9999999.99,\n            \"reference\": null,\n            \"created_at\": \"2022-09-22T17:11:09\",\n            \"updated_at\": \"2022-09-22T17:11:09\"\n        }\n    ],\n    \"links\": {\n        \"first\": \"https://api.sandbox.hit-pay.com/v1/subscription-plan?page=1\",\n        \"last\": \"https://api.sandbox.hit-pay.com/v1/subscription-plan?page=1\",\n        \"prev\": null,\n        \"next\": null\n    },\n    \"meta\": {\n        \"current_page\": 1,\n        \"from\": 1,\n        \"last_page\": 1,\n        \"links\": [\n            {\n                \"url\": null,\n                \"label\": \"« Previous\",\n                \"active\": false\n            },\n            {\n                \"url\": \"https://api.sandbox.hit-pay.com/v1/subscription-plan?page=1\",\n                \"label\": \"1\",\n                \"active\": true\n            },\n            {\n                \"url\": null,\n                \"label\": \"Next »\",\n                \"active\": false\n            }\n        ],\n        \"path\": \"https://api.sandbox.hit-pay.com/v1/subscription-plan\",\n        \"per_page\": 25,\n        \"to\": 2,\n        \"total\": 2\n    }\n}"
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          examples:
                          - 975b1909-38f6-44f3-a0b1-c198b7478978
                        name:
                          type: string
                          examples:
                          - subscription-plan_new_1664175178
                        description:
                          type: string
                          examples:
                          - New_Description_1664175178
                        cycle:
                          type: string
                          examples:
                          - custom
                        cycle_repeat:
                          type: integer
                          examples:
                          - 1
                          default: 0
                        cycle_frequency:
                          type: string
                          examples:
                          - day
                        currency:
                          type: string
                          examples:
                          - sgd
                        price:
                          type: number
                          examples:
                          - 123.45
                          default: 0
                        amount:
                          type: number
                          examples:
                          - 123.45
                          default: 0
                        reference: {}
                        created_at:
                          type: string
                          examples:
                          - '2022-09-26T14:52:58'
                        updated_at:
                          type: string
                          examples:
                          - '2022-09-26T14:52:58'
                  links:
                    type: object
                    properties:
                      first:
                        type: string
                        examples:
                        - https://api.sandbox.hit-pay.com/v1/subscription-plan?page=1
                      last:
                        type: string
                        examples:
                        - https://api.sandbox.hit-pay.com/v1/subscription-plan?page=1
                      prev: {}
                      next: {}
                  meta:
                    type: object
                    properties:
                      current_page:
                        type: integer
                        examples:
                        - 1
                        default: 0
                      from:
                        type: integer
                        examples:
                        - 1
                        default: 0
                      last_page:
                        type: integer
                        examples:
                        - 1
                        default: 0
                      links:
                        type: array
                        items:
                          type: object
                          properties:
                            url: {}
                            label:
                              type: string
                              examples:
                              - '« Previous'
                            active:
                              type: boolean
                              examples:
                              - false
                              default: true
                      path:
                        type: string
                        examples:
                        - https://api.sandbox.hit-pay.com/v1/subscription-plan
                      per_page:
                        type: integer
                        examples:
                        - 25
                        default: 0
                      to:
                        type: integer
                        examples:
                        - 2
                        default: 0
                      total:
                        type: integer
                        examples:
                        - 2
                        default: 0
      deprecated: false
      security: []
      x-readme:
        code-samples:
        - language: curl
          code: 'curl --location --request GET ''https://api.sandbox.hit-pay.com/v1/subscription-plan'' \

            --header ''X-BUSINESS-API-KEY: meowmeowmeow'' \

            --header ''X-Requested-With: XMLHttpRequest'' \

            --header ''Content-Type: application/x-www-form-urlencoded'''
        samples-languages:
        - curl
      tags:
      - 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: "{\n    \"id\": \"973ee344-6737-4897-9929-edbc9d7bf433\",\n    \"name\": \"Spotify Premium\",\n    \"description\": \"Spotify Monthly Subscription\",\n    \"cycle\": \"monthly\",\n    \"cycle_repeat\": null,\n    \"cycle_frequency\": null,\n    \"currency\": \"sgd\",\n    \"amount\": 9.90,\n    \"reference\": \"spotify_premium_2022\",\n    \"created_at\": \"2022-09-12T14:19:26\",\n    \"updated_at\": \"2022-09-12T14:19:26\"\n}"
              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: "{\n    \"message\": \"The given data was invalid.\",\n    \"errors\": {\n        \"name\": [\n            \"The name field is required.\"\n        ],\n        \"amount\": [\n            \"The amount field is required.\"\n        ],\n        \"cycle\": [\n            \"The cycle field is required.\"\n        ]\n    }\n}"
              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: []
      x-readme:
        code-samples:
        - language: curl
          code: 'curl --location --request POST ''https://api.sandbox.hit-pay.com/v1/subscription-plan'' \

            --header ''X-BUSINESS-API-KEY: meowmeowmeow'' \

            --header ''X-Requested-With: XMLHttpRequest'' \

            --header ''Content-Type: application/x-www-form-urlencoded'' \

            --data-urlencode ''name=Spotify Premium'' \

            --data-urlencode ''description=Spotify Monthly Subscription'' \

            --data-urlencode ''currency=SGD'' \

            --data-urlencode ''amount=9.90''

            --data-urlencode ''cycle=monthly'' \

            --data-urlencode ''reference=spotify_premium_2022'' \'
        samples-languages:
        - curl
      tags:
      - Subscription Plan
  /v1/subscription-plan/{plan_id}:
    get:
      summary: Get Subscription Plan Details
      description: Use this API to get the subscription plan details, if you need to make any changes use the Update a Subscription Plan API
      operationId: get-a-subscription-plan-detail
      parameters:
      - name: X-BUSINESS-API-KEY
        in: header
        required: true
        style: simple
        explode: false
        schema:
          type: string
          example: b286daabf9921b5a01a4621f026c111e046f8911feba212996c92159b98427d
      - name: plan_id
        in: path
        schema:
          type: string
        required: true
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"id\": \"973ee344-6737-4897-9929-edbc9d7bf433\",\n    \"name\": \"Spotify Premium\",\n    \"description\": \"Spotify Monthly Subscription\",\n    \"cycle\": \"monthly\",\n    \"cycle_repeat\": null,\n    \"cycle_frequency\": null,\n    \"currency\": \"sgd\",\n    \"amount\": 9.9,\n    \"reference\": \"spotify_premium_2022\",\n    \"created_at\": \"2022-09-12T14:22:26\",\n    \"updated_at\": \"2022-09-12T14:22:26\"\n}"
              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:22:26'
                  updated_at:
                    type: string
                    examples:
                    - '2022-09-12T14:22:26'
        '422':
          description: '422'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"message\": \"No query results for model [App\\\\Business\\\\SubscriptionPlan] 973ee456-d28f-4418-93c5-d37e4b311685\"\n}"
              schema:
                type: object
                properties:
                  message:
                    type: string
                    examples:
                    - No query results for model [App\Business\SubscriptionPlan] 973ee456-d28f-4418-93c5-d37e4b311685
      deprecated: false
      security: []
      x-readme:
        code-samples:
        - language: curl
          code: 'curl --location --request GET ''https://api.sandbox.hit-pay.com/v1/subscription-plan/{plan_id}'' \

            --header ''X-BUSINESS-API-KEY: meowmeowmeow'' \

            --header ''X-Requested-With: XMLHttpRequest'' \

            --header ''Content-Type: application/x-www-form-urlencoded'''
        samples-languages:
        - curl
      tags:
      - Subscription Plan
    put:
      summary: Update Subscription Plan
      description: Use this API to update the subscription plan, changes made to the plan will not affect current subscription. If you would like to make changes to the current subscriptions use the Update Recurring Billing API.
      operationId: update-recurring-billing-plan
      parameters:
      - name: X-BUSINESS-API-KEY
        in: header
        required: true
        style: simple
        explode: false
        schema:
          type: string
          example: b286daabf9921b5a01a4621f026c111e046f8911feba212996c92159b98427d
      - name: plan_id
        in: path
        schema:
          type: string
        required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
              - name
              - cycle
              - amount
              properties:
                name:
                  type: string
                  description: Plan name. It's required field
                amount:
                  type: integer
                  description: 'Min: Depend on the currency, Max: 999999.99. It''s required field'
                  maximum: 999999.99
                  format: int32
                description:
                  type: string
                  description: The description of subscription plan
                cycle:
                  type: string
                  description: Billing frequency (weekly / monthly / yearly / custom / save_card). If cycle = custom then the user has to send the fields cycle_repeat and cycle_frequency
                  enum:
                  - weekly
                  - monthly
                  - yearly
                  - custom
                  - save_card
                  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
                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
                  minimum: 1
                  maximum: 100
      responses:
        '200':
          description: '200'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"id\": \"973ee344-6737-4897-9929-edbc9d7bf433\",\n    \"name\": \"Spotify Premium\",\n    \"description\": \"Spotify Monthly Subscription\",\n    \"cycle\": \"monthly\",\n    \"cycle_repeat\": null,\n    \"cycle_frequency\": null,\n    \"currency\": \"sgd\",\n    \"amount\": 12.9,\n    \"reference\": \"spotify_premium_2022\",\n    \"created_at\": \"2022-09-13T12:34:13\",\n    \"updated_at\": \"2022-09-13T12:34:13\"\n}"
              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:
                    - 12.9
                    default: 0
                  reference:
                    type: string
                    examples:
                    - spotify_premium_2022
                  created_at:
                    type: string
                    examples:
                    - '2022-09-13T12:34:13'
                  updated_at:
                    type: string
                    examples:
                    - '2022-09-13T12:34:13'
        '422':
          description: '422'
          content:
            application/json:
              examples:
                Result:
                  value: "{\n    \"message\": \"The given data was invalid.\",\n    \"errors\": {\n        \"name\": [\n            \"The name may not be greater than 128 characters.\"\n        ]\n    }\n}"
              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 may not be greater than 128 characters.
            text/plain:
              examples:
                Result:
                  value: "{\n    \"message\": \"The given data was invalid.\",\n    \"errors\": {\n        \"cycle_repeat\": [\n            \"The cycle repeat field is required when cycle is custom.\"\n        ],\n        \"cycle_frequency\": [\n            \"The cycle frequency field is required when cycle is custom.\"\n        ]\n    }\n}"
              schema:
                type: object
                properties:
                  message:
                    type: string
                    examples:
                    - The given data was invalid.
                  errors:
                    type: object
                    properties:
                      cycle_repeat:
                        type: array
                        items:
                          type: string
                          examples:
                          - The cycle repeat field is required when cycle is custom.
                      cycle_frequency:
                        type: array
                        items:
                          type: string
                          examples:
                          - The cycle frequency field is required when cycle is custom.
      deprecated: false
      security: []
      x-readme:
        code-samples:
        - language: curl
          code: 'curl --location --request PUT ''https://api.sandbox.hit-pay.com/v1/subscription-plan/{plan_id}'' \

            --header ''X-BUSINESS-API-KEY: meowmeowmeow'' \

            --header ''X-Requested-With: XMLHttpRequest'' \

            --header ''Content-Type: application/x-www-form-urlencoded'' \

            --data-urlencode ''amount=12.90'''
        samples-languages:
        - curl
      tags:
      - Subscription Plan
    delete:
      summary: Delete Subscription Plan
      description: Delete the Subscription plan
      operationId: delete-subscription
      parameters:
      - name: X-BUSINESS-API-KEY
        in: header
        required: true
        style: simple
        explode: false
        schema:
          type: string
          example: b286daabf9921b5a01a4621f026c111e046f8911feba212996c92159b98427d
      - name: plan_id
        in: path
        description: The subscription id
        schema:
          type: string
        required: true
      responses:
        '204':
          description: '204'
          content:
            application/json:
              examples:
                Result:
                  value: '1'
              schema:
                type: integer
                example: 1
      deprecated: false
      security: []
      x-readme:
        code-samples:
        - language: curl
          code: 'curl --location --request DELETE ''https://api.sandbox.hit-pay.com/v1/subscription-plan/99e64cc6-2860-4c54-a92d-1509aa9e2362'' \

            --header ''X-BUSINESS-API-KEY: meowmeowmeow'' \

            --header ''X-Requested-With: XMLHttpRequest'' \

            --header ''Content-Type: application/x-www-form-urlencoded'''
          name: Example
        samples-languages:
        - curl
      tags:
      - Subscription Plan
x-readme:
  headers: []
  explorer-enabled: true
  proxy-enabled: true
  samples-enabled: true
x-readme-fauxas: true