Charge Repayment
curl --request POST \
--url https://carbonapistagingsecure.getcarbon.co/baas/api/v1/loans/{loanId}/repayments \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--header 'x-carbon-key: <x-carbon-key>' \
--data '
{
"amount": 7199999,
"reference": "REPAY_REF_20250215_001"
}
'const options = {
method: 'POST',
headers: {
'x-carbon-key': '<x-carbon-key>',
apikey: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: 7199999, reference: 'REPAY_REF_20250215_001'})
};
fetch('https://carbonapistagingsecure.getcarbon.co/baas/api/v1/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://carbonapistagingsecure.getcarbon.co/baas/api/v1/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([
'amount' => 7199999,
'reference' => 'REPAY_REF_20250215_001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>",
"x-carbon-key: <x-carbon-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://carbonapistagingsecure.getcarbon.co/baas/api/v1/loans/{loanId}/repayments"
payload = {
"amount": 7199999,
"reference": "REPAY_REF_20250215_001"
}
headers = {
"x-carbon-key": "<x-carbon-key>",
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://carbonapistagingsecure.getcarbon.co/baas/api/v1/loans/{loanId}/repayments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-carbon-key"] = '<x-carbon-key>'
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 7199999,\n \"reference\": \"REPAY_REF_20250215_001\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://carbonapistagingsecure.getcarbon.co/baas/api/v1/loans/{loanId}/repayments"
payload := strings.NewReader("{\n \"amount\": 7199999,\n \"reference\": \"REPAY_REF_20250215_001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-carbon-key", "<x-carbon-key>")
req.Header.Add("apikey", "<api-key>")
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))
}{
"status": "success",
"message": "Repayment initiated",
"data": {}
}Loans
Charge Repayment
Initiate a repayment charge against an active loan.
POST
/
v1
/
loans
/
{loanId}
/
repayments
Charge Repayment
curl --request POST \
--url https://carbonapistagingsecure.getcarbon.co/baas/api/v1/loans/{loanId}/repayments \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--header 'x-carbon-key: <x-carbon-key>' \
--data '
{
"amount": 7199999,
"reference": "REPAY_REF_20250215_001"
}
'const options = {
method: 'POST',
headers: {
'x-carbon-key': '<x-carbon-key>',
apikey: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({amount: 7199999, reference: 'REPAY_REF_20250215_001'})
};
fetch('https://carbonapistagingsecure.getcarbon.co/baas/api/v1/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://carbonapistagingsecure.getcarbon.co/baas/api/v1/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([
'amount' => 7199999,
'reference' => 'REPAY_REF_20250215_001'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"apikey: <api-key>",
"x-carbon-key: <x-carbon-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}import requests
url = "https://carbonapistagingsecure.getcarbon.co/baas/api/v1/loans/{loanId}/repayments"
payload = {
"amount": 7199999,
"reference": "REPAY_REF_20250215_001"
}
headers = {
"x-carbon-key": "<x-carbon-key>",
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)require 'uri'
require 'net/http'
url = URI("https://carbonapistagingsecure.getcarbon.co/baas/api/v1/loans/{loanId}/repayments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-carbon-key"] = '<x-carbon-key>'
request["apikey"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 7199999,\n \"reference\": \"REPAY_REF_20250215_001\"\n}"
response = http.request(request)
puts response.read_bodypackage main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://carbonapistagingsecure.getcarbon.co/baas/api/v1/loans/{loanId}/repayments"
payload := strings.NewReader("{\n \"amount\": 7199999,\n \"reference\": \"REPAY_REF_20250215_001\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-carbon-key", "<x-carbon-key>")
req.Header.Add("apikey", "<api-key>")
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))
}{
"status": "success",
"message": "Repayment initiated",
"data": {}
}Overview
Initiates a repayment charge for an active loan. All amounts are in kobo.Note: The:loanIdpath parameter is the loan ID (fieldloan_idon the application record, populated after disbursement) — not theapplication_id.
Request
Method:POSTURL:
/v1/loans/:loanId/repayments
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
x-carbon-key | Header | string | Yes | API key for authentication. |
loanId | Path | string | Yes | Loan ID from the application record (loan_id field). |
Request Body
{
"amount": 7199999,
"reference": "REPAY_REF_20250215_001"
}
| Field | Type | Required | Description |
|---|---|---|---|
amount | number | Yes | Repayment amount in kobo. Must be positive. |
reference | string | Yes | Merchant-supplied reference for this repayment. |
Response
200 OK
{
"status": "success",
"message": "Repayment initiated",
"data": {}
}
Error Responses
| Status | Message | Cause |
|---|---|---|
| 400 | Loan not found | loanId does not match any loan under this merchant |
| 400 | amount must be a positive number (in kobo) | amount is zero, negative, or not a number |
| 400 | reference is required | Missing repayment reference |
| 422 | No SME loan ID on record | Loan not yet registered in lending engine |
Authorizations
Provide your API key in the 'apikey' header.
Headers
Path Parameters
Loan ID from the application record (loan_id field, not application_id)
Body
application/json
Provide the required values for the request body.
Response
200 - application/json
Successful response
The response is of type object.
⌘I