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

# Update Payment Link

> Endpoint used to update a payment link product

```bash Request Example theme={null}
curl --request POST 'https://api.mayar.id/hl/v2/payment-links/21d84338-b46d-42d7-9b49-d402520407a5/update' \
--header 'Authorization: Bearer Paste-Your-API-Key-Here' \
--header 'Content-Type: application/json' \
--data-raw '{
        "id": "21d84338-b46d-42d7-9b49-d402520407a5",
        "name": "Jasa Buat Website Kece Editan",
        "description": "Deskripsinya diubah",
        "amount": 150000,
        "redirectUrl": "https://example.com/thank-you",
        "notes": "catatan opsional",
        "expiredAt": "2026-06-15T12:00:00.000Z"
    }'
```

```json Response Example 200 theme={null}
{
    "statusCode": 200,
    "messages": "success",
    "data": {
        "id": "21d84338-b46d-42d7-9b49-d402520407a5",
        "link": "https://testingmayar.myr.id/pl/Jasa-Buat-Website-Kece"
    }
}
```

Endpoint:

```Production Production theme={null}
https://api.mayar.id/hl/v2/payment-links/{id}/update
```

```Sandbox Sandbox theme={null}
https://api.mayar.io/hl/v2/payment-links/{id}/update
```

> [!NOTE]
>
> The product to update is identified by the `id` field in the request body, not
> by the `{id}` segment in the URL path. This endpoint shares the same handler as
> [Edit Payment Link](https://docs.mayar.id/api-reference-v2/genericlink/edit.md)
> (`POST /products/payment-link/{id}/update`).

## Authorization

**Authorization** `string` *required*

Example:

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

## Request Body

**id** `string` *required*

Unique identifier of the payment link product to update. This is read from the
request body.

**name** `string`

Payment link product name.

**description** `string`

Payment link product description.

**amount** `integer`

Product price amount.

**redirectUrl** `string`

URL where the customer will be redirected after completing payment.

**link** `string`

Optional slug that replaces the product's public URL path. The slug is normally
fixed at creation from the original `name`; sending `link` moves the public URL,
e.g. `{ "id": "...", "link": "superapp-demo-saas" }` answers
`data.link: "https://<merchant>.myr.id/pl/superapp-demo-saas"`.

**notes** `string`

Additional notes for the payment link.

**expiredAt** `string | datetime`

Payment link expiration date in ISO 8601 format.

## Response

Successful Response

### Main Structure (Root)

**statusCode** `integer`

Status code from API.

**messages** `string`

Status message that describes the status code.

**data** `object`

The updated payment link product data.

### data Structure (Object)

**data.id** `string`

Unique identifier of the payment link product.

**data.link** `string`

Public payment link URL of the updated product.

### Errors

**400 Bad Request (validation failed)** `object`

When the request body fails validation, the endpoint responds with HTTP `400`
and sets `messages` to `failed`, returning the validator errors in `data`:
`{ "statusCode": 400, "messages": "failed", "data": [ ... ] }`.

**400 At least one field to update** `object`

Returned when the body carries `id` but no updatable field:
`{ "statusCode": 400, "messages": "At least one field to update is required" }`.
`name` and `amount` are optional — the body must contain at least one of
`name`, `description`, `amount`, `redirectUrl`, `link`, `coverImage`,
`expiredAt`, `limit`, `notes`, or `tax`.

**400 Membership requires amount** `object`

For membership-family products (`membership`, `saas`, `credit`), `amount` is
required: `{ "statusCode": 400, "messages": "amount is required to update a membership product" }`.

**401 Unauthorized** `object`

Returned when the product does not belong to the authenticated account:
`{ "statusCode": 401, "messages": "Unauthorized" }`.

**404 Not Found** `object`

Returned when the product does not exist:
`{ "statusCode": 404, "messages": "Product not found" }`.


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