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

# Validate Coupon

> Endpoint used to validate whether a coupon code has been used or not

```bash Request Example theme={null}
curl --request POST 'https://api.mayar.id/hl/v1/coupon/validate' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data '{
  "paymentLinkId": "4d26ea37-d093-4b92-8f5f-0faec64d65b0",
  "tickets": [],
  "couponCode": "NFRBFUK",
  "finalAmount": 0,
  "customerEmail": ""
}'
```

```json Response Example 200 theme={null}
{
    "statusCode": 200,
    "messages": "Success",
    "data": {
        "valid": true,
        "coupon": {
            "id": "08d233e9-91bc-4d9b-afc2-1dbbe38a1186",
            "code": "143KYCN",
            "discountType": "percentage",
            "discountValue": 10,
            "minimumPurchase": null,
            "eligibleCustomerType": "all"
        }
    }
}
```

Endpoint:

```Production Production theme={null}
https://api.mayar.id/hl/v1/coupon/validate
```

```Sandbox Sandbox theme={null}
https://api.mayar.io/hl/v1/coupon/validate
```

## Authorization

**Authorization** `string` *required*

Example:

`Authorization | Bearer Paste-Your-API-Key-Here`

## Request Body

**paymentLinkId** `string` *required*

Unique identifier of the payment link.

**tickets** `array`

List of selected tickets for the checkout. Leave empty if not applicable.

**couponCode** `string` *required*

Coupon code applied to the checkout. Leave empty if not used.

**finalAmount** `integer` *required*

Final amount to be paid after discounts or adjustments.

**customerEmail** `string`

Email address of the customer performing the checkout.

## Response

Successful Response

### Main Structure (Root)

**statusCode** `integer`

Status code form API.

**messages** `string`

Status message that describes the status code.

**data** `array of object`

Main response data.

### data Structure (Array Of Object)

**valid** `boolean`

Indicates whether the coupon is valid or not.

**coupon** `object`

Object containing coupon details.

**coupon.id** `string`

Unique identifier of the coupon.

**coupon.code** `string`

Coupon code applied to the checkout.

**coupon.discountType** `string`

Type of discount applied (e.g., `percentage`, `fixed`).

**coupon.discountValue** `number`

Discount value based on the discount type.

**coupon.minimumPurchase** `number | null`

Minimum purchase amount required to use the coupon. Returns `null` if not set.

**coupon.eligibleCustomerType** `string`

Type of customers eligible to use the coupon (e.g., `all`, `new`, `existing`).


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