Qut PayWebsiteDashboardKnowledge baseAPI (OpenAPI)Guide for AI agentsРУСҚАЗEN

Vending and self-service machines

This is how a machine takes Kaspi payment without a card terminal. The machine's software creates an invoice through the Qut Pay API. The buyer scans the QR on the screen with the Kaspi.kz app, or confirms in that app an invoice sent to their own number. The money goes straight to your Kaspi Pay account, while Qut Pay watches the payment and tells your server "paid": only then does the machine dispense.

The guide is written for the owner of the machines and for the developer of the machine's software. It applies equally to coffee and snack machines, water and milk dispensers, car-wash bays, vacuums, lockers, laundromats, massage chairs, power-bank stations and turnstiles. Qut Pay does not sell or install hardware: the controller and the software are yours or your integrator's.

Qut Pay is an independent service that works on top of your own Kaspi Pay account. We are not affiliated with Kaspi Bank JSC and make no promises on behalf of Kaspi. Kaspi and Kaspi Pay are trademarks of their owner.

1. The two ways to pay

QR on the screenInvoice to a number
In the APIkind: "qr" (the default)kind: "phone" and customer.phone
What the buyer doesScans the QR with the Kaspi.kz app and confirms the payment. Types nothingTypes their number on the machine, opens the Kaspi.kz app and confirms the invoice that arrived
What the machine needsA screen that fits a QRA keypad for the number. The screen may be small
AmountUp to two decimalsWhole tenge only
Invoice lifetimeAbout 3 minutes. The exact time is in the expiresAt field of the response24 hours unless cancelled. So you cancel the invoice yourself when the session ends
CancellingThe QR cannot be withdrawn on Kaspi's side: it can be paid until expiresAtThe invoice is closed at Kaspi too
Common failureThe buyer is too slow and the QR expiresThe number is mistyped or is not a Kaspi customer

Which one to choose. Put a QR on a machine with a screen: the buyer types nothing and there are fewer mistakes. If there is no screen or it is too small, send an invoice to the number. You can offer both: the QR as the main way, "invoice to a number" as the alternative.

In both ways the invoice is paid in the Kaspi.kz app.

No screen and no keypad? Then there is a third way: a QR of a permanent payment link (qut.kz/p/<slug>) is stuck on every bay or door. It is described in the knowledge base. This guide is about the two ways where every sale gets a new invoice.

2. What is needed

WhatDetails
The machine's software with internet accessThe invoice is created in the cloud, so the machine needs a GSM modem or Wi-Fi. Without internet this setup does not work
A Kaspi Pay business account and a cashierIn Kaspi Pay you add an employee with the «Кассир» role on a separate number and connect it in the cabinet: Getting started. Test mode needs no cashier
An API keyCabinet → Integrations → API keys. A test key is qp_test_…, a live key is qp_live_…
A webhookCabinet → Integrations → Webhook. The address must be https with a real domain: IP addresses and tunnel addresses are refused. At most 5 addresses per organization
A tariffA flat monthly subscription. Its limits are in the table below
Fiscal receiptsIssuing a receipt is the seller's duty. How it is solved: Fiscal receipts

Where the software lives

There are two setups.

  1. Machine → your server → Qut Pay. This is the one we recommend. The API key stays on the server only. The webhook comes to the server. The server sends the machine the "dispense" command over your own channel (for example MQTT or HTTP).
  2. The machine calls the Qut Pay API itself. Fits when there is no server. The machine has no public https address, so it cannot receive a webhook: it polls the invoice status with GET /invoices/{id}. Create a separate key for every machine. A default key has only the invoices:read and invoices:write scopes, no refund scope. If a key leaks, you delete that one key only.

Tariff and limits

TariffPer monthMonthly limit (paid payments)Daily cap (invoices created)
Free0 ₸2050
Trial (7 days)0 ₸—50
Start4 990 ₸800200
Business14 900 ₸4 0001 500
Chain39 900 ₸15 0005 000
Partner79 900 ₸30 0002 000

Only paid invoices count toward the monthly limit. The daily cap counts invoices created today, paid or not. This matters for a machine: every session a buyer started and abandoned is an invoice too. The trial starts with the first live invoice, and when it ends the organization moves to the Free tariff. The Partner tariff is enabled by the platform. Qut Pay takes no percentage of a payment, while Kaspi charges its own fee separately, on its own terms. More: Pricing and limits.

3. Step by step

Go through everything in test mode (sandbox) first. In test mode Kaspi is not called and no money moves, while webhooks are delivered for real. The API address is https://api.qut.kz/api/v1. Every request carries the X-API-Key header.

Step 1. Create an invoice

At the moment the buyer has picked a product:

POST https://api.qut.kz/api/v1/invoices
X-API-Key: qp_test_…
Content-Type: application/json
Idempotency-Key: vm-014-A2-s000123

{
  "amount": 250,
  "description": "Machine 14: water 5 l",
  "externalOrderId": "vm-014-s000123",
  "metadata": { "machine": "VM-014", "slot": "A2", "session": "s000123" }
}

Response 201 (main fields):

{
  "id": "inv_01M1X22B2DSV3MNE1XP5S2YG41",
  "status": "pending",
  "mode": "sandbox",
  "kind": "qr",
  "amount": 250,
  "qrUrl": "https://…",
  "qrImageUrl": "https://qut.kz/pay/inv_01M1X22B2DSV3MNE1XP5S2YG41/qr.svg",
  "qrPngUrl": "https://qut.kz/pay/inv_01M1X22B2DSV3MNE1XP5S2YG41/qr.png",
  "expiresAt": "2026-11-27T10:03:00.000Z"
}

Show the qrImageUrl (SVG) or qrPngUrl (PNG) picture on the screen. qrUrl is the text inside the QR: the machine can draw the QR from it by itself. expiresAt is for the timer. metadata and externalOrderId come back unchanged both in the webhook and in the status response: that is how you know which machine and which slot it is.

For an invoice to a number the body gets kind and customer.phone, and the amount must be whole tenge:

{
  "amount": 250,
  "kind": "phone",
  "customer": { "phone": "77011234567" },
  "description": "Machine 14: water 5 l",
  "externalOrderId": "vm-014-s000124",
  "metadata": { "machine": "VM-014", "slot": "A2", "session": "s000124" }
}

The number is accepted as +7 701 123 45 67, 87011234567 or 77011234567. In this way description is up to 60 characters (100 for a QR) and is shown in the invoice as a comment.

Step 2. Simulate the payment

POST https://api.qut.kz/api/v1/invoices/inv_01M1X22B2DSV3MNE1XP5S2YG41/simulate
X-API-Key: qp_test_…
Content-Type: application/json

{ "status": "paid" }

The values "failed" and "expired" exist as well. This request works in test mode only.

Step 3. Receive "paid"

Your server receives a webhook:

POST https://server.example.kz/qutpay-webhook
X-Webhook-Event: invoice.paid
X-Webhook-Timestamp: 1764237780
X-Webhook-Signature: sha256=3f1a…
X-Webhook-Delivery: 17

{ "event": "invoice.paid", "invoice": { "id": "inv_01M1X22B2DSV3MNE1XP5S2YG41", "status": "paid", "amount": 250, "externalOrderId": "vm-014-s000123", "metadata": { "machine": "VM-014", "slot": "A2", "session": "s000123" }, "paidAt": "…" }, "sentAt": "…" }

You can learn the same result by asking for the status:

GET https://api.qut.kz/api/v1/invoices/inv_01M1X22B2DSV3MNE1XP5S2YG41
X-API-Key: qp_test_…

The response has "status": "paid".

Step 4. The "dispense" command

This is your software's job; the Qut Pay API has no such request. The server verifies the signature, takes the machine and the slot from metadata and sends the machine the command. Dispense only once per invoice.id.

Step 5. Test closing and refunding

  1. Create a new invoice and cancel it with POST /invoices/{id}/cancel (section 5).
  2. Send that invoice paid through simulate: an invoice.paid with "late": true arrives.
  3. Refund it with POST /invoices/{id}/refund. The key needs the refunds:write scope, a test key too.
  4. Test an invoice to a number with 77000000404: it returns the kaspi_customer_not_found error.

Step 6. Live mode

  1. Connect the Kaspi cashier.
  2. Switch the organization to live mode (live) in the cabinet.
  3. Create a live key (qp_live_…) and put it in place of the test key. While the organization is in live mode a test key creates no invoice: 409 key_mode_mismatch.
  4. Make one small real payment and try refunding it.

The trial (7 days) starts with the first live invoice.

4. Dispense only on a confirmed payment

The only signal for the machine is the invoice status paid. There are two ways to learn it.

Webhook and signature

Every delivery carries the X-Webhook-Signature (sha256=<hex>) and X-Webhook-Timestamp (unix seconds) headers. Verify every delivery:

expected = hex( HMAC_SHA256( secret, timestamp + "." + rawBody ) )
valid    = timingSafeEqual(expected, signatureWithout"sha256=") && |now - timestamp| <= 300

Polling the status from the server

You read the status field of the GET /invoices/{id} response. Ask once a second for the first 30 seconds. If there is no webhook, keep asking afterwards, every 2–3 seconds. At the end of the session add ?live=1 once: if the invoice is still open, we ask Kaspi at that very moment.

It is best to run the webhook and the polling together: you accept whichever arrives first.

How fast. We learn about a payment by asking Kaspi: an invoice younger than three minutes is checked about every 3 seconds. The webhook leaves the moment we learn. So the message arrives not instantly but a few seconds late. There is no guaranteed time.

The session timer

What to show while waiting

StateOn the screen
The invoice is being created"Please wait"
pending, QRThe QR, the amount, a countdown, "Scan with the Kaspi.kz app", a "Cancel" button
pending, invoice to a number"The invoice was sent to the number …4567. Open the Kaspi.kz app and confirm", the amount, a countdown, a "Cancel" button
paid"Payment received", the product is dispensed
failed"Payment failed": the buyer declined the invoice or Kaspi rejected the payment. Offer a new session
The timer ran out"Time is up". Cancel the invoice and return the screen to its start state

5. Closing the session

When the timer runs out or the buyer presses "Cancel", close the invoice:

POST https://api.qut.kz/api/v1/invoices/inv_01M1X22B2DSV3MNE1XP5S2YG41/cancel
X-API-Key: qp_live_…

The response is the same invoice, status is cancelled, plus a stillPayableUntil field (abridged):

{ "id": "inv_01M1X22B2DSV3MNE1XP5S2YG41", "status": "cancelled", "kind": "qr", "stillPayableUntil": "2026-11-27T10:03:00.000Z" }

What cancelling really does:

Do not wait for the invoice.expired message: it may come later than expiresAt. If Kaspi does not say so itself, we wait 90 more seconds before closing the invoice. Close the session on your own timer.

Late payment

Money can still arrive for a closed invoice (cancelled or expired): for example, the buyer scanned the QR at the last second and confirmed a little later. The invoice then turns paid, and the invoice.paid message carries "late": true. We keep checking a closed invoice for one more hour after expiresAt. An invoice closed without a check while the cashier connection was down is checked for longer, so a late-payment message may come later too.

There is one rule: a late payment is accepted and refunded. By then the machine may be serving another buyer, so nothing is dispensed and the money goes back:

POST https://api.qut.kz/api/v1/invoices/inv_01M1X22B2DSV3MNE1XP5S2YG41/refund
X-API-Key: qp_live_…
Content-Type: application/json

{ "reason": "Paid after the session was closed" }

Without amount the whole sum is refunded. The refund conditions are in section 8.

6. Idempotency

A dropped connection and a machine that sends the request again are normal. So that a retry never creates a second invoice, give every session one key: the machine, the slot and the session number.

Idempotency-Key: vm-014-A2-s000123

The same holds on the webhook side: keep the "dispensed" mark by invoice.id and write it before the motor starts.

SituationHow it maps in Qut Pay
One business, many machinesOne organization, one tariff. You tell machines apart by metadata and externalOrderId
Separate reporting or separate access per pointA separate API key per point (or per machine)
Each point has its own cashierSeveral cashiers are connected to one organization. You bind a key to one cashier (choose «Кассир» when creating the key, or connectionId)
Several legal entities (several sole proprietors or LLPs)A separate organization for each: its own cashier, its own keys, its own webhooks, its own tariff
You serve other businesses' machinesPartner API: a separate organization per client. Referrals and Partner API

What to know:

A worked example: 10 machines with 50 sales a day each make 15 000 paid payments a month. That is the monthly limit of the Chain tariff.

8. Pitfalls

The buyer walked away without paying

The timer runs out, you cancel the invoice, the screen returns to its start state. An unpaid invoice does not count toward the monthly limit but does count toward the daily cap. Do not create invoices while the screen is idle: an invoice is created only after the buyer has picked a product.

The payment went through, the machine did not dispense

The money is on your Kaspi account, not with Qut Pay. So a refund is the seller's own action:

Conditions and limits:

Have the machine report the outcome of every command to the server: "dispensed" or "not dispensed". Then it is clear which invoice to refund.

The daily cap or the monthly limit is reached

ErrorWhat it means
429 tariff_limit_reachedThe payments received this month have reached the tariff's limit. Invoices created earlier can still be paid; new ones are not created
429 tariff_daily_burstThe invoices created today have reached the daily cap
429 request_rate_limitedThe key's per-minute request limit was exceeded. The response has a Retry-After header

On the machine: write "Kaspi payment is temporarily unavailable" and leave another way to pay. Do not retry these errors in a loop. When the monthly limit is 80 percent used, you get a warning in Telegram.

The number is wrong or is not a Kaspi customer

ErrorWhat it meansWhat to do
422 invalid_phoneThe number's format is wrongAsk for the number again
422 phone_requiredkind: "phone" without a numberSend customer.phone
422 amount_must_be_whole_tengeAn invoice to a number has tiyn in itMake the amount whole tenge
422 kaspi_customer_not_foundThis number is not a Kaspi customerDo not retry with the same number. Ask for another number or offer the QR
502 kaspi_create_unconfirmedKaspi did not answer: the invoice may have reached the buyerClose the session and write "if an invoice arrives, do not pay it". A retry with the same key returns the same answer

We remember a kaspi_customer_not_found answer for that number for 10 minutes: a repeated request does not reach Kaspi.

On kaspi_create_unconfirmed you get a warning: check the «Счета» section of the Kaspi Pay app. If the buyer pays such an invoice, the money arrives but we do not see it: the machine dispenses nothing, and you refund the money yourself from Kaspi Pay.

The machine or the cashier is offline

So keep a backup way to pay on the machine.

Never dispense on the buyer's word

Neither the words "I paid" nor a receipt or a screenshot on a phone proves a payment. There are only two proofs: an invoice.paid message with a verified signature, and the paid status in the GET /invoices/{id} response.

9. Frequently asked questions

Do cash and Kaspi work together? Yes. Qut Pay does not touch the machine's coin or bill acceptor: Kaspi payment is one more way added to your software. It is better to keep cash, because the cashier connection can drop.

How many cashier connections for N machines? One connection is enough for the machines of one business: Qut Pay does not limit the number of machines per connection. What limits you is the organization's tariff and the key's request limit. A second cashier is for counting points separately and for standing in when the primary drops. Try a large fleet on a few machines first.

What does the buyer see? With the QR: the Kaspi.kz app's scanner, then the payment confirmation screen. With an invoice to a number: an invoice arrives in the app with the amount and the description text; the invoice notice shows the cashier's number. After paying they see "Payment received" on the machine's screen.

How are receipts issued? Issuing a fiscal receipt is the seller's duty; Qut Pay does not issue it on your behalf. The simplest way is described on the Fiscal receipts page. The receiptUrl field of a paid invoice holds Qut Pay's receipt page: it is a payment confirmation, not a fiscal receipt.

How fast does the payment status arrive? Usually within a few seconds: we check a fresh invoice about every 3 seconds. There is no guaranteed time, so run the webhook and the status polling together.

Can one QR be printed and stuck on the machine? An invoice's QR cannot be used as a sticker: it is meant for one sale and is short-lived. A sticker needs the QR of a permanent payment link: self-service machines.

Does Qut Pay supply a controller or a module? No. We create the invoice, watch the payment and send the webhook. The hardware and the machine's software are yours or your integrator's.

Ready-made code and help


Need help? WhatsApp +77788813333 · kazprose@gmail.com · 09:00–21:00 (Алматы)
You can also write from the dashboard: Support.

Qut Pay is an independent service, not affiliated with Kaspi Bank JSC. Kaspi and Kaspi Pay are trademarks of their owner.