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

# Regist New Customer

> This endpoint is used to register new customers into the membership credit product.

<RequestExample>
  ```bash Request Example theme={null}
  curl --request POST 'https://api.mayar.id/credit/v1/credit/credit-usage/customer/regist' \
  --header 'Authorization: Bearer Paste-Your-API-Key-Here' \
  --data-raw '{
      "productId": "43eadce2-bc52-4e38-a832-93fb835f2a69",
      "trialCredit": 300, //optional
      "customerInfo": {
          "name" : "john doe",
          "email" : "johndoe@gmail.com",
          "mobile" : "08777777777"
      }
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response Example 200 theme={null}
  {
      "statusCode": 200,
      "message": "success",
      "data": {
        "customerId": "bcf56452-ec21-4791-aca2-7a41b033e9d2",
        "paymentLinkId": "43eadce2-bc52-4e38-a832-93fb835f2a69"
      }
  }
  ```
</ResponseExample>

Endpoint:

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

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

## Authorization

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

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

## Request Body

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

<ParamField query="trialCredit" path="trialCredit" type="integer">
  The trial credit amount to grant upon registration.
</ParamField>

<ParamField query="customerInfo" path="customerInfo" type="array of object" required>
  Object containing customer details.
</ParamField>

### customerInfo Structure (Array Of Object)

<ParamField query="name" path="name" type="string" required>
  Full name of the customer.
</ParamField>

<ParamField query="email" path="email" type="string" required>
  Email address of the customer.
</ParamField>

<ParamField query="mobile" path="mobile" type="string" required>
  Mobile phone number of the customer.
</ParamField>

## Response

Successful Response

### Main Structure (Root)

<ResponseField name="statusCode" type="integer">
  Indicates the HTTP status of the request (e.g. `200` for success).
</ResponseField>

<ResponseField name="message" type="string">
  A descriptive message about the outcome of the request.
</ResponseField>

<ResponseField name="customerId" type="string">
  Unique identifier of the related customer record.
</ResponseField>

<ResponseField name="paymentLink.id" type="string">
  Unique identifier of the credit usage product aka productId.
</ResponseField>
