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

# Generate Immutable Checkout Link

> This endpoint is used to generate immutable checkout link for membership credit product.

<RequestExample>
  ```bash Request Example theme={null}
  curl --location 'https://api.mayar.id/credit/v1/credit/generate/immutable/checkout' \
  --header 'Authorization: Bearer Paste-Your-API-Key-Here' \
  --data-raw '{
      "productId": "0e787345-9aaf-4b72-aa00-1174be6b52b1",
      "creditAmount": 1000, //optional
      "customerInfo": {
          "name" : "memberTambahan",
          "email" : "tambahan@gg.com",
          "mobile" : "08777777799"
      }
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response Example 200 theme={null}
  {
      "statusCode": 200,
      "message": "success",
      "creditUsageImmutableCheckoutUrl": "https://donasisekutscom.myr.id/pl/test-product-credit?immutable=eyJuYW1lIjoiam9obiBkb2UiLCJlbWFpbCI6ImpvaG5kb2U1QGdtYWlsLmNvbSIsIm1vYmlsZSI6IjA4Nzc3Nzc3Nzc3IiwiY3JlZGl0QW1vdW50IjoyMDAwMH0=.03de9bf29c5861d950d13364c2c23d62675cd2f03cd27a5b7c682f2c43d25b4e",
      "paymentLinkUrl": "https://donasisekutscom.myr.id/pl/test-product-credit"
  }
  ```
</ResponseExample>

Endpoint:

<CodeGroup>
  ```Production Production theme={null}
  https://api.mayar.id/credit/v1/credit/generate/immutable/checkout
  ```

  ```Sandbox Sandbox theme={null}
  https://api.mayar.club/credit/v1/credit/generate/immutable/checkout
  ```
</CodeGroup>

## Authorization

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

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

## Request Body

<RequestField name="productId" type="string" required>
  The unique identifier of the product associated.
</RequestField>

<RequestField name="creditAmount" type="number">
  The credit amount for the checkout. Only applicable for credit usage products.
</RequestField>

<RequestField name="customerInfo" type="object" required>
  Object containing customer details.
</RequestField>

<RequestField name="customerInfo.name" type="string" required>
  Full name of the customer.
</RequestField>

<RequestField name="customerInfo.email" type="string" required>
  Email address of the customer.
</RequestField>

<RequestField name="customerInfo.mobile" type="string" required>
  Mobile phone number of the customer.
</RequestField>

## Response

Successful Response

<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="creditUsageImmutableCheckoutUrl" type="string">
  A unique immutable checkout URL containing user identity fields and creditAmount.
</ResponseField>

<ResponseField name="paymentLinkUrl" type="string">
  The general (mutable) payment link URL.
</ResponseField>
