https://{your-domain}.fincode.software/api/v1/services/user/calculate-apr
{
"status": "<string>",
"data": {
"apr": 123,
"totalInterest": 123,
"totalFees": 123,
"totalAmountPayable": 123,
"monthlyPayment": 123,
"breakdown": {}
}
}API Endpoints
Calculate APR
Calculates the Annual Percentage Rate (APR) for a loan application based on the loan amount, interest rate, and fees.
POST
/
api
/
v1
/
services
/
user
/
calculate-apr
https://{your-domain}.fincode.software/api/v1/services/user/calculate-apr
{
"status": "<string>",
"data": {
"apr": 123,
"totalInterest": 123,
"totalFees": 123,
"totalAmountPayable": 123,
"monthlyPayment": 123,
"breakdown": {}
}
}Calculates the APR for a loan application, providing customers with a clear understanding of the total cost of borrowing including interest and fees.
https://{your-domain}.fincode.software/api/v1/services/user/calculate-apr
Request Headers
Request Body
Response
Returns the calculated APR and related cost information.APR calculation results.
Code Examples
curl --location --request POST 'https://{your-domain}.fincode.software/api/v1/services/user/calculate-apr' \
--header 'X-Auth-Token: YOUR_JWT_ACCESS_TOKEN' \
--header 'x-idempotency-key: unique-key-12345' \
--header 'x-fapi-auth-date: 2024-01-15T10:30:00Z' \
--header 'x-fapi-customer-ip-address: 192.168.1.1' \
--header 'x-fapi-interaction-id: interaction-12345' \
--header 'Content-Type: application/json' \
--data '{
"loanAmount": 50000,
"interestRate": 12.5,
"tenure": 12,
"processingFee": 500,
"loanProductId": "123e4567-e89b-12d3-a456-426614174000"
}'
const axios = require('axios');
const BASE_URL = 'https://{your-domain}.fincode.software/api/v1/services/user';
async function calculateAPR(accessToken, aprData) {
try {
const response = await axios.post(
`${BASE_URL}/calculate-apr`,
{
loanAmount: aprData.loanAmount,
interestRate: aprData.interestRate,
tenure: aprData.tenure,
processingFee: aprData.processingFee || 0,
otherFees: aprData.otherFees || [],
loanProductId: aprData.loanProductId,
},
{
headers: {
'X-Auth-Token': accessToken,
'x-idempotency-key': `key-${Date.now()}`,
'x-fapi-auth-date': new Date().toISOString(),
'x-fapi-customer-ip-address': '192.168.1.1',
'x-fapi-interaction-id': `interaction-${Date.now()}`,
'Content-Type': 'application/json',
},
}
);
return result;
} catch (error) {
console.error(
'Failed to calculate APR:',
error.response?.data || error.message
);
throw error;
}
}
// Usage Example
const accessToken = 'YOUR_JWT_ACCESS_TOKEN';
calculateAPR(accessToken, {
loanAmount: 50000,
interestRate: 12.5,
tenure: 12,
processingFee: 500,
loanProductId: '123e4567-e89b-12d3-a456-426614174000',
});
