Qut Pay (Kaspi QR payments)

v0.1.5
kz.qut/mcp Checked 3 days ago Published 16 days ago

Kaspi QR payments (Kazakhstan) via Qut Pay: invoices, refunds, subscriptions, payment links.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

qutpay_account Qut Pay account and mode

Returns the organization behind the API key: mode (sandbox or live), tariff and limits, connected Kaspi cashiers, provider status. Call this first.

qutpay_create_invoice Create a Kaspi invoice

Creates an invoice (QR by default, or pushed to the customer's Kaspi.kz app with kind="phone"). Returns payUrl (hosted pay page), qrImageUrl, deepLink, expiresAt (~3 min). Always pass idempotencyKey (e.g. "order-1001") so a retry never creates a second invoice. Amount in KZT, ≤ 2 decimals; whole tenge for kind="phone".

ParameterTypeDescription
amount *numberAmount in KZT, e.g. 2500 or 1500.5
customerobject
descriptionstringShown to the customer, e.g. "Order #1001"
externalOrderIdstringYour order id; later GET /invoices?externalOrderId finds it
failUrlstring
idempotencyKeystringUnique per order; same key → same invoice
kindstring"qr" (default) or "phone" (invoice pushed into the customer's Kaspi.kz app; needs customer.phone)
metadataobjectReturned unchanged in webhooks
successUrlstring

qutpay_create_topup Create a balance top-up invoice

Balance top-up for a user of the merchant's own service (AI service, SaaS, website): a QR invoice whose metadata is { ref: userRef, pack, qutpay_kind: "topup" }. The merchant keeps the balance in their own system and credits it on the invoice.paid webhook (idempotent by invoice id; subtract on invoice.refunded). Qut Pay holds no balance. Not for digital goods inside Telegram bots (Telegram requires Stars there). Returns payUrl like qutpay_create_invoice.

ParameterTypeDescription
amount *numberAmount in KZT; packs from 1 000 KZT make sense because of the Kaspi fee
userRef *stringYour user id to credit: 1–64 chars, A–Z a–z 0–9 _ . : -
descriptionstringShown to the customer; default "Баланс толтыру"
idempotencyKeystringUnique per top-up attempt
packPack id or label, e.g. "pro-600" — returned in metadata.pack
successUrlstring

qutpay_get_invoice Get invoice status

Reads one invoice by id (inv_…). live=true asks Kaspi right now instead of the cached status. Status flow: new → pending → paid | failed | expired | cancelled; paid → partially_refunded → refunded.

ParameterTypeDescription
id *string
liveboolean

qutpay_list_invoices List invoices

Lists invoices of the organization, newest first. Filter by status, externalOrderId, date range (ISO), limit ≤ 50, offset for paging.

ParameterTypeDescription
externalOrderIdstring
fromstringISO date/time, inclusive
limitinteger
offsetinteger
statusstring
tostringISO date/time, exclusive

qutpay_cancel_invoice Cancel an open invoice

Closes a pending invoice. A QR may still be paid until expiresAt — then invoice.paid arrives anyway; handle it.

ParameterTypeDescription
id *string

qutpay_refund_invoice Refund a paid invoice

Full refund (omit amount) or partial refund of a paid invoice. Needs the refunds:write scope. With a LIVE key real money is returned to the customer, so confirm=true is required and the merchant must have asked for this refund explicitly.

ParameterTypeDescription
id *string
amountnumberOmit for a full refund
confirmbooleanRequired (true) with a live key
reasonstring

qutpay_simulate_payment Simulate a payment (sandbox only)

Completes a sandbox invoice as paid / failed / expired without Kaspi, so the whole flow including the merchant's webhook can be tested. Refuses to run with a live key.

ParameterTypeDescription
id *string
statusstringDefault "paid"

qutpay_list_subscriptions List scheduled invoices (subscriptions)

Lists recurring invoice schedules (subscriptions), newest first. Needs the invoices:read scope.

ParameterTypeDescription
limitinteger
offsetinteger
statusstring

qutpay_get_subscription Get one subscription

Reads a recurring invoice schedule by id (sub_…): status, amount, interval, nextRunAt, last run and its error, customerUrl. Needs the invoices:read scope.

ParameterTypeDescription
id *string

qutpay_create_subscription Create a subscription (recurring invoices)

Creates a schedule that issues an invoice every N days/weeks/months (gym pass, tutoring, rent, SaaS plan). Each run is an invoice the customer confirms — in the Kaspi.kz app (kind="phone") or through a pay link; Kaspi has no card-on-file auto-debit. The customer's own page (customerUrl) shows the schedule. startAt sets the first run (default now). Needs subscriptions:manage or invoices:write.

ParameterTypeDescription
amount *numberAmount in KZT per run; whole tenge for kind="phone"
customerobject
dayOfMonthintegerMonthly schedules: day 1–28
descriptionstringShown to the customer, e.g. "Gym pass — October"
everyintegerEvery N intervals, default 1
intervalstringDefault "month"
kindstring"qr" (default: pay link, emailed if customer.email) or "phone" (invoice pushed into the customer's Kaspi.kz app)
maxRunsintegerStop after N invoices; omit for no end
metadataobjectCopied into every invoice and webhook
remindersobjectCustomer reminders: N days before each invoice, and after an unpaid one
startAtstringISO date/time of the first invoice; default now

qutpay_update_subscription Update a subscription

Changes an active or paused subscription: amount, description, schedule (interval, every, dayOfMonth, nextRunAt), customer, maxRuns, reminders, metadata. Only the fields passed change. Cancelled or finished subscriptions cannot be changed.

ParameterTypeDescription
id *stringsub_…
amountnumberAmount in KZT per run; whole tenge for kind="phone"
customerobject
dayOfMonthintegerMonthly schedules: day 1–28
descriptionstringShown to the customer, e.g. "Gym pass — October"
everyintegerEvery N intervals, default 1
intervalstringDefault "month"
kindstring"qr" (default: pay link, emailed if customer.email) or "phone" (invoice pushed into the customer's Kaspi.kz app)
maxRunsintegerStop after N invoices; omit for no end
metadataobjectCopied into every invoice and webhook
nextRunAtstringISO date/time of the next invoice
remindersobjectCustomer reminders: N days before each invoice, and after an unpaid one

qutpay_pause_subscription Pause a subscription

Stops issuing invoices until resumed. Reversible with qutpay_resume_subscription.

ParameterTypeDescription
id *string

qutpay_resume_subscription Resume a paused subscription

Re-activates a paused subscription in the organization's current mode. If the next run time has already passed it is rescheduled from now; catchUp=true issues the missed invoice right away instead.

ParameterTypeDescription
id *string
catchUpbooleanIssue the missed invoice now (default false)

qutpay_cancel_subscription Cancel a subscription (irreversible)

DESTRUCTIVE: ends the subscription for good — it cannot be resumed or edited afterwards (create a new one instead). Invoices already issued are not affected. To stop it for a while use qutpay_pause_subscription. With a LIVE key confirm=true is required, only after the merchant explicitly asked to cancel.

ParameterTypeDescription
id *string
confirmbooleanRequired (true) with a live key

qutpay_run_subscription_now Issue the next subscription invoice now

Issues the next invoice of a subscription immediately instead of waiting for nextRunAt and moves the schedule on, so the same period is never billed twice. Returns { invoice (with payUrl), run, subscription }.

ParameterTypeDescription
id *string