# Cancel a payment link

`DELETE /v1/recharge-links/{slug}` · [Sandbox · coming soon]

> Base URL: Sandbox `https://sandbox.zulu.com.co/v1`
>
> Not in production yet: it arrives with this same signature. Try it in the sandbox.

Cancels a link that was not paid yet: it becomes `CANCELLED` and stops taking payments (answers 204). Cancelling an already cancelled link also answers 204; a `PAID` or `EXPIRED` one answers 422. A PSE payment already in flight at the bank is still credited.

## Authentication

`Authorization: Bearer <access_token>` (401 when missing or expired) and `X-API-Key` (403 when missing or not matching).

## Request

### Path parameters

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `slug` | string | required | Link slug. |

## Responses

### 204

Done; no content.

No content.

### 401

The access token is missing, invalid or expired.

### 403

The `X-API-Key` is missing, invalid or does not match the token.

### 404

The resource does not exist.

### 422

The operation can not be processed; nothing is recorded.

### 429

Too many requests: wait the seconds in `Retry-After`.

### 500

Internal error.

## Errors

| HTTP | error | cause | Description |
| --- | --- | --- | --- |
| 401 | — | `Unauthorized` | The `Authorization: Bearer <access_token>` header is missing, or the token is invalid or expired. |
| 403 | — | `Forbidden` | The `X-API-Key` is missing, unknown, revoked or does not belong to the credentials of the token. |
| 404 | `NotFoundApiError` | `recharge link "%s" not found` | No link with that slug exists in your workspace. |
| 422 | `UnprocessableEntityApiError` | `recharge link "%s" is %s` | The link's status does not allow the operation (a `PAID` or `EXPIRED` link can no longer be cancelled or paid). |
| 429 | — | `Too Many Requests` | You exceeded the request limit of your credentials. Wait the seconds in `Retry-After`. |
| 500 | `InternalServerApiError` | `[code:1] unexpected error` | Internal error. On operations that move money, check the state before retrying so the operation is not duplicated. |

## Examples

### Cancel an open link

```bash
curl -X DELETE https://sandbox.zulu.com.co/v1/recharge-links/7QmVt3KpXz \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY"
```

**Response 204**

No content.

### An already paid link

```bash
curl -X DELETE https://sandbox.zulu.com.co/v1/recharge-links/7QmVt3KpXz \
  -H "Authorization: Bearer $ZULU_ACCESS_TOKEN" \
  -H "X-API-Key: $ZULU_API_KEY"
```

**Response 422**

```json
{
  "error": "UnprocessableEntityApiError",
  "cause": "recharge link \"7QmVt3KpXz\" is PAID"
}
```
