# K-LINK Pay > K-LINK Pay is a payments API for Southeast Asia, built for AI agents and messaging channels: your agent or your server creates a payment, sends the customer a payment QR code or a checkout link in the conversation, and a signed webhook tells you when it is paid. Every page below is Markdown. Base URL of the docs: https://docs.klinkpay.net. API: https://api.klinkpay.net/v1. All docs in one file: https://docs.klinkpay.net/llms-full.txt. ## AGENTS Short rules for coding agents (Claude Code, Cursor and others) integrating with K-LINK Pay. - Base URL: `https://api.klinkpay.net/v1`. JSON in and out (`Content-Type: application/json`). Call the API from servers only, never from a browser or a mobile app. - Auth: send `Authorization: Bearer `. Secret keys start with `kp_test_` (test mode) or `kp_live_` (live mode); restricted keys start with `rk_test_` or `rk_live_` and only have the permissions they were given. Keys are created in the dashboard (https://app.klinkpay.net) under Developers, API keys, and are shown once. Read the key from an environment variable; never write it into code. - Test first: test keys work as soon as the account exists and never move real money. A test payment's hosted checkout has Simulate payment and Simulate failure buttons, and webhooks are sent as in live mode. - Amounts: integers in the currency's smallest unit (`1300` is SGD 13.00; `15200` is MMK 15,200 because MMK has no decimals). `currency` is a three-letter ISO 4217 code of one of the account's currency accounts. A live payment in a currency whose account is not active returns `403 currency_not_active`. - Take a payment: `POST /v1/payments` with `amount`, `currency` and your own `reference`. The response has `qr_payload` (draw it as a QR code) and `checkout_url` (the hosted checkout). A payment starts `pending` and ends `succeeded`, `failed`, `expired` or `canceled`. - Never mark an order paid because the customer came back from the checkout. Mark it paid from the `payment.succeeded` webhook, or by reading the payment with `GET /v1/payments/{id}`, after checking `amount`, `currency` and `reference` against the order. - Idempotency: send an `Idempotency-Key` header on every POST. A repeat with the same key and body returns the saved response; the same key with a different body returns `409 idempotency_conflict`. - Pagination: lists return `{"object": "list", "data": [...], "has_more": true}`, newest first. `limit` is 1 to 100 (default 20); page with `starting_after` or `ending_before` and an object id. - Errors: `{"error": {"code": "snake_case_code", "message": "...", "param": "..."}}` with the HTTP status. Branch on `code`, never on `message`. Retry `429`, `500`, `502` and `503` with exponential back-off and the same `Idempotency-Key`; do not retry other `4xx` unchanged. - Webhooks: K-LINK Pay POSTs the event as JSON with a `Klink-Signature: t=,v1=` header, where hex is the HMAC-SHA256 of `"."` keyed with the endpoint's secret. Verify it on the raw body in constant time and reject a `t` more than 5 minutes old. Answer `2xx` within a few seconds and do slow work afterwards. The same event can arrive more than once: store the event `id` and skip ids already handled. - Versioning: send `Klink-Version` to pin the API version your code was written for. - Every docs page is also Markdown: add `.md` to its URL (`https://docs.klinkpay.net/quickstart.md`). All docs in one file: https://docs.klinkpay.net/llms-full.txt. ## Get started - [What is K-LINK Pay](https://docs.klinkpay.net/index.md): K-LINK Pay is a payments API for Southeast Asia, built for AI agents and messaging channels. Send a payment QR code or a payment link in the chat, and a signed webhook tells you when it is paid. - [Quick start](https://docs.klinkpay.net/quickstart.md): Take your first QR payment in test mode in about ten minutes. Building an AI agent? See Using K-LINK Pay from an AI agent. - [Authentication and keys](https://docs.klinkpay.net/authentication.md): Every request is authenticated with an API key in the Authorization header. - [Test mode](https://docs.klinkpay.net/testing.md): Build and test your whole integration without moving real money. ## Guides - [AI agents](https://docs.klinkpay.net/guides/ai-agents.md): Let your AI agent send a payment QR code or a payment link inside the conversation, in whatever channel the customer is chatting on, and confirm the order once it's paid. - [Webhooks](https://docs.klinkpay.net/guides/webhooks.md): Get notified of payments, refunds and payouts as they happen. ## Concepts - [Amounts and currencies](https://docs.klinkpay.net/concepts/currencies.md): Amounts are integers in the currency's smallest unit, and every payment is in the currency of one of your currency accounts. - [Errors](https://docs.klinkpay.net/concepts/errors.md): Errors use HTTP status codes and a JSON body that says what went wrong. - [Pagination](https://docs.klinkpay.net/concepts/pagination.md): List endpoints return objects newest first, a page at a time, with cursor pagination. - [Idempotency](https://docs.klinkpay.net/concepts/idempotency.md): Retry a POST safely: the same Idempotency-Key never does the work twice. - [Versioning](https://docs.klinkpay.net/concepts/versioning.md): The API is versioned by date. The current version is 2026-11-27. ## API reference - [API reference](https://docs.klinkpay.net/api.md): Every K-LINK Pay REST endpoint, grouped by resource, with its parameters, example requests and responses. - [Payments](https://docs.klinkpay.net/api/payments.md): A payment is one request for money from a customer, paid by scanning a QR code or approving it in a mobile wallet app. - [Refunds](https://docs.klinkpay.net/api/refunds.md): Request money back for a succeeded payment, in full or in part. - [Events](https://docs.klinkpay.net/api/events.md): Every change worth knowing about is recorded as an event and sent to your webhook endpoints. - [Balance](https://docs.klinkpay.net/api/balance.md): What K-LINK Pay holds for you, and when it will be paid out. - [Payouts](https://docs.klinkpay.net/api/payouts.md): Transfers of your available balance to your bank account. - [Payment links](https://docs.klinkpay.net/api/payment-links.md): A shareable page where customers pay a fixed amount, without any code on your side. - [Webhook endpoints](https://docs.klinkpay.net/api/webhook-endpoints.md): Manage the URLs that receive your webhooks from code. ## API endpoints - [Create a payment](https://docs.klinkpay.net/api/payments.md#create-a-payment): `POST /v1/payments` - [Retrieve a payment](https://docs.klinkpay.net/api/payments.md#retrieve-a-payment): `GET /v1/payments/:id` - [List payments](https://docs.klinkpay.net/api/payments.md#list-payments): `GET /v1/payments` - [Cancel a payment](https://docs.klinkpay.net/api/payments.md#cancel-a-payment): `POST /v1/payments/:id/cancel` - [Create a refund](https://docs.klinkpay.net/api/refunds.md#create-a-refund): `POST /v1/refunds` - [Retrieve a refund](https://docs.klinkpay.net/api/refunds.md#retrieve-a-refund): `GET /v1/refunds/:id` - [List refunds](https://docs.klinkpay.net/api/refunds.md#list-refunds): `GET /v1/refunds` - [Retrieve an event](https://docs.klinkpay.net/api/events.md#retrieve-an-event): `GET /v1/events/:id` - [List events](https://docs.klinkpay.net/api/events.md#list-events): `GET /v1/events` - [Retrieve the balance](https://docs.klinkpay.net/api/balance.md#retrieve-the-balance): `GET /v1/balance` - [Retrieve a payout](https://docs.klinkpay.net/api/payouts.md#retrieve-a-payout): `GET /v1/payouts/:id` - [List payouts](https://docs.klinkpay.net/api/payouts.md#list-payouts): `GET /v1/payouts` - [Create a payment link](https://docs.klinkpay.net/api/payment-links.md#create-a-payment-link): `POST /v1/payment_links` - [Retrieve a payment link](https://docs.klinkpay.net/api/payment-links.md#retrieve-a-payment-link): `GET /v1/payment_links/:id` - [List payment links](https://docs.klinkpay.net/api/payment-links.md#list-payment-links): `GET /v1/payment_links` - [Deactivate a payment link](https://docs.klinkpay.net/api/payment-links.md#deactivate-a-payment-link): `POST /v1/payment_links/:id/deactivate` - [Create a webhook endpoint](https://docs.klinkpay.net/api/webhook-endpoints.md#create-a-webhook-endpoint): `POST /v1/webhook_endpoints` - [List webhook endpoints](https://docs.klinkpay.net/api/webhook-endpoints.md#list-webhook-endpoints): `GET /v1/webhook_endpoints` - [Delete a webhook endpoint](https://docs.klinkpay.net/api/webhook-endpoints.md#delete-a-webhook-endpoint): `DELETE /v1/webhook_endpoints/:id`