Skip to main content

Close Loan Account

Overview

Closes a loan account after all obligations have been fully satisfied.

Endpoint

POST /api/bpm/cmd

Request Headers

HeaderTypeRequiredDescription
AuthorizationstringYesBearer token for authentication
Content-TypestringYesMust be application/json
X-Tenant-IdstringYesTenant identifier

Request Body

{
"cmd": "CloseLoanCommand",
"data": {
"accountEncodedKey": "LN-2024-001234",
"comment": "Loan fully repaid ahead of schedule"
}
}

Parameters

ParameterTypeRequiredDescription
cmdstringYesMust be "CloseLoanCommand"
dataobjectYesClosure data
↳ accountEncodedKeystringYesLoan account identifier (EncodedKey or AccountNumber)
↳ commentstringNoClosure notes

Response

Success Response (200 OK)

{
"success": true,
"message": "Loan closed successfully",
"data": {
"loanId": "LA-2024-00001",
"loanAccountNumber": "3001234567890",
"status": "Closed",
"closureDate": "2024-12-15T10:00:00Z",
"closureType": "FullRepayment",
"totalPrincipalRepaid": 50000.00,
"totalInterestRepaid": 6850.00,
"totalAmountRepaid": 56850.00,
"outstandingBalance": 0.00,
"closedBy": "system@bank.com"
}
}

Status Codes

CodeDescription
200Loan closed successfully
400Loan has outstanding balance or cannot be closed
401Unauthorized
403Insufficient authority
404Loan not found
409Loan already closed
500Internal server error

Business Rules

  • All principal and interest must be fully paid
  • Outstanding fees can be waived with authorization
  • Guarantor releases processed automatically
  • Collateral release initiated
  • Customer receives closure confirmation
  • Historical data retained for reporting

Code Examples

C# Example

public async Task<ClosureResponse> CloseLoanAsync(string loanId, string closureType, bool waiveFees = false)
{
var request = new { loanId, closureType, waiveFees };
var json = JsonSerializer.Serialize(request);
var content = new StringContent(json, Encoding.UTF8, "application/json");

var response = await _httpClient.PostAsync("/api/administration/loan/close", content);
response.EnsureSuccessStatusCode();

var result = await response.Content.ReadAsStringAsync();
return JsonSerializer.Deserialize<ApiResponse<ClosureResponse>>(result).Data;
}

TypeScript Example

async function closeLoan(loanId: string, closureType: string, waiveFees: boolean = false): Promise<ClosureResponse> {
const response = await fetch('/api/administration/loan/close', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${accessToken}`,
'X-Tenant-Id': tenantId
},
body: JSON.stringify({ loanId, closureType, waiveFees })
});

const result = await response.json();
return result.data;
}

Notes

  • Validates all outstanding balances before closure
  • Releases guarantors and collateral
  • Generates closure certificate for customer
  • Updates customer credit profile
  • Archived for regulatory retention
  • Cannot be reopened once closed