Record a repayment
curl --request POST \
--url https://{baasHost}/api/v1/lms/loans/{loanId}/repayments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"transactionAmount": 35000,
"transactionDate": "2026-04-10",
"paymentTypeId": 1,
"receiptNumber": "MPESA-ABC123XYZ",
"note": "Mobile money repayment"
}
'import requests
url = "https://{baasHost}/api/v1/lms/loans/{loanId}/repayments"
payload = {
"transactionAmount": 35000,
"transactionDate": "2026-04-10",
"paymentTypeId": 1,
"receiptNumber": "MPESA-ABC123XYZ",
"note": "Mobile money repayment"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
transactionAmount: 35000,
transactionDate: '2026-04-10',
paymentTypeId: 1,
receiptNumber: 'MPESA-ABC123XYZ',
note: 'Mobile money repayment'
})
};
fetch('https://{baasHost}/api/v1/lms/loans/{loanId}/repayments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{baasHost}/api/v1/lms/loans/{loanId}/repayments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'transactionAmount' => 35000,
'transactionDate' => '2026-04-10',
'paymentTypeId' => 1,
'receiptNumber' => 'MPESA-ABC123XYZ',
'note' => 'Mobile money repayment'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{baasHost}/api/v1/lms/loans/{loanId}/repayments"
payload := strings.NewReader("{\n \"transactionAmount\": 35000,\n \"transactionDate\": \"2026-04-10\",\n \"paymentTypeId\": 1,\n \"receiptNumber\": \"MPESA-ABC123XYZ\",\n \"note\": \"Mobile money repayment\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{baasHost}/api/v1/lms/loans/{loanId}/repayments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"transactionAmount\": 35000,\n \"transactionDate\": \"2026-04-10\",\n \"paymentTypeId\": 1,\n \"receiptNumber\": \"MPESA-ABC123XYZ\",\n \"note\": \"Mobile money repayment\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baasHost}/api/v1/lms/loans/{loanId}/repayments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transactionAmount\": 35000,\n \"transactionDate\": \"2026-04-10\",\n \"paymentTypeId\": 1,\n \"receiptNumber\": \"MPESA-ABC123XYZ\",\n \"note\": \"Mobile money repayment\"\n}"
response = http.request(request)
puts response.read_body{
"status": "repayment-accepted",
"loanId": "5c9e2b3c-4d5e-6f7a-8b9c-1d2e3f4a5b6c",
"amount": 35000
}Lending
Record a repayment
Records a repayment your gateway already collected. receiptNumber acts as your idempotency key.
POST
/
v1
/
lms
/
loans
/
{loanId}
/
repayments
Record a repayment
curl --request POST \
--url https://{baasHost}/api/v1/lms/loans/{loanId}/repayments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"transactionAmount": 35000,
"transactionDate": "2026-04-10",
"paymentTypeId": 1,
"receiptNumber": "MPESA-ABC123XYZ",
"note": "Mobile money repayment"
}
'import requests
url = "https://{baasHost}/api/v1/lms/loans/{loanId}/repayments"
payload = {
"transactionAmount": 35000,
"transactionDate": "2026-04-10",
"paymentTypeId": 1,
"receiptNumber": "MPESA-ABC123XYZ",
"note": "Mobile money repayment"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
transactionAmount: 35000,
transactionDate: '2026-04-10',
paymentTypeId: 1,
receiptNumber: 'MPESA-ABC123XYZ',
note: 'Mobile money repayment'
})
};
fetch('https://{baasHost}/api/v1/lms/loans/{loanId}/repayments', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{baasHost}/api/v1/lms/loans/{loanId}/repayments",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'transactionAmount' => 35000,
'transactionDate' => '2026-04-10',
'paymentTypeId' => 1,
'receiptNumber' => 'MPESA-ABC123XYZ',
'note' => 'Mobile money repayment'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://{baasHost}/api/v1/lms/loans/{loanId}/repayments"
payload := strings.NewReader("{\n \"transactionAmount\": 35000,\n \"transactionDate\": \"2026-04-10\",\n \"paymentTypeId\": 1,\n \"receiptNumber\": \"MPESA-ABC123XYZ\",\n \"note\": \"Mobile money repayment\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://{baasHost}/api/v1/lms/loans/{loanId}/repayments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"transactionAmount\": 35000,\n \"transactionDate\": \"2026-04-10\",\n \"paymentTypeId\": 1,\n \"receiptNumber\": \"MPESA-ABC123XYZ\",\n \"note\": \"Mobile money repayment\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{baasHost}/api/v1/lms/loans/{loanId}/repayments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"transactionAmount\": 35000,\n \"transactionDate\": \"2026-04-10\",\n \"paymentTypeId\": 1,\n \"receiptNumber\": \"MPESA-ABC123XYZ\",\n \"note\": \"Mobile money repayment\"\n}"
response = http.request(request)
puts response.read_body{
"status": "repayment-accepted",
"loanId": "5c9e2b3c-4d5e-6f7a-8b9c-1d2e3f4a5b6c",
"amount": 35000
}Authorizations
Bearer token from POST /generate-token. Expires ~1h; on 401, re-generate and retry once.
Path Parameters
Body
application/json
Response
200 - application/json
Repayment recorded