Create Note

POST /v2/finplus/debtmanagement/debtornotes/notes

Use this endpoint to create a new debtor note for a specified school.

  • Accountable Person: The note must be linked to an accountable person, requiring an accountable_person_id. This ID can be retrieved using either the Get Accountable Person(s) or Get Learner(s) calls.

  • Note Date: The date of the note must be in "YYYY-MM-DD" format and must fall between the start of last year and the end of next year.

  • Note Type: The note_type_id is required and can be retrieved using the Get Note Type(s) call.

  • Communication Type: The communication_type_id is required for all note types except Internal Notes. This ID can be obtained using the Get Communication Type(s) call.

  • Note Content: The actual text of the note should be provided in the note field.

  • Promise to Pay Notes:

    • If creating a Promise to Pay note (note_type_id: 2), payment arrangement details must be included under the promise_to_pays array.

    • A Promise to Pay requires:

      • date_promised: A date between the start of this year and the end of next year.

      • amount_promised: A numeric value without a currency symbol (e.g., "100.00").

Request Headers

Name
Type
Description

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.

Request Body

Name
Type
Description

accountable_person_id*

Integer

The id of the accountable person who the note belongs to.

date*

String

The date of the note in "yyyy-mm-dd" format.

note_type_id*

Integer

The id of the note type.

communication_type_id

Integer

The id of the communication type (not required for internal notes).

note

String

The note text

promise_to_pays

Array

An array of payment arrangement data for promise-to-pay notes

Request Examples

{
    "accountable_person_id": 40,
    "date": "2024-03-03",
    "note_type_id": 2,
    "communication_type_id": 2,
    "note": "Payment arrangement of R1000 to be paid off on outstanding school fees",
    "promise_to_pays": [
        {
            "date_promised": "2024-03-31",
            "amount_promised": "1000.00"
        },
        {
            "date_promised": "2024-04-30",
            "amount_promised": "1000.00"
        },
        {
            "date_promised": "2020-05-31",
            "amount_promised": "1000.00"
        }
    ]
}

Response Examples

Status: 201 Created

{
    "success": true,
    "message": "Note created successfully",
    "data": {
        "note_id": 6
    }
}

Code Samples

<?php

// API Credentials
$api_username = 'your_username';
$api_password = 'your_password';
$school_id = 'the_school_id';

// Base API endpoint
define('BASE_URL', 'https://integrate.d6plus.co.za/api/v2/finplus/debtmanagement/debtornotes/notes');

// Request payload
$request_data = [
    "accountable_person_id" => 1234,  // Replace with actual accountable person ID
    "date" => "2025-04-01",           // Note date (YYYY-MM-DD)
    "note_type_id" => 2,              // Replace with actual note type ID
    "communication_type_id" => 1,      // Required unless it's an Internal Note
    "note" => "This is a test debtor note.",
    "promise_to_pays" => [             // Only required if creating a "Promise to Pay" note
        [
            "date_promised" => "2025-05-01",
            "amount_promised" => "1500.00"
        ]
    ]
];

// Initialize cURL
$curl = curl_init();

// Set cURL options
curl_setopt_array($curl, [
    CURLOPT_URL            => BASE_URL,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_TIMEOUT        => 30,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION   => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_POSTFIELDS     => json_encode($request_data),
    CURLOPT_HTTPHEADER     => [
        "HTTP-X-USERNAME: $api_username",
        "HTTP-X-PASSWORD: $api_password",
        "HTTP-X-SCHOOLID: $school_id",
        "Content-Type: application/json"
    ],
]);

// Execute request
$response = curl_exec($curl);

// Check for errors
$error = curl_error($curl);
if ($error) {
    curl_close($curl);
    throw new Exception("cURL Error: $error");
}

// Close cURL and output response
curl_close($curl);
echo $response;