Apply Loan Charge API
Apply Loan Charge API in Frappe Lending allows users to apply a single charge to a specific loan through an API request. This can be used to add loan-related charges such as preclosure charges, processing fees, or other applicable charges directly to a loan account.
If the specified charge type does not already exist, the system automatically creates the required charge record before applying it to the loan.
Did You Know?
Loan charges can be calculated automatically based on outstanding principal, total payable amount, or a fixed amount.
API Endpoint
POST /api/method/lending.api.apply_charge
Request Body
The API accepts loan details, charge type, calculation method, and applicable amount information.
{
"loan": "ACC-LOAN-2026-00116",
"charge_type": "Preclosure Charges",
"based_on": "On Outstanding Principal",
"percentage": 2,
"amount": 200,
"charge_applicable_date": "2026-03-06"
}
Request Parameters Description
| Parameter | Description |
|---|---|
| Loan | Specifies the loan account where the charge needs to be applied. |
| Charge Type | Defines the type of charge to be applied. If it does not exist, the system creates it automatically. |
| Based On | Defines the method used to calculate the charge amount. |
| Percentage | Defines the percentage value for percentage-based charges. Not applicable for flat charges. |
| Amount | Defines the fixed charge amount when the calculation method is Flat. |
| Charge Applicable Date | Optional field used when the charge needs to be applied on a date other than the current date. |
Charge Calculation Methods
| Method | Description |
|---|---|
| On Outstanding Principal | Calculates the charge based on the remaining outstanding principal amount. |
| On Total Payable Amount | Calculates the charge based on the total payable amount of the loan. |
| Flat | Applies a fixed charge amount specified in the request. |
Response
On successful completion, the API returns a confirmation message with the applied charge amount.
{
"message": "Charge applied successfully for amount 2000.0"
}
How It Works
The API processes the charge application in the following steps:
| Step | Description |
|---|---|
| 1. Identify Loan | The system validates the loan account provided in the request. |
| 2. Validate Charge Type | The system checks whether the requested charge type exists. If missing, it creates a new charge. |
| 3. Calculate Charge | The charge amount is calculated based on the selected calculation method. |
| 4. Apply Charge | The calculated charge is added to the loan account. |
Use Cases
The Apply Loan Charge API can be used for:
- Applying foreclosure or preclosure charges.
- Adding processing or service fees.
- Integrating external loan servicing platforms.
- Automating charge application workflows.
- Applying charges during loan lifecycle events.
Note
The charge applicable date can be provided only when the charge needs to be recorded for a date different from the current system date.
Best Practices
- Verify the loan account before applying charges.
- Use percentage-based charges only with supported calculation methods.
- Provide a charge applicable date when processing historical charges.
- Review charge configuration before applying bulk loan charges.