Skip to main content
curl --request POST 'https://api.mayar.id/hl/v2/credit/customer/spend' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data-raw '{
    "customerId": "a1b2c3d4-e5f6-4789-a012-3456789abcde",
    "productId": "7c9d2e1f-4a5b-4c6d-8e9f-0a1b2c3d4e5f",
    "amount": 10000
}'
{
    "statusCode": 200,
    "messages": "success",
    "data": {
        "customerNewBalance": 90000
    }
}
Endpoint:
https://api.mayar.id/hl/v2/credit/customer/spend

Authorization

Authorization
string
required
Example:Authorization | Bearer Paste-Your-API-Key-Here

Request Body

customerId
string
required
The unique identifier of the customer whose credit will be spent.
productId
string
required
The unique identifier of the credit-based or membership product.
membershipTierId
string
The unique identifier of the membership tier (required when the product is a membership product with multiple tiers).
amount
integer
required
The amount of credit to spend. Must be a positive integer not exceeding the customer’s available balance.

Response

Successful Response

Main Structure (Root)

statusCode
integer
Status code from the API.
messages
string
Status message that describes the status code.
data
object
The spend result object.
data.customerNewBalance
integer
The customer’s remaining balance after the spend operation.

Errors

400 Insufficient balance
object
Returned when the customer does not have enough credit to spend the requested amount.
400 Validation Error
object
Returned when required fields are missing or the amount is invalid.