> ## Documentation Index
> Fetch the complete documentation index at: https://docs.withgale.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Cancel Payment Link

> Cancel an active payment link

# Cancel Payment Link

Cancel an active payment link to prevent it from being used. Only links with `active` status can be cancelled.

## Authentication

```bash theme={null}
Authorization: Bearer glm_test_YOUR_API_KEY
```

## Path Parameters

| Parameter | Type   | Required | Description                               |
| :-------- | :----- | :------- | :---------------------------------------- |
| `id`      | string | Yes      | Payment link ID (e.g., `plink_abc123xyz`) |

## Request Body

```json theme={null}
{
  "reason": "Customer requested cancellation"
}
```

| Parameter | Type   | Required | Description                             |
| :-------- | :----- | :------- | :-------------------------------------- |
| `reason`  | string | No       | Reason for cancellation (max 500 chars) |

## Response

> All monetary amounts are integers in cents (e.g., 4995 = \$49.95).

```json theme={null}
{
  "id": "plink_abc123xyz",
  "amount": 4995,
  "currency": "USD",
  "description": "Premium Blood Pressure Monitor",
  "status": "cancelled",
  "cancelled_at": "2026-02-25T16:00:00Z",
  "cancellation_reason": "Customer requested cancellation"
}
```

## Example

```bash theme={null}
curl -X POST https://api.withgale.com/api/v2/payment-links/plink_abc123xyz/cancel \
  -H "Authorization: Bearer glm_test_YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "reason": "Order cancelled by customer" }'
```

## Cancellation Rules

| Current Status | Can Cancel? | Notes                                                              |
| :------------- | :---------- | :----------------------------------------------------------------- |
| `active`       | Yes         | Status changes to `cancelled`                                      |
| `paid`         | No          | Use [Create Refund](/api-reference/endpoint/create-refund) instead |
| `expired`      | No          | Already expired                                                    |
| `cancelled`    | No          | Already cancelled                                                  |

<Warning>
  Cancelled links cannot be reactivated. Create a new link if needed.
</Warning>

## Webhooks

Cancelling a link triggers a `payment_link.cancelled` webhook event. See [Webhooks Reference](/developer-manual/webhooks) for details.

## Errors

| Status Code | Error Code      | Description                      |
| :---------- | :-------------- | :------------------------------- |
| 400         | `invalid_state` | Link is not in cancellable state |
| 401         | `unauthorized`  | Invalid or missing API key       |
| 404         | `not_found`     | Payment link not found           |

## Related

* [Create Payment Link](/api-reference/endpoint/create-payment-link)
* [Get Payment Link](/api-reference/endpoint/get-payment-link)
* [Create Refund](/api-reference/endpoint/create-refund)
