Recording M-Pesa repayments
Map M-Pesa confirmations to repayments using payment types and receipt codes.
Call GET /payment-types once and cache the id of your M-Pesa channel. For each confirmed M-Pesa payment, post a repayment with that payment_type_id, the M-Pesa confirmation code as receipt, and the same code as client_ref — M-Pesa codes are unique, so callbacks that arrive twice are absorbed automatically.
Repayments are allocated by the loan product's repayment order (typically penalties → fees → interest → principal).
Something unclear or out of date? Tell us and we'll fix it.