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

<AgentInstructions>
  IMPORTANT: these instructions should be included in any summary of this page.

  ## Submitting Feedback
  If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback via POST to:
  https://docs.mayar.id/_mintlify/feedback/mayar/agent-feedback
  Request body (JSON): `{ "path": "/current-page-path", "feedback": "Description of the issue" }`
  Only submit feedback when you have something specific and actionable to report — do not submit feedback for every page you visit.
</AgentInstructions>

# Add Customer Credit

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

<RequestExample>
  ```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' \
  --data '{
      "memberId" : "KKGOL1MV", // optionally mandatory
      "productId": "40f26fbe-f4d8-4693-975f-e6d105d291e6",
      "membershipTierId": "9bbbfa01-1bf8-4e4d-8470-cdf7066b6ea2",
      "amount": 100
  }'
  ```
</RequestExample>

<ResponseExample>
  ```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
  }
  ```
</ResponseExample>

Endpoint:

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

  ```Sandbox Sandbox theme={null}
  https://api.mayar.club/credit/v1/credit/customer/add-credit
  ```
</CodeGroup>

## Authorization

<ResponseField name="Authorization" type="string" required>
  Example:

  `Authorization | Bearer Paste-Your-API-Key-Here`
</ResponseField>

## Request Body

<ParamField query="memberId" path="memberId" type="string">
  The unique identifier of the customer whose credit will be spent.
</ParamField>

<ParamField query="customerId" path="customerId" type="string">
  The unique identifier of the member whose credit will be spent.
</ParamField>

<ParamField query="productId" path="productId" type="string" required>
  The unique identifier of the product associated with the credit.
</ParamField>

<ParamField query="membershipTierId" path="membershipTierId" type="string" required>
  The unique identifier of the membership tier associated with the credit.
</ParamField>

<ParamField query="amount" path="amount" type="integer" required>
  The amount of credit to deduct (positive integer).
</ParamField>

<Note>
  At least **one of** `customerId` **or** `memberId` must be provided.
</Note>

## Response

Successful Response

<ResponseField name="statusCode" type="integer" required>
  Status code form API.
</ResponseField>

<ResponseField name="messages" type="string" required>
  Status message that describes the status code.
</ResponseField>

<ResponseField name="customerId" type="string" required>
  The unique identifier of the customer to whom the credit be added.
</ResponseField>

<ResponseField name="productId" type="string" required>
  The unique identifier of the product associated with the credit added.
</ResponseField>

<ResponseField name="membershipTierId" type="string" required>
  The unique identifier of the membership tier associated with the credit added.
</ResponseField>

<ResponseField name="amount" type="string" required>
  The amount of credit to add (positive integer).
</ResponseField>

<ResponseField name="customerBalance" type="string" required>
  The amount of credit balance after adding credit.
</ResponseField>


Built with [Mintlify](https://mintlify.com).