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

> Create a coupon code for all products, specific categories, or specific products

> [!NOTE]
>
> Send `fixed_amount` and `minimum_cart_amount` in major currency units (for example `5` = SGD 5.00). Responses return them in minor units (`500`). `percentage` is a fraction: `0.15` = 15%.


## OpenAPI

````yaml post /v1/coupons
openapi: 3.1.1
info:
  title: HitPay API
  description: >-
    Accept PayNow, FPX, 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/coupons:
    post:
      summary: Create Coupon
      description: >-
        Create a coupon code customers can use at checkout. Amounts are sent in
        major currency units and returned in minor units (cents).
      operationId: create-coupon
      parameters:
        - name: X-BUSINESS-API-KEY
          in: header
          required: true
          style: simple
          explode: false
          schema:
            type: string
            example: b286daabf9921b5a01a4621f026c111e046f8911feba212996c92159b98427d
      requestBody:
        description: Coupon settings.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CouponRequest'
            example:
              name: Year End Sale
              code: YEAREND10
              fixed_amount: 5
              percentage: 0
              is_promo_banner: false
              coupons_left: 100
              coupon_type: 2
              applies_to_ids:
                - 9bd48afd-ed47-4bdb-aac0-388d6b25d199
              minimum_cart_amount: 20
              starts_at: '2026-11-01'
              ends_at: '2026-12-31'
      responses:
        '201':
          description: '201'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Coupon'
              examples:
                Result:
                  value:
                    id: a304f0fd-4ebb-4a8f-bc90-c7341f90080c
                    business_id: 98567029-f559-49f9-916b-042a4255b32a
                    name: Year End Sale
                    code: YEAREND10
                    fixed_amount: 500
                    percentage: 0
                    coupons_left: 100
                    is_promo_banner: false
                    banner_text: null
                    created_at: '2026-10-19T13:23:03.000000Z'
                    updated_at: '2026-10-19T13:23:03.000000Z'
                    starts_at: '2026-10-31T16:00:00.000000Z'
                    ends_at: '2026-12-30T16:00:00.000000Z'
                    coupon_type: 2
                    minimum_cart_amount: 2000
                    deleted_at: null
                    applies_to_ids:
                      - id: 9bd48afd-ed47-4bdb-aac0-388d6b25d199
                        name: Apparels
        '422':
          description: Validation error
          content:
            application/json:
              examples:
                Result:
                  value:
                    error_code: validation_error
                    message: >-
                      The given data was invalid. The code has already been
                      taken.
                    errors:
                      code:
                        - The code has already been taken.
      deprecated: false
components:
  schemas:
    CouponRequest:
      type: object
      required:
        - name
        - code
        - fixed_amount
        - percentage
        - is_promo_banner
        - coupon_type
        - minimum_cart_amount
      properties:
        name:
          type: string
          maxLength: 64
          description: Coupon name, shown in the dashboard.
          example: Year End Sale
        code:
          type: string
          maxLength: 64
          description: >-
            Code customers enter at checkout. Must be unique among the
            business's active coupons.
          example: YEAREND10
        fixed_amount:
          type: number
          minimum: 0
          maximum: 999999.99
          description: >-
            Fixed discount amount. Sent in major currency units (for example `5`
            = SGD 5.00). Responses return it in minor units (cents), for example
            `500`. Send `0` for a percentage-only coupon. `fixed_amount` and
            `percentage` cannot both be `0`.
          example: 5
        percentage:
          type: number
          minimum: 0
          maximum: 1
          description: >-
            Percentage discount as a fraction, up to 4 decimal places (`0.15` =
            15%). Send `0` for a fixed-amount-only coupon.
          example: 0
        is_promo_banner:
          type: boolean
          description: >-
            Show this coupon in the store's promo banner. Setting it to `true`
            turns the banner off for every other coupon and discount of the
            business.
          example: false
        banner_text:
          type:
            - string
            - 'null'
          maxLength: 1000
          description: Text for the promo banner.
          example: null
        coupons_left:
          type:
            - integer
            - 'null'
          description: >-
            How many times the coupon can still be used. Omit or send `null` for
            unlimited.
          example: 100
        coupon_type:
          type: integer
          enum:
            - 1
            - 2
            - 3
          description: >-
            What the coupon applies to: `1` = all products, `2` = specific
            categories, `3` = specific products.
          example: 2
        applies_to_ids:
          type: array
          items:
            type: string
            maxLength: 36
          description: >-
            Category IDs (`coupon_type` 2) or product IDs (`coupon_type` 3).
            Required for types 2 and 3, ignored for type 1.
          example:
            - 9bd48afd-ed47-4bdb-aac0-388d6b25d199
        minimum_cart_amount:
          type: number
          minimum: 0
          description: >-
            Minimum cart amount for the coupon to apply. Sent in major currency
            units (for example `5` = SGD 5.00). Responses return it in minor
            units (cents), for example `500`.
          example: 20
        starts_at:
          type:
            - string
            - 'null'
          format: date
          description: >-
            When the coupon becomes valid, read in the business's timezone. Omit
            for no start date.
          example: '2026-11-01'
        ends_at:
          type:
            - string
            - 'null'
          format: date
          description: >-
            When the coupon expires, read in the business's timezone. Must be on
            or after `starts_at`. Omit for no end date.
          example: '2026-12-31'
    Coupon:
      type: object
      properties:
        id:
          type: string
          format: uuid
        business_id:
          type: string
          format: uuid
        name:
          type: string
        code:
          type: string
        fixed_amount:
          type: integer
          description: Fixed discount in minor units (cents).
        percentage:
          type: number
          description: Percentage discount as a fraction (`0.15` = 15%).
        coupons_left:
          type:
            - integer
            - 'null'
          description: Remaining uses; `null` = unlimited.
        is_promo_banner:
          type: boolean
        banner_text:
          type:
            - string
            - 'null'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        starts_at:
          type:
            - string
            - 'null'
          format: date-time
          description: UTC.
        ends_at:
          type:
            - string
            - 'null'
          format: date-time
          description: UTC.
        coupon_type:
          type: integer
          enum:
            - 1
            - 2
            - 3
        minimum_cart_amount:
          type: integer
          description: Minimum cart amount in minor units (cents).
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
        applies_to_ids:
          type: array
          description: >-
            Categories or products the coupon applies to. Empty for
            `coupon_type` 1.
          items:
            type: object
            properties:
              id:
                type: string
              name:
                type: string

````

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