API – Split Payments
Introduction
LoanPro offers users the ability to split a payment across multiple loans. This article will explain how to do so via the API.
This article also expands upon the topics listed in API – Logging a Payment, so it may be a good idea to take a look at that article beforehand. It may also be beneficial to read over our article that explains how to Split a Payment in the UI, as it explains the preliminary steps of the process.
Preview Split
To preview a payment split, you'll first need two valid loan ID's. Using one of your ID's, send a POST request to the following URL.
POST https://loanpro.simnang.com/api/public/api/1/Loans(3).Autopal.PredictPaymentApplication()
Predict Payment Application as follows:
{
"data": {
"Date": "2021-11-03",
"Amount": 100,
"PaymentTypeId": "1",
"Extra": "payment.extra.periods.principalonly",
"chargeFeeType": "loan.cardfee.types.1",
"chargeFeeAmount": "5",
"chargeFeePercentage": "5",
"early": "1"
},
"splitLoans": [
{
"id": 4,
"displayId": "Test Loan 1",
"amount": "50"
}
],
"splitFeeOptions": "loan.splitFee.option.1"
}
Here is a breakdown of the parameters used in this request.
- data – This is the base payment data that will be posted.
- Date – The date the payment will be posted (formatted as YYYY-MM-DD)
- Amount – The total payment amount
- PaymentTypeId – ID of the payment type used (these can be found under Settings > Loan > Payments > Methods)
- Extra – How extra is applied. (Must match the Loan Setup Between Periods/Transactions value). See Payment Collections for more details
- chargeFeeType – The type of fee charged on the payment
- chargeFeeAmount – The amount of the fee being charged
- chargeFeePercentage – The charge fee percentage
- early – Whether the payment is early or not
- splitLoans – This details information for splitting between loans.
- id – The ID of the loan to apply a portion of the payment to
- displayId – The Display ID of the loan to apply a portion of the payment to
- amount – Amount of the payment to apply to the loan
- splitFeeOptions – This determines how to split the convenience fee. Possible values are:
- loan.splitFee.option.0 – Charge the convenience fee on the base loan ONLY
- loan.splitFee.option.1 – Charge the convenience fee from the base loan on EACH loan across which the payment is split
- loan.splitFee.option.2 – Pull and charge the default convenience fee from EACH loan across which the payment is split
- loan.splitFee.option.3 – Waive the fee for the base loan ONLY.
- loan.splitFee.option.4 – Waive the fee for the base loan and all loans over which the payment is split.
Applying Payment
When applying the payment, send a PUT request to one of the loans. For our example below, we'll split a payment between loans with the ID's of 3 and 4.
Here is the endpoint URL you will need to use. You can use either of your loan ID's here; for example, you have the option between the two following URL's.
PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(3)
or
PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(4)
Here is the body of the request.
{
"Payments": {
"results": [
{
"selectedProcessor": "",
"paymentMethodId": 1,
"early": 0,
"echeckAuthType": "payment.echeckauth.WEB",
"amount": "200",
"date": "2021-11-03",
"info": "Payment Split Test",
"paymentTypeId": 1,
"active": 1,
"resetPastDue": 0,
"payoffPayment": false,
"quickPay": "",
"CustomFieldValues": {},
"_saveProfile": 0,
"extra": "payment.extra.tx.principal",
"cardFeeType": "loan.cardfee.types.1",
"cardFeeAmount": "5",
"cardFeePercent": "5",
"__logOnly": true,
"payoffFlag": 0,
"__splitPaymentInLoans":"[{\"id\":3,\"displayId\":\"3\",\"amount\":\"100\",\"splitFeeOptions\":\"loan.splitFee.option.0\"},{\"id\":4,\"displayId\":\"4\",\"amount\":\"100\",\"splitFeeOptions\":\"loan.splitFee.option.0\"}]",
"__isSplited": true
}
]
}
}
}
You will want to change many of values in the request to fit the terms for your payment; however, it's important to pay special attention to the information in the "__splitPaymentInLoans" parameter. This information needs to match the loans you are splitting a payment between. Listed below are descriptions of the other parameters within the body.
- Extra – How extra is applied. (This must match the Loan Setup Between Periods/Transactions value). See Payment Collections.
- SplitPaymentInLoans – enter the information for the two loans that the payment will be split across.