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

# Add Customer Credit

> Endpoint for merchants to top-up (add) credit to a customer's add-on wallet.

```bash Request Example theme={null}
curl --request POST 'https://api.mayar.id/credit/v2/credit/customer/add-credit' \
--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": 50000
}'
```

```json Response Example 200 theme={null}
{
    "statusCode": 200,
    "messages": "success",
    "data": {
        "customerNewBalance": 150000
    }
}
```

Endpoint:

```Production Production theme={null}
https://api.mayar.id/credit/v2/credit/customer/add-credit
```

```Sandbox Sandbox theme={null}
https://api.mayar.io/credit/v2/credit/customer/add-credit
```

## Authorization

**Authorization** `string` *required*

Example:

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

## Request Body

**customerId** `string` *required*

The unique identifier of the customer to add credit to.

**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 add to the customer's add-on wallet. Must be a positive integer.

## 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 top-up result object.

**data.customerNewBalance** `integer`

The customer's updated total balance after the top-up.

## Errors

**400 Validation Error** `object`

Returned when required fields are missing or the amount is invalid.

**400 Unauthorized** `object`

Returned when the API key does not have access to the specified product.


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