Salebot + Qut Pay: Kaspi invoices from your bot
Built a bot in Salebot and selling through WhatsApp, Telegram or Instagram? Once an order is placed, the bot can send the customer a Kaspi invoice on its own: it lands in the customer's Kaspi.kz app. When the customer pays, the bot checks it and writes "Paid". It takes one HTTP request and no programmer.
Qut Pay and Salebot are separate services; we are not partners. The bot calls the Qut Pay API through Salebot's standard "API-запрос" (API request) block.
What you need
| Where | What |
|---|---|
| Qut Pay | A cabinet at qut.kz/app, a connected Kaspi Pay cashier and an API key (cabinet → Integrations → API keys) |
| Salebot | A plan with API functions: in Salebot they work only on the «Бизнес» and «Инфобиз» plans |
| In the bot | Variables holding the customer's phone and the amount, e.g. phone and amount |
Test with a sandbox key (qp_test_…) first: invoices are created but nobody is charged.
1. The create-invoice block
Open the block where the order is confirmed and add an API-запрос section:
- Type:
POST-json - URL:
https://api.qut.kz/api/v1/invoices - Заголовок запроса (request header, JSON):
{"X-API-Key": "qp_live_…", "Content-Type": "application/json"}
- JSON параметры (JSON parameters):
{
"kind": "phone",
"amount": #{amount},
"description": "Order #{order_id}",
"externalOrderId": "#{order_id}",
"idempotencyKey": "salebot-#{order_id}",
"customer": { "phone": "#{phone}" }
}
- Сохраняемые значения из ответа (values saved from the response):
id->qp_invoice_id; status->qp_status; payUrl->qp_pay_url; error->qp_error
#{...} are Salebot variables; use the names from your own bot.
| Field | Why |
|---|---|
kind: "phone" | The invoice goes straight into the customer's Kaspi.kz app, no link needed. Whole tenge only |
amount | Amount in tenge: 12000 |
customer.phone | The number the customer's Kaspi account is registered to. +7 701 123 45 67, 87011234567, 77011234567 all work |
idempotencyKey | If the customer taps twice or the bot repeats the request, no second invoice is created and the first one comes back. One per order |
description | The comment the customer sees in Kaspi |
On success qp_status = pending and qp_invoice_id = inv_…. Have the bot write: "An invoice for 12 000 ₸ is in your Kaspi app. Write "Paid" once you have paid."
If qp_error is filled, no invoice was created. For example invalid_phone means a malformed number and kaspi_customer_not_found means the number has no Kaspi account. Either way, ask the customer for the number their Kaspi is registered to.
2. The check-payment block
When the customer writes "Paid" or taps a "Check" button, ask for the invoice state:
- Type:
GET - URL:
https://api.qut.kz/api/v1/invoices/#{qp_invoice_id} - Request header: as in step 1
- Saved values:
status->qp_status
Then branch on qp_status with a condition block:
qp_status | Meaning | What the bot writes |
|---|---|---|
paid | Paid | "✅ Payment received, thank you!", then carries on with the order |
pending | Not paid yet | "The invoice is in your Kaspi app; write again once you have paid" |
failed | Kaspi did not accept the invoice: no Kaspi account on the number, or the customer declined | "The invoice did not reach this number. Please send the number your Kaspi is registered to" → back to block 1 with the new number |
expired | The invoice expired | Back to block 1 for a new invoice |
cancelled | You cancelled it in the cabinet | Hand over to a manager |
When resending to a new number, change idempotencyKey, e.g. salebot-#{order_id}-2; otherwise the old invoice comes back.
3. Payment notices for you
You know about a payment even if the customer never writes "Paid":
- Telegram: connect Telegram in the Qut Pay cabinet and get a message for every payment.
- Cabinet: the Invoices section shows each invoice's state, the customer's number and
externalOrderId.
Telegram and Instagram bots
On WhatsApp use kind: "phone": the invoice reaches the Kaspi app with no link. If sending a link suits you better on Telegram or VK, drop kind. You then get qp_pay_url (https://qut.kz/pay/inv_…), a page with a QR code and a "Pay in Kaspi" button; have the bot send that link. A QR is valid for about 3 minutes and the page offers a fresh one by itself.
Testing
- Create a sandbox key (
qp_test_…) in the cabinet and put it into block 1's header. - Place an order in the bot yourself. A test invoice appears in the cabinet.
- Open it in the cabinet and press "[Sandbox] paid". The number
77000000404simulates "customer not in Kaspi". - Write "Paid" to the bot. It should answer "✅ Payment received".
- If all works, switch the key to
qp_live_….
Common errors
| Response | Cause | Fix |
|---|---|---|
401 unauthorized | Wrong key or missing header | Check the X-API-Key spelling and that the key is not deleted |
403 insufficient_scope | The key lacks rights | It needs invoices:write and invoices:read |
422 invalid_phone | Not 11 digits | Ask for the number again |
422 kaspi_customer_not_found | No Kaspi account on this number | Do not retry the same number; ask for the Kaspi number |
422 amount_must_be_whole_tenge | Tiyn with kind: "phone" | Round to whole tenge |
429 tariff_limit_reached | The plan's monthly limit is used up | Cabinet → Plan |
503 kaspi_session_expired | The Kaspi cashier connection dropped | Reconnect the cashier in the cabinet |
qp_status = failed | Declined, or Kaspi rejected the invoice | Talk to the customer; resend with a new idempotencyKey if needed |
Cost
Included in your Qut Pay plan at no extra charge. Only paid invoices count toward the plan's monthly limit. Kaspi charges its own fee separately. The Salebot plan is separate. Details: pricing.
Help
If it does not work, send a screenshot of the block (hide the key) to WhatsApp +7 778 881 3333 or Telegram @qutpaybot. Full API reference: website integration; for AI agents: api.qut.kz/llms.txt.
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.