Skip to main content
curl --request POST 'https://api.mayar.id/hl/v2/invoices/create' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--data-raw '{
        "name": "Budi Santoso",
        "email": "budi.santoso@example.com",
        "mobile": "081234567890",
        "description": "Pelunasan pesanan",
        "expiredAt": "2026-07-19T16:43:23.000Z",
        "items": [
            {
                "quantity": 3,
                "rate": 11000,
                "description": "Paket layanan A"
            }
        ],
        "extraData": {
            "noCustomer": "827hiueqy271hj",
            "idProd": "contoh aja"
        }
    }'
{
    "statusCode": 200,
    "messages": "success",
    "data": {
        "id": "6f8c19ff-5b97-4792-aa89-d2a12797b356",
        "transactionId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
        "link": "https://testingmayar.myr.id/invoices/ycfyxbj2h3",
        "expiredAt": 1784479403000,
        "extraData": {
            "noCustomer": "827hiueqy271hj",
            "idProd": "contoh aja"
        }
    }
}
Endpoint:
https://api.mayar.id/hl/v2/invoices/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.
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.
description
string
Description or notes related to the invoice.
expiredAt
string
Invoice expiration time in ISO 8601 format (UTC).
tax
integer
Tax amount applied to the invoice.
paymentMethod
string
Restrict the invoice to a specific payment method.
cashtag
string
Cashtag associated with the invoice.
extraData
object
Additional custom data attached to the invoice.

Response

Successful Response

Main Structure (Root)

statusCode
integer
Status code form API.
messages
string
Status message that describes the status code.
data
object
The created invoice data.

data Structure (Object)

data.id
string
Unique identifier of the invoice record.
data.transactionId
string
Unique identifier of the associated transaction.
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 (echoed from the request).

Errors

400 Bad Request
object
Returned when the request body fails validation: { "statusCode": 400, "messages": "Validation Error" } or { "statusCode": 400, "messages": "extraData Validation Error" }.
404 Not Found
object
Returned when the customer could not be found or created: { "statusCode": 404, "messages": "Customer not found and failed to create new customer" }.
409 Conflict
object
Returned when an invoice with the same identifier already exists: { "statusCode": 409, "messages": "already exist" }.
429 Too Many Requests
object
Returned when a duplicate create request is detected: { "statusCode": 429, "messages": "Duplicate request detected. Please wait 1 minute before trying again." }.