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

> This endpoint is used to add credit to a customer’s or member’s account on particular membership tier.

```bash Request Example theme={null}
curl --request POST 'https://api.mayar.id/credit/v1/credit/customer/add-credit' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data '{
    "memberId" : "KKGOL1MV", // optionally mandatory
    "productId": "40f26fbe-f4d8-4693-975f-e6d105d291e6",
    "membershipTierId": "9bbbfa01-1bf8-4e4d-8470-cdf7066b6ea2",
    "amount": 100
}'
```

```json Response Example 200 theme={null}
{
    "statusCode": 200,
    "message": "success",
    "customerId": "faa4ee60-cf45-4043-b964-303890713bb9",
    "productId": "40f26fbe-f4d8-4693-975f-e6d105d291e6",
    "membershipTierId": "9bbbfa01-1bf8-4e4d-8470-cdf7066b6ea2",
    "amount": 100,
    "customerBalance": 911090
}
```

Endpoint:

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

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

## Authorization

**Authorization** `string` *required*

Example:

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

## Request Body

**memberId** `string`

The unique identifier of the customer whose credit will be spent.

**customerId** `string`

The unique identifier of the member whose credit will be spent.

**productId** `string` *required*

The unique identifier of the product associated with the credit.

**membershipTierId** `string` *required*

The unique identifier of the membership tier associated with the credit.

**amount** `integer` *required*

The amount of credit to deduct (positive integer).

> [!NOTE]
>
> At least **one of** `customerId` **or** `memberId` must be provided.

## Response

Successful Response

**statusCode** `integer`

Status code form API.

**messages** `string`

Status message that describes the status code.

**customerId** `string`

The unique identifier of the customer to whom the credit be added.

**productId** `string`

The unique identifier of the product associated with the credit added.

**membershipTierId** `string`

The unique identifier of the membership tier associated with the credit added.

**amount** `string`

The amount of credit to add (positive integer).

**customerBalance** `string`

The amount of credit balance after adding credit.


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