Retrieving loan estimations
Description
This web service returns estimates of payment schedules, based on the information provided, such as loan amount, term and or rate of interest. You must specify either the interest rate or the monthly payment, and the other value is calculated along with the total payment amount.
The loan product ID identifies the lending product from which the calculation methods must be applied to arrive at the loan estimations. For example, the accrual base method, or billing method.
Definition
Parameters
The table given below provides details of the request parameters used by this web service:
Fields | String | Description |
---|---|---|
amount* | Decimal | This is used to denote the loan amount. |
term* | Number | This is used to denote the term of the loan. |
interestRate*1 | Decimal | This is used to denote interest rate of the loan. |
maxMonthly*1 | Decimal | This is used to denote the maximum monthly payment of the loan. |
accrualBaseCode | String | Accrual base method, for calculating the daily interest accrued. For example, Month and Days or Actual Days. |
disbursalDate | Date | The date on which the borrower expects the loan to be disbursed. |
firstPaymentDate | Date | The expected first repayment date for the loan. |
interestOnlyPeriod | Number | Interest only period, if any, that is required on the loan. |
paymentFrequencyCode | String | The payment frequency. This is the frequency at which the borrower repays the loan. Loan term may be in Months for example, while payment frequency can be Quarterly. |
balloonPayment | Decimal | Balloon payment amount, if borrower wants to make a balloon payment at the end of the loan. In such case, payment schedule is generated for the balance amount to be paid in the preceding terms and balloon payment is collected in the last payment. |
loanProductId | String | ID of the loan product, as defined in the Loan_Product_Id_Field_c in the loanAPI_Configuration_c custom settings. If the value of "Loan_Product_Id_Field_c" is set to Null, the string input is assumed to be a Salesforce ID. The API retrieves the calculation parameters as specified in the lending product, if not provided through any of the above inputs. For example, the time calculation method, billing method, and so on. |
*1 : At least one of them should be provided.
Error messages
When you post a web service, you can receive the possible error messages as shown in the table below:
Error Code | Error Message | System.Label | Reason | HTTP Status Code |
---|---|---|---|---|
INVALID_INPUT | Unable to parse the Request parameters | UNABLE_PARSE_REQ_PARAMS | You will receive this error if the error occurs while parsing request parameters | 400 |
API_EXCEPTION | <exception_message> | NA | You will receive this error if any validation fails or any unexpected error occurs during the processing of the request, the system will raise the exception. | 500 |
Sample request
Inputs for the API Call
- LoanProductID
- Amount
- Interest Rate
- Term
The sample request for the call to be sent is as shown below:
GET https://na11.salesforce.com/services/apexrest/peer/v1/accounts/getLoanEstimations?loanProductId=a4U41000000GvM0EAK&amount=8000&interestRate=9&term=12
Sample response
Sample response generated for FinCalc Version :3.0
Total payment amount, maximum monthly payment, interest rate, and EMI's are provided in the custom response. The sample response that you will receive is as shown below:
{ "status": "SUCCESS", "rowNumber": -1, "response": [ { "totalInterest": 395.34, "totalAmount": 8395.339802299803351599951667441949277772, "monthlyPayment": 699.611650191650279299995972286829106481, "interestRate": 9, "emi": [ { "principal": 639.611650191650279299995972286829106481, "PaymentNo": 1, "interest": 60, "dueDateString": null, "dueDate": "2015-07-02", "balance": 7360.388349808349720700004027713170893519, "amount": 699.611650191650279299995972286829106481 }, { "principal": 644.411650191650279299995972286829106481, "PaymentNo": 2, "interest": 55.2, "dueDateString": null, "dueDate": "2015-08-02", "balance": 6715.976699616699441400008055426341787038, "amount": 699.611650191650279299995972286829106481 }, { "principal": 649.241650191650279299995972286829106481, "PaymentNo": 3, "interest": 50.37, "dueDateString": null, "dueDate": "2015-09-02", "balance": 6066.735049425049162100012083139512680557, "amount": 699.611650191650279299995972286829106481 }, { "principal": 654.111650191650279299995972286829106481, "PaymentNo": 4, "interest": 45.5, "dueDateString": null, "dueDate": "2015-10-02", "balance": 5412.623399233398882800016110852683574076, "amount": 699.611650191650279299995972286829106481 }, { "principal": 659.021650191650279299995972286829106481, "PaymentNo": 5, "interest": 40.59, "dueDateString": null, "dueDate": "2015-11-02", "balance": 4753.601749041748603500020138565854467595, "amount": 699.611650191650279299995972286829106481 }, { "principal": 663.961650191650279299995972286829106481, "PaymentNo": 6, "interest": 35.65, "dueDateString": null, "dueDate": "2015-12-02", "balance": 4089.640098850098324200024166279025361114, "amount": 699.611650191650279299995972286829106481 }, { "principal": 668.941650191650279299995972286829106481, "PaymentNo": 7, "interest": 30.67, "dueDateString": null, "dueDate": "2016-01-02", "balance": 3420.698448658448044900028193992196254633, "amount": 699.611650191650279299995972286829106481 }, { "principal": 673.951650191650279299995972286829106481, "PaymentNo": 8, "interest": 25.66, "dueDateString": null, "dueDate": "2016-02-02", "balance": 2746.746798466797765600032221705367148152, "amount": 699.611650191650279299995972286829106481 }, { "principal": 679.011650191650279299995972286829106481, "PaymentNo": 9, "interest": 20.6, "dueDateString": null, "dueDate": "2016-03-02", "balance": 2067.735148275147486300036249418538041671, "amount": 699.611650191650279299995972286829106481 }, { "principal": 684.101650191650279299995972286829106481, "PaymentNo": 10, "interest": 15.51, "dueDateString": null, "dueDate": "2016-04-02", "balance": 1383.63349808349720700004027713170893519, "amount": 699.611650191650279299995972286829106481 }, { "principal": 689.231650191650279299995972286829106481, "PaymentNo": 11, "interest": 10.38, "dueDateString": null, "dueDate": "2016-05-02", "balance": 694.401847891846927700044304844879828709, "amount": 699.611650191650279299995972286829106481 }, { "principal": 694.401650191650279299995972286829106481, "PaymentNo": 12, "interest": 5.21, "dueDateString": null, "dueDate": "2016-06-02", "balance": 0.000197700196648400048332558050722228, "amount": 699.611650191650279299995972286829106481 } ] } ], "errorNumber": 0, "errorMessage": null, "errorCode": "NO_ERROR", "content": [] }