API – Create a Loan

General

Loans in LoanPro are highly detailed. They include information about insuranceloan settings, loan setupcollateral, 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. Keeping track of that ID will 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.

Here's an endpoint and sample header for the request:

POST https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans
Authorization: Bearer API_TOKEN
Autopal-Instance-ID: INSTANCE_ID
Content-Type: application/json

This header is just an example; you'll need to put in an actual API token and Autopal Intance ID to send a request. You can find these by logging into LoanPro and navigating to Settings > Company > API > Overview.

Loan Information in the Payload

The payload for a loan includes two main entities: "displayId" and the "LoanSetup," and there are dozens of smaller entities nested inside "LoanSetup". Both of the main sections are required, but many of the entitites nested inside of "LoanSetup" are not.

Here's a sample JSON payload:

{
"displayId": "L-z0k6BklfEE79sIkJRNhzs5587",
"LoanSetup": {
"loanClass": "loan.class.carLoan",
"loanType": "loan.type.installment",
"loanAmount": 12000,
"discount": 500,
"underwriting": 0,
"loanRate": 12.0212,
"loanRateType": "loan.rateType.annually",
"loanTerm": 36,
"contractDate": "2021-05-12",
"firstPaymentDate": "2021-06-11",
"amountDown": 0,
"reserve": 5,
"salesPrice": 12000,
"gap": 1120,
"warranty": 2500,
"dealerProfit": 1000,
"taxes": 125.25,
"creditLimit": 15500,
"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,
"lateFeePercent": 10,
"lateFeeCalc": "loan.lateFeeCalc.standard",
"lateFeePercentBase": "loan.latefeepercentbase.regular",
"paymentDateApp": "loan.pmtdateapp.actual",
"CustomFieldValues": {
"results": [
{
"customFieldId": 1,
"customFieldValue": ""
}
]
}
}
}

Base Information

The base information payload will include:

  • displayId – The id displayed to the user

There are some other fields that you could include at the base level, but they're not required (and not particularly useful in this scenario):

  • 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

Aside from the displayId, the other main entity is "LoanSetup", which nests dozens of other fields. Our article on Loan Setup Collections lists and explains all the acceptable values for each field.

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

Again, you can find all the valid values for these fields on our Loan Setup Collections article. Here's a sample payload with just the bare minimum to run the calculator:

{
"displayId": "L-z0k748522154",
"LoanSetup": {
"loanClass": "loan.class.carLoan",
"loanType": "loan.type.installment",
"loanAmount": 12000,
"loanRate": 12.0212,
"loanRateType": "loan.rateType.annually",
"loanTerm": 36,
"contractDate": "2021-05-12",
"firstPaymentDate": "2021-06-11",
"paymentFrequency": "loan.frequency.monthly"
}
}
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.


How did we do?


Powered by HelpDocs (opens in a new tab)