Create recurring invoice (subscription)
create_subscriptionCreate a recurring invoice: Kaspi has no auto-debit, so Aitole sends an invoice to the customer's phone on a schedule and the customer pays it in Kaspi in one tap. Amounts are whole tenge (KZT) as integers: 5000 means 5,000 tenge, no tiyn/decimals. Each invoice is a normal operation with subscription_id; it counts as paid only with status "paid". By default the first invoice is sent one period from now; use bill_immediately or first_billing_at to change it. Pass idempotency_key (e.g. "sub-client-77") so a retry does not create a second subscription. Use for repeating charges to the same phone (memberships, courses, rent); for a single charge use create_invoice. Returns the subscription with id, status and next_billing_at; pass that id to get_subscription, list_subscription_invoices, pause_subscription or cancel_subscription.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"phone": "<phone>",
"amount": "<amount>",
"period": "<period>"
},
"name": "create_subscription"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| phone | Yes | Customer phone in E.164 format, e.g. +77001234567. Must be a Kaspi client. | |
| amount | Yes | Amount of each invoice. Integer, whole tenge (KZT). | |
| period | Yes | Billing period. | |
| metadata | No | Optional JSON object stored with the record and returned back (e.g. {"order_id": "1024"}). | |
| on_unpaid | No | After all retries fail: "expire" ends the subscription after a grace period, "continue" moves to the next period. | |
| billing_day | No | Day of the period to bill: 1-7 for week (day of week), 1-28 for month/quarter. | |
| description | No | Invoice description; "{today}" is replaced by the billing date, e.g. "Course, {today}". | |
| billing_time | No | Time "HH:MM" in Almaty time, 06:00-22:00 (default 13:00). | |
| total_cycles | No | Total number of payments; omit for no end. | |
| connection_id | No | Optional Kaspi connection (cash register) id. Only needed when the account has several connections. | |
| idempotency_key | No | Optional. Your own unique id for this request, e.g. the order number "order-1024". Repeating a call with the same idempotency_key returns the same result instead of creating a duplicate, so pass one whenever you might retry. If omitted, a random key is generated (then a retry WILL create a duplicate). | |
| subscriber_name | No | Optional customer name for your records. | |
| bill_immediately | No | Send the first invoice right away. | |
| first_billing_at | No | Date YYYY-MM-DD of the first invoice (not together with bill_immediately). | |
| grace_period_days | No | Grace period in days (default 3). | |
| max_retry_attempts | No | Retries of an unpaid invoice (default 3). | |
| billing_day_from_end | No | For month/quarter instead of billing_day: days from the end of the month (0 = last day). | |
| retry_interval_hours | No | Hours between retries (default 24). | |
| external_subscriber_id | No | Optional id of the customer in your system. |