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

# Create Invoice

> Endpoint used to create invoices

> [!NOTE]
>
> The setting to charge admin fee and channel fee to the customer does not
> apply to the Invoice feature.

```bash Request Example theme={null}
curl --request POST 'https://api.mayar.id/hl/v1/invoice/create' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data-raw '{
        "name": "andre jago",
        "email": "alikusnadide@gmail.com",
        "mobile": "085797522261",
        "redirectUrl": "https://kelaskami.com/nexst23",
        "description": "testing dulu pak",
        "expiredAt": "2026-04-19T16:43:23.000Z",
        "items":[{
            "quantity": 3,
            "rate": 11000,
            "description": "1e 1 sayam jago"
        }],
        "extraData": {
            "noCustomer": "827hiueqy271hj",
            "idProd": "contoh aja"
        }
    }
```

```json Response Example 200 theme={null}
{
    "statusCode": 200,
    "messages": "success",
    "data": {
        "id": "df65d192-8396-4f9a-b4e5-8244648c07c5",
        "transactionId": "ca87fd13-8742-4d48-af33-7de1a417bc34",
        "link": "https://korban-motivator.mayar.shop/invoices/ycfyxbj2h3",
        "expiredAt": 1776617003000,
        "extraData": {
            "noCustomer": "827hiueqy271hj",
            "idProd": "contoh aja"
        }
    }
}
```

Endpoint:

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

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

## Authorization

**Authorization** `string` *required*

Example:

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

## Request Body

**name** `string` *required*

Full name of the customer.

**email** `string` *required*

Email address of the customer.

**mobile** `string` *required*

Mobile phone number of the customer.

**redirectUrl** `string` *required*

URL where the customer will be redirected after completing the payment.

**description** `string` *required*

Description or notes related to the invoice.

**expiredAt** `string` *required*

Invoice expiration time in ISO 8601 format (UTC).

**items** `array` *required*

List of invoice items.

**items\[].quantity** `number` *required*

Quantity of the item.

**items\[].rate** `number` *required*

Price per item.

**items\[].description** `string` *required*

Description of the item.

**extraData** `object` *required*

Additional custom data attached to the invoice.

**extraData.noCustomer** `string` *required*

Custom customer reference number.

**extraData.idProd** `string` *required*

Custom product identifier associated with the invoice.

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

The main data returned (invoice details).

### data Structure (Array Of Object)

**data.id** `string`

Unique identifier of the invoice record.

**data.transactionId** `string`

Unique identifier of the associated transaction.

**data.link** `string`

Invoice URL that can be accessed by the customer.

**data.expiredAt** `number`

Timestamp (in milliseconds) indicating when the invoice will expire.

**data.extraData** `object`

Additional custom data attached to the invoice.

**data.extraData.noCustomer** `string`

Custom customer reference number.

**data.extraData.idProd** `string`

Custom product identifier associated with the invoice.


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