Refund a paid operation (moves money)
refundMOVES MONEY, IRREVERSIBLE: return money to the customer for a paid operation, fully or partially. Always ask the user to confirm the operation id and amount before calling. Omit amount for a full refund of the remaining sum. Amounts are whole tenge (KZT) as integers: 5000 means 5,000 tenge, no tiyn/decimals. Refund window is 90 days; the key needs the "refund" scope. The operation stays "paid" and its refunded_amount grows. Check the returned refund status: Kaspi can refuse with HTTP 200 and status "failed". Pass idempotency_key (e.g. "refund-1024-1") so a retry does not refund twice. Use only for a paid operation; for an unpaid one use cancel_operation. Returns the refund with its status.
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": {
"operation_id": "<operation_id>"
},
"name": "refund"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| amount | No | Optional partial refund amount; omit to refund the full remaining amount. Integer, whole tenge (KZT). | |
| reason | No | Optional reason for the refund. | |
| operation_id | Yes | Id of the paid operation to refund. | |
| 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). |