Age Analysis Report
GET /v2/finplus/debtmanagement/ageanalysis
Use this endpoint to generate an age analysis report for the specified school.
Default Behavior:
The report returns only active accounts (i.e., current learners or accounts with an outstanding balance).
To include all accounts (including left learners and zero-balance accounts), set the
all_accountsquery parameter totrue.
Grouping Options:
By default, the report is grouped by family and parent.
Use
per_learnerto group the data per learner.Use
per_categoryto group the data per category.If both
per_learnerandper_categoryare set totrue, the report will be grouped per learner, per category.
Filtering Options:
Use
debtor_codeto filter by a specific debtor.Use
learner_idto filter by a specific learner.Use
accountable_person_idto filter by a specific accountable person.Use
category_idto filter by a specific category.
The response provides balances across different aging periods (current, 30 days, 60 days, etc.), along with optional learner-specific and category-specific breakdowns based on the provided parameters.
Pagination
The response data includes a meta object that contains pagination-specific metadata. You can use the following query parameters to control pagination:
limit: This parameter allows you to override the default limit of records returned, up to the
max_allowed_limitspecified in the response'smetaobject.cursor: If the
metaobject contains anext_cursorfield, it indicates that more records are available. To fetch the next set of records, include thecursorparameter in your request with the value ofnext_cursor. If thenext_cursorfield is not present, it means there are no more records to retrieve.reverse_order: This parameter can be used to reverse the order in which the data is returned, useful for fetching the latest records first.
Request Headers
HTTP-X-USERNAME*
String
As provided by d6
HTTP-X-PASSWORD*
String
As provided by d6
HTTP-X-SCHOOLID*
Integer
The unique identifier of the school for which the data is being queried.
Query Parameters
all_accounts
Boolean
Whether to include all accounts
per_learner
Boolean
Whether to group the data per learner
per_category
Boolean
Whether to group the data per category (can be used in conjunction with per_learner)
debtor_code
Integer
To filter on a specific Debtor Code
learner_id
Integer
To filter on a specific Learner ID
accountable_person_id
Integer
To filter on a specific Accountable Person ID
category_id
Integer
To filter on a specific Category ID
cursor
String
To retrieve the next group of items (if any)
limit
Integer
To override the default limit of records returned (up to the max_allowed_limit provided in the response metadata).
reverse_order
Boolean
To reverse the order the data is returned in
Response Examples
Status: 200 OK
{
"data": [
{
"debtor_code": "1001",
"accountable_person_id": "40",
"date": "2024-04-10",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "4500.00",
"balance_total": "25200.00"
},
{
"debtor_code": "1002",
"accountable_person_id": "3",
"date": "2024-04-10",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "20000.00",
"balance_total": "40700.00"
}
],
"meta": {
"limit": 10,
"max_allowed_limit": 50,
"cursor": "eyJpZCI6MjU0NiwiX2JhY2t3YXJkIjpmYWxzZX0"
}
}Status: 200 OK
{
"data": [
{
"debtor_code": "1001",
"accountable_person_id": "40",
"date": "2024-04-10",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "4500.00",
"balance_total": "25200.00",
"learners": [
{
"learner_id": "1",
"learner_first_name": "Jordan",
"learner_last_name": "Smith",
"balance_current": "1750.00",
"balance_30days": "1750.00",
"balance_60days": "1750.00",
"balance_90days": "1750.00",
"balance_120days": "0.00",
"balance_150days": "850.00",
"balance_180days": "4500.00",
"balance_total": "12350.00"
},
{
"learner_id": "2",
"learner_first_name": "Samantha",
"learner_last_name": "Smith",
"balance_current": "1750.00",
"balance_30days": "1750.00",
"balance_60days": "1750.00",
"balance_90days": "1750.00",
"balance_120days": "850.00",
"balance_150days": "5000.00",
"balance_180days": "0.00",
"balance_total": "12850.00"
}
]
},
{
"family_code": "1002",
"accountable_person_id": "3",
"date": "2024-04-10",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "20000.00",
"balance_total": "40700.00",
"learners": [
{
"learner_id": "3",
"learner_first_name": "Nick",
"learner_last_name": "Webster",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "20000.00",
"balance_total": "40700.00",
}
]
}
],
"meta": {
"limit": 10,
"max_allowed_limit": 50,
"cursor": "eyJpZCI6MjU0NiwiX2JhY2t3YXJkIjpmYWxzZX0"
}
}Status: 200 OK
{
"data": [
{
"debtor_code": "1001",
"accountable_person_id": "40",
"date": "2024-04-10",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "4500.00",
"balance_total": "25200.00",
"categories": [
{
"category_id": "1",
"category_name": "School Fees",
"balance_current": "2750.00",
"balance_30days": "2750.00",
"balance_60days": "2750.00",
"balance_90days": "2750.00",
"balance_120days": "0.00",
"balance_150days": "4500.00",
"balance_180days": "4500.00",
"balance_total": "20000.00"
},
{
"category_id": "6",
"category_name": "Hostel Fees",
"balance_current": "500.00",
"balance_30days": "500.00",
"balance_60days": "500.00",
"balance_90days": "500.00",
"balance_120days": "500.00",
"balance_150days": "500.00",
"balance_180days": "0.00",
"balance_total": "3000.00"
},
{
"category_id": "8",
"category_name": "Sport",
"balance_current": "250.00",
"balance_30days": "250.00",
"balance_60days": "250.00",
"balance_90days": "250.00",
"balance_120days": "250.00",
"balance_150days": "850.00",
"balance_180days": "0.00",
"balance_total": "2100.00"
}
]
},
{
"family_code": "1002",
"accountable_person_id": "3",
"date": "2024-04-10",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "20000.00",
"balance_total": "40700.00",
"categories": [
{
"category_id": "1",
"category_name": "School Fees",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "20000.00",
"balance_total": "40700.00",
}
]
}
],
"meta": {
"limit": 10,
"max_allowed_limit": 50,
"cursor": "eyJpZCI6MjU0NiwiX2JhY2t3YXJkIjpmYWxzZX0"
}
}Status: 200 OK
{
"data": [
{
"debtor_code": "1001",
"accountable_person_id": "40",
"date": "2024-04-10",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "4500.00",
"balance_total": "25200.00",
"learners": [
{
"learner_id": "1",
"learner_first_name": "Jordan",
"learner_last_name": "Smith",
"balance_current": "1750.00",
"balance_30days": "1750.00",
"balance_60days": "1750.00",
"balance_90days": "1750.00",
"balance_120days": "0.00",
"balance_150days": "850.00",
"balance_180days": "4500.00",
"balance_total": "12350.00",
"categories": [
{
"category_id": "1",
"category_name": "School Fees",
"balance_current": "1000.00",
"balance_30days": "1000.00",
"balance_60days": "1000.00",
"balance_90days": "1000.00",
"balance_120days": "0.00",
"balance_150days": "0.00",
"balance_180days": "4500.00",
"balance_total": "8500.00"
},
{
"category_id": "6",
"category_name": "Hostel Fees",
"balance_current": "500.00",
"balance_30days": "500.00",
"balance_60days": "500.00",
"balance_90days": "500.00",
"balance_120days": "0.00",
"balance_150days": "500.00",
"balance_180days": "0.00",
"balance_total": "2500.00"
},
{
"category_id": "8",
"category_name": "Sport",
"balance_current": "250.00",
"balance_30days": "250.00",
"balance_60days": "250.00",
"balance_90days": "250.00",
"balance_120days": "0.00",
"balance_150days": "350.00",
"balance_180days": "0.00",
"balance_total": "1350.00"
}
]
},
{
"learner_id": "2",
"learner_first_name": "Samantha",
"learner_last_name": "Smith",
"balance_current": "1750.00",
"balance_30days": "1750.00",
"balance_60days": "1750.00",
"balance_90days": "1750.00",
"balance_120days": "850.00",
"balance_150days": "5000.00",
"balance_180days": "0.00",
"balance_total": "12850.00",
"categories": [
{
"category_id": "1",
"category_name": "School Fees",
"balance_current": "1000.00",
"balance_30days": "1000.00",
"balance_60days": "1000.00",
"balance_90days": "1000.00",
"balance_120days": "0.00",
"balance_150days": "4500.00",
"balance_180days": "0.00",
"balance_total": "8500.00"
},
{
"category_id": "6",
"category_name": "Hostel Fees",
"balance_current": "500.00",
"balance_30days": "500.00",
"balance_60days": "500.00",
"balance_90days": "500.00",
"balance_120days": "500.00",
"balance_150days": "500.00",
"balance_180days": "0.00",
"balance_total": "3000.00"
},
{
"category_id": "8",
"category_name": "Sport",
"balance_current": "250.00",
"balance_30days": "250.00",
"balance_60days": "250.00",
"balance_90days": "250.00",
"balance_120days": "350.00",
"balance_150days": "0.00",
"balance_180days": "0.00",
"balance_total": "1350.00"
}
]
}
]
},
{
"family_code": "1002",
"accountable_person_id": "3",
"date": "2024-04-10",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "20000.00",
"balance_total": "40700.00",
"learners": [
{
"learner_id": "3",
"learner_first_name": "Nick",
"learner_last_name": "Webster",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "20000.00",
"balance_total": "40700.00",
"categories": [
{
"category_id": "1",
"category_name": "School Fees",
"balance_current": "3500.00",
"balance_30days": "3500.00",
"balance_60days": "3500.00",
"balance_90days": "3500.00",
"balance_120days": "850.00",
"balance_150days": "5850.00",
"balance_180days": "20000.00",
"balance_total": "40700.00",
}
]
}
]
}
],
"meta": {
"limit": 10,
"max_allowed_limit": 50,
"cursor": "eyJpZCI6MjU0NiwiX2JhY2t3YXJkIjpmYWxzZX0"
}
} Description: When validation failed for one or more fields
Status: 400 Bad Request
{
"success": false,
"message": "Validation Failed",
"validation_errors": {
"accountable_person_id": "The Accountable person id must be integer",
"per_category": "The Per category must be a boolean"
}
}Code Samples
<?php
// API Credentials
$api_username = 'your_username';
$api_password = 'your_password';
$school_id = 'your_school_id';
// Base API endpoint
$base_url = 'https://integrate.d6plus.co.za/api/v2/finplus/debtmanagement/ageanalysis';
// Query parameters (customize as needed)
$query_params = [
'all_accounts' => 1, // To include all accounts (including left learners and zero-balance accounts)
'per_learner' => 1, // To group by learner
'per_category' => 1, // To group by category
'debtor_code' => '1001', // Filter by specific debtor code
'learner_id' => '', // Filter by specific learner ID (optional)
'accountable_person_id' => '', // Filter by specific accountable person ID (optional)
'category_id' => '', // Filter by specific category ID (optional)
];
// Build the full request URL
$url = $base_url . '?' . http_build_query(array_filter($query_params));
// Initialize cURL
$curl = curl_init();
// Set cURL options
curl_setopt_array($curl, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30, // Prevents hanging requests
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => [
"HTTP-X-USERNAME: $api_username",
"HTTP-X-PASSWORD: $api_password",
"HTTP-X-SCHOOLID: $school_id",
"Accept: application/json"
],
]);
// Execute request
$response = curl_exec($curl);
// Check for errors
if (curl_errno($curl)) {
throw new Exception('cURL Error: ' . curl_error($curl));
}
// Close cURL
curl_close($curl);
// Output the response
header('Content-Type: application/json');
echo $response;
curl --request GET 'https://integrate.d6plus.co.za/api/v2/finplus/debtmanagement/ageanalysis?all_accounts=true&per_learner=false&per_category=false' \
--header 'HTTP-X-USERNAME: your_username' \
--header 'HTTP-X-PASSWORD: your_password' \
--header 'HTTP-X-SCHOOLID: the_school_id'