# Quickstart

PayBot takes Kaspi Pay payments (Kazakhstan) for one business. You use it through a REST API, webhooks and an MCP server. This page gets you from a test key to a first payment and a connected AI agent. A test key runs in a sandbox: no money moves.

## Prompt for your AI

Paste this into Claude, ChatGPT, Cursor or another agent. Replace `PASTE_TEST_KEY` with your test key.

```text
Connect to the PayBot MCP server and build me a store.

MCP: https://paybot.kz/mcp (Streamable HTTP)
Header: Authorization: Bearer PASTE_TEST_KEY

First read the resources paybot://docs/mcp, paybot://docs/site-sdk and paybot://docs/starter-prompt.
Call get_session_status and confirm the key is a test key.
Ask me three things: what I sell, the price in tenge, and whether I want a site, a Telegram channel or only a payment link.
Create the products, propose a site, verify it with site_check.
Publishing, broadcasts and refunds wait for my approval in the cabinet: tell me when something waits.
Amounts in money tools are tiyn (1 KZT = 100 tiyn). Do not invent prices or legal details.
Never print or store the key.
Docs: https://paybot.kz/llms.txt
```

## Step 1. A test key

Sign in to the cabinet at `https://paybot.kz/app/`, open the API keys page and create a key with mode `test` and scopes `read` and `write`. The key is shown once. Keys can only be created in the cabinet.

```bash
export PAYBOT_API_KEY="pb_test_REPLACE_WITH_YOUR_KEY"
export PAYBOT_URL="https://paybot.kz"
```

## Step 2. A first payment

Amounts are integers in tiyn: 150000 tiyn = 1500 KZT. The `Idempotency-Key` header is required.

```bash
curl -sS -X POST "$PAYBOT_URL/v1/payments/qr" \
  -H "Authorization: Bearer $PAYBOT_API_KEY" \
  -H "Idempotency-Key: quickstart-0001" \
  -H "Content-Type: application/json" \
  -d '{"amount": 150000, "client_ref": "quickstart-0001", "description": "Test order"}'
```

`201` returns `id` (`pay_...`), `status: pending`, `qr_token` and `deep_link`. `202` with `status: creating` means Kaspi is still answering: poll the payment.

## Step 3. Read the status

```bash
curl -sS "$PAYBOT_URL/v1/payments/PAYMENT_ID" -H "Authorization: Bearer $PAYBOT_API_KEY"
```

Replace `PAYMENT_ID` with the `id` from step 2. The sandbox pays a test payment by itself after a short while: the status becomes `paid`.

## Step 4. Connect MCP

Endpoint: `https://paybot.kz/mcp`. Transport: Streamable HTTP. Auth: `Authorization: Bearer <API key>`.

```bash
claude mcp add --transport http paybot https://paybot.kz/mcp \
  --header "Authorization: Bearer $PAYBOT_API_KEY"
```

Cursor, `.cursor/mcp.json`:

```json
{
  "mcpServers": {
    "paybot": {
      "url": "https://paybot.kz/mcp",
      "headers": { "Authorization": "Bearer ${env:PAYBOT_API_KEY}" }
    }
  }
}
```

Client syntax changes: check your client's documentation. Test the connection by calling `get_session_status`.

## Next

- [API authentication](https://paybot.kz/docs/en/authentication.md)
- [MCP](https://paybot.kz/docs/en/mcp.md)
- [Full OpenAPI schema](https://paybot.kz/openapi.yaml)
- Most pages are in Russian: [documentation index](https://paybot.kz/docs/index.md).
