# Payment links

A shareable page where customers pay a fixed amount, without any code on your side.

Share the link's `url` in a chat, an email or as a QR on an invoice. Each time a customer presses Pay, a new [payment](/api/payments.md) is created with `payment_link` set to the link's id, and you get the usual `payment.succeeded` webhook. You can also create links in the dashboard.

## The payment link object

| Field | Type | Description |
|---|---|---|
| `id` | string | Starts with `plink_`. |
| `object` | string | Always `payment_link`. |
| `livemode` | boolean | Test or live mode. |
| `active` | boolean | Inactive links can't be paid. |
| `url` | string | The page to share. |
| `amount` | integer | Fixed amount in the smallest currency unit. |
| `currency` | string | Three-letter ISO 4217 code, such as `SGD`, `THB` or `MMK`. |
| `description` | string | What the customer pays for; shown on the page. |
| `single_use` | boolean | If true, the link stops working after one successful payment. |
| `payments_count` | integer | Payments made through the link. |
| `metadata` | object | Your own key–value data. |
| `created_at` | timestamp | When it was created. |

```json title="A payment link"
{
  "id": "plink_3Mn5Op7Qr9St1Uv3Wx5Yz7",
  "object": "payment_link",
  "livemode": false,
  "active": true,
  "url": "https://checkout.klinkpay.net/l/plink_3Mn5Op7Qr9St1Uv3Wx5Yz7",
  "amount": 25000,
  "currency": "MMK",
  "description": "Monthly membership",
  "single_use": false,
  "payments_count": 0,
  "metadata": {},
  "created_at": "2026-11-27T09:00:00Z"
}
```

## Create a payment link

```http
POST /v1/payment_links
```

**Body**

| Field | Type | Required | Description |
|---|---|---|---|
| `amount` | integer | yes | In the smallest currency unit. |
| `description` | string | yes | Shown to the customer. |
| `single_use` | boolean | no | Default `false`. |
| `metadata` | object | no | Your own data. |

```bash title="Request"
curl https://api.klinkpay.net/v1/payment_links \
  -X POST \
  -H "Authorization: Bearer kp_test_…" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 25000,
    "description": "Monthly membership"
  }'
```

```json title="Response"
{
  "id": "plink_3Mn5Op7Qr9St1Uv3Wx5Yz7",
  "object": "payment_link",
  "livemode": false,
  "active": true,
  "url": "https://checkout.klinkpay.net/l/plink_3Mn5Op7Qr9St1Uv3Wx5Yz7",
  "amount": 25000,
  "currency": "MMK",
  "description": "Monthly membership",
  "single_use": false,
  "payments_count": 0,
  "metadata": {},
  "created_at": "2026-11-27T09:00:00Z"
}
```

## Retrieve a payment link

```http
GET /v1/payment_links/:id
```

Requires `payment_links:read` on restricted keys.

```bash title="Request"
curl https://api.klinkpay.net/v1/payment_links/plink_3Mn5Op7Qr9St1Uv3Wx5Yz7 \
  -H "Authorization: Bearer kp_test_…"
```

## List payment links

```http
GET /v1/payment_links
```

Newest first, with the usual [pagination](/concepts/pagination.md).

```bash title="Request"
curl https://api.klinkpay.net/v1/payment_links \
  -H "Authorization: Bearer kp_test_…"
```

```json title="Response"
{
  "object": "list",
  "data": [
    {
      "id": "plink_3Mn5Op7Qr9St1Uv3Wx5Yz7",
      "object": "payment_link",
      "livemode": false,
      "active": true,
      "url": "https://checkout.klinkpay.net/l/plink_3Mn5Op7Qr9St1Uv3Wx5Yz7",
      "amount": 25000,
      "currency": "MMK",
      "description": "Monthly membership",
      "single_use": false,
      "payments_count": 0,
      "metadata": {},
      "created_at": "2026-11-27T09:00:00Z"
    }
  ],
  "has_more": false
}
```

## Deactivate a payment link

```http
POST /v1/payment_links/:id/deactivate
```

Stops the link from taking new payments. Returns the link with `active: false`. Payments already made are not affected.

```bash title="Request"
curl https://api.klinkpay.net/v1/payment_links/plink_3Mn5Op7Qr9St1Uv3Wx5Yz7/deactivate \
  -X POST \
  -H "Authorization: Bearer kp_test_…"
```
