API – Create a Loan
General
Loans in LoanPro are highly detailed. They include information about insurance, loan settings, loan setup, collateral, etc. As a result, payloads for creating a loan have several sections to make it easier to read and understand. The purpose of this article is to discuss the bare minimum payload to create a loan. Different articles will discuss linking loans with customers, more settings, payments, etc.
On success, LoanPro will return the loan information that was saved, including the id of the loan as saved in the LoanPro database. It is recommended to keep track of that id to make it easier to manage the loan later on. Additionally, any dates returned from LoanPro will be in a timestamp format, but any dates sent to LoanPro must be in a “YYYY-MM-DD” format.
The target url is https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans. The data must be sent over in a POST request with a Content-Type of “application/json”. Below is an example of a request header.
Authorization: Bearer API_TOKEN
Autopal-Instance-ID: INSTANCE_ID
Content-Type: application/json
Loan Information
The basic information for a loan includes the base information and the loan setup information. Without one of the sections, the loan will not be able to be created successfully.
Base Information
The base information payload will include:
- displayId – The id displayed to the user
Below is an example of the base information
{
"displayId": "L001000"
}
You may also include the following values if desired, but it’s unusual to do so:
{
"displayId": "L001000",
"active": 1,
"loanAlert": "This is an alert!",
"deleted": 0
}
- active – Must be “1” – this is if the loan is “live in the software”
- loanAlert – The alert for the loan
- deleted – “0” if the loan has not been deleted, “1” otherwise – temporary loans are marked as deleted, & will be permanently deleted within 24 hours from time of creation.
Loan Setup
Required Fields
There are only two fields that must be included in your payload in order to create the LoanSetup. If you are trying to create a loan, you should also include the fields that are required to run the calculator. The two absolutely required fields are:
- loanType
- loanClass
Required Fields to Run the Calculator
The following fields are required to run the calculator and will not be defaulted to a useful value if they are not included in your payload:
- loanAmount
- loanRate
- loanRateType
- loanTerm
- contractDate
- firstPaymentDate
- paymentFrequency
Required Fields that Will be Defaulted
There are some fields that are required to run the calculator, but values from your company defaults will be used if they are not included in the payload. These include:
- discountSplit
- calcType
- daysInYear
- InterestApplication
- scheduleTemplate
- begEnd
- firstPeriodDays
- firstDayInterest
- discountCalc
- diyAlt
- daysInPeriod
- roundDecimals
- lastAsFinal
- curtailPercentBase
- nddCalc
- endInterest
- feesPaidBy
- graceDays
- lateFeeType
- lateFeeCalc
- lateFeePercentBase
- paymentDateApp
The loan setup section stores the values used for the calculation of the loan. The specifics of the fields are discussed in the API Loan Setup article. Below is an example of the LoanSetup section:
"LoanSetup": {
"loanAmount": "12000.00",
"discount": "500.00",
"underwriting": "0.00",
"loanRate": "12.0212",
"loanRateType": "loan.rateType.annually",
"loanTerm": "36",
"contractDate": "2015-05-07",
"firstPaymentDate": "2015-05-08",
"amountDown": "0.00",
"reserve": "5.00",
"salesPrice": "12000",
"gap": "1120.",
"warranty": "2500",
"dealerProfit": "1000",
"taxes": "125.25",
"creditLimit": "15500",
"loanClass": "loan.class.carLoan",
"loanType": "loan.type.installment",
"scheduleTemplate": "0",
"discountSplit": "1",
"paymentFrequency": "loan.frequency.monthly",
"calcType": "loan.calcType.simpleInterest",
"daysInYear": "loan.daysInYear.frequency",
"interestApplication": "loan.interestApplication.betweenTransactions",
"begEnd": "loan.begend.end",
"firstPeriodDays": "loan.firstPeriodDays.frequency",
"firstDayInterest": "loan.firstdayinterest.yes",
"discountCalc": "loan.discountCalc.straightLine",
"diyAlt": "loan.diyAlt.no",
"daysInPeriod": "loan.daysinperiod.24",
"roundDecimals": "5",
"lastAsFinal": "loan.lastasfinal.no",
"curtailPercentBase": "loan.curtailpercentbase.loanAmount",
"nddCalc": "loan.nddCalc.standard",
"endInterest": "loan.endInterest.no",
"feesPaidBy": "loan.feesPaidBy.date",
"graceDays": "5",
"lateFeeType": "loan.lateFee.3",
"lateFeeAmount": "30.00",
"lateFeePercent": "10.00",
"lateFeeCalc": "loan.lateFeeCalc.standard",
"lateFeePercentBase": "loan.latefeepercentbase.regular",
"paymentDateApp": "loan.pmtdateapp.actual"
}
Putting it All Together
Below is an example of the loan payload put together:
{
"displayId": "L001000",
"LoanSetup": {
"loanAmount": "12000.00",
"discount": "500.00",
"underwriting": "0.00",
"loanRate": "12.0212",
"loanRateType": "loan.rateType.annually",
"loanTerm": "36",
"contractDate": "2015-05-07",
"firstPaymentDate": "2015-05-08",
"amountDown": "0.00",
"reserve": "5.00",
"salesPrice": "12000",
"gap": "1120.",
"warranty": "2500",
"dealerProfit": "1000",
"taxes": "125.25",
"creditLimit": "15500",
"loanClass": "loan.class.carLoan",
"loanType": "loan.type.installment",
"scheduleTemplate": "0",
"discountSplit": "1",
"paymentFrequency": "loan.frequency.monthly",
"calcType": "loan.calcType.simpleInterest",
"daysInYear": "loan.daysInYear.frequency",
"interestApplication": "loan.interestApplication.betweenTransactions",
"begEnd": "loan.begend.end",
"firstPeriodDays": "loan.firstPeriodDays.frequency",
"firstDayInterest": "loan.firstdayinterest.yes",
"discountCalc": "loan.discountCalc.straightLine",
"diyAlt": "loan.diyAlt.no",
"daysInPeriod": "loan.daysinperiod.24",
"roundDecimals": "5",
"lastAsFinal": "loan.lastasfinal.no",
"curtailPercentBase": "loan.curtailpercentbase.loanAmount",
"nddCalc": "loan.nddCalc.standard",
"endInterest": "loan.endInterest.no",
"feesPaidBy": "loan.feesPaidBy.date",
"graceDays": "5",
"lateFeeType": "loan.lateFee.3",
"lateFeeAmount": "30.00",
"lateFeePercent": "10.00",
"lateFeeCalc": "loan.lateFeeCalc.standard",
"lateFeePercentBase": "loan.latefeepercentbase.regular",
"paymentDateApp": "loan.pmtdateapp.actual"
}
}