API – Logging a Payment on a Parent-Child Loan
General
In this article, we will cover how to log a payment for a parent loan through the API. Logging a payment on a parent loan requires additions to the typical payment payload.
To log a payment, use the request:
PUT https://loanpro.simnang.com/api/public/api/1/odata.svc/Loans(id)
Make sure to change id to the ID of the parent loan. The payload should look something like this:
{
"Payments":{
"results":[
{
"selectedProcessor":"",
"paymentMethodId":1,
"early":0,
"echeckAuthType":"payment.echeckauth.WEB",
"amount":"300",
"date":"2021-11-02",
"info":"11/02/2021 Cash",
"paymentTypeId":2,
"active":1,
"resetPastDue":0,
"payoffPayment":false,
"quickPay":"",
"CustomFieldValues":{
"results":[
]
},
"_saveProfile":0,
"extra":"payment.extra.tx.principal",
"cardFeeType":"loan.cardfee.types.1",
"cardFeeAmount":"5",
"cardFeePercent":"5",
"_$hasParentChildTableError":false,
"__logOnly":true,
"payoffFlag":0,
"__splitPaymentInLoans":"[]",
"TransactionChilds":{
"results":[
{
"loanChildId":10,
"childEntityId":"",
"entityId":"",
"entityType":"Entity.Payment",
"amount":"75.00"
},
{
"loanChildId":11,
"childEntityId":"",
"entityId":"",
"entityType":"Entity.Payment",
"amount":"105.00"
},
{
"loanChildId":12,
"childEntityId":"",
"entityId":"",
"entityType":"Entity.Payment",
"amount":"120.00"
}
]
}
}
]
}
}
If you receive an error, try changing the "date" to a more recent one.
The difference between a standard payment and a payment on a parent loan is that the payload contains the TransactionChilds object. If you want the payment to be split based on the default values that were entered when the loans were linked, this object is not required. If you want a different split, include the TransactionChilds object. Each of the results in this object should contain the following information:
Variable | Description |
loanChildId | This is the ID of the child loan. |
entityType | This should equal Entity.Payment. |
amount | This is the amount that will be applied to the child loan. |