New New: idempotent repayments with client_ref — safe retries for branches on patchy connections Read →
74 Sign in Start free trial

Record a repayment

Updated

Posts a repayment and allocates it to penalties, fees, interest and principal per the product's rules.

POST https://app.zung.ai/connector/api/banking/loans/{id}/repayment

Banking API — authenticate with a staff bearer token. Results respect that user's permissions and branch access.

Parameters

ParameterTypeRequiredDescription
idinteger requiredLoan id
amountnumber requiredAmount in the institution's base currency
datedate requiredValue date of the transaction (YYYY-MM-DD)
payment_type_idinteger requiredPayment channel, from GET /payment-types (cash, M-Pesa, bank...)
receiptstring optionalReceipt or M-Pesa confirmation code
descriptionstring optionalNarration shown on the member's statement
client_refstring optionalYour unique reference (max 64). Retrying with the same value never posts twice

Request

bash
curl -X POST "https://app.zung.ai/connector/api/banking/loans/8821/repayment" \
  -H "Authorization: Bearer $ZUNG_TOKEN" \
  -H "Accept: application/json" \
  -d amount=1500 \
  -d date=2026-11-01 \
  -d payment_type_id=3 \
  -d receipt=QHX7821KE \
  -d client_ref=7f9c2e1a-5b8d-4c3e-9a71-2d6f0b8e4c15

Response

JSON
{
  "success": true,
  "message": "Repayment saved"
}

// Same client_ref sent again:
{
  "success": true,
  "duplicate": true,
  "message": "Already recorded."
}

Something unclear or out of date? Tell us and we'll fix it.