# API – Loan Setup

### Introduction

This article discusses the specifics of the setup of a loan, working with loan setup entities, and what entity fields refer to.

### Working with Loan Setup Entities

When using a request with a loan entity, you will need to wrap the "LoanSetup" JSON object inside of a separate JSON object for the loan entity; this is not needed for working directly with the loan setup entity. For example, if you add a loan setup entity through the loan entity, the body for my POST/PUT request would look similar to the following:

{   ...Loan Entity Fields Here...   "LoanSetup":{       ...Loan Setup Fields Here...   }}

However, if you create a loan setup entity directly, the body of your request would look as follows:

{    ...Loan Setup Fields Here...}

The URL for the request is the same as the URL for the loan. For example, to edit the Loan Setup for the loan with an ID of "123", the URL would be as follows:

PUT    https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(123)

#### Entity Field Overview

Below is the JSON format of a LoanSetup entity.

{    "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",    "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",    "maxInterestAmount": "0",     "financeChargeAsMIA": 1  }}

The following table contains a list of all the variables:

 Variable Description loanAmount This is the amount that has been lent out to the borrower discount This is the difference in the face value of the loan and the amount the lender acquired it for (ex. If the loan has a worth of $1500 and it was purchased for$1000, the discount would be \$500) underwriting This is the amount of the underwriting fee loanRate This is the interest rate on the loan; its frequency is based on the loanRateType field loanRateType The frequency of the interest rate (weekly, monthly, annually, etc.). A 1% monthly interest rate is equivalent to a 12% annual interest rate. See Loan Setup Collections loanTerm The number of periods for the loan contractDate The date the contract was signed firstPaymentDate The date that the first payment will come due for the loan (cannot be before the contract date) amountDown A record of the amount the borrower put down (does not affect loan calculations at all) reserve An amount held back from the dealer or source company to insure against bad loans (does not affect loan calculations) salesPrice The original sales price of the collateral (does not affect loan calculations) gap The amount of the GAP insurance warranty The amount covered by warranty dealerProfit The amount of profit that the dealer made off of the loan (does not affect calculations) taxes The amount paid in taxes for the loan; please note that leases use an Escrow bucket for this (does not affect calculations) creditLimit The Credit limit of the loan (for loans of type Credit Limit) loanClass The loan class; the class of the loan collateral. See Loan Setup Collections loanType The type of the loan. See Loan Setup Collections discountSplit Whether or not the discount should be split over the life of the loan (1 – yes, 0 – no) paymentFrequency The frequency on which payments come due (the length of the periods) calcType The calculation type for the loan daysInYear The method to “calculate days in year” when performing loan calculations. See Loan Setup Collections interestApplication How interest is applied to the loan. See Loan Setup Collections begEnd firstPeriodDays How the number of days in the first payment period on the loan should be calculated. See Loan Setup Collections firstDayInterest Whether or not to charge interest on the first day of the loan. See Loan Setup Collections discountCalc How discount is calculated. See Loan Setup Collections diyAlt Calculation for Days in Year Alternate. See Loan Setup Collections daysInPeriod The number of days in a period for custom period length. See Loan Setup Collections roundDecimals The number of decimal places to round to for calculations (between 2 and 7) lastAsFinal curtailPercentBase nddCalc endInterest feesPaidBy graceDays The length of the grace period before a late fee is applied (between 0 and 30) lateFeeType The type of the late fee. See Loan Setup Collections lateFeeAmount The amount of the flat late fee lateFeePercent The percentage of the late fee lateFeeCalc lateFeePercentBase paymentDateApp maxInterestAmount This option lets you determine the maximum amount of interest you'd like to set on a loan. If your determined maxInterestAmount is higher than the finance charge (which is determined by the interest rate on the loan), the system will default to the finance charge. When you put any value in this field, "financeChargeAsMIA" will be set to 0. financeChargeAsMIA This sets the calculated finance charge (determined by the loan's APR) as the default. (1 - true, 0 - false)