# API – Updating Payments

### General

When a payment is edited, an entirely new payment record that references the original payment is created. The new payment record becomes active, while the original payment is set to an inactive status (labeled "edited" in the UI). Thus, a payment ID can only be updated once, since it's replaced by a new payment. In addition, an edited payment becomes the parent payment and its updated payment becomes the child.

### How To

There is one field to pay special attention to—the "comments" field. This field is always required to update a payment, and it allows you to keep track of why a payment was changed.

To change a payment, send a PUT request to the URL of the loan. We will use a loan with the ID of 667 in our example below:

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

Remember to replace "667" with the ID of your loan when you try this yourself.

Below is a sample request for updating a payment with the id 1213. Pay special attention to the "comments" field, since it is required to update a payment.

{  "Payments": {    "results": [      {        "id": 1213,        "displayId": 3089,        "payoffFlag": 0,        "info": "11/17/2015",        "date": "2015-11-17",        "priorcutoff": false,        "amount": "60.19",        "paymentMethodId": 4,        "paymentTypeId": 1,        "extra": "payment.extra.tx.principalonly",        "active": 1,        "beforeAmountPastDue": "0.00",        "beforeDaysPastDue": 0,        "beforeNextDueAmount": "67.19",        "beforeNextDueDate": "2015-11-20",        "beforePayoff": "1351.73",        "beforePrincipalBalance": "1333.00",        "comments": "This is a comment",        "early": 1,        "echeckAuthType": "payment.echeckauth.TEL",        "status": "None",        "sortDate": 201511171,        "systemComments": [],        "chargeOffRecovery": 0,        "CustomFieldValues": {          "results": []        },        "order": 3,        "_notEditable": false,        "payoffPayment": false,        "quickPay": "",        "__logOnly": true,        "__id": 1213,        "__update": true      }    ]  }}

Here is a breakdown of the parameters used in the body of this request:

 Parameter Description id The system ID of the payment. This is the value within the parentheses. displayId The display ID of the payment. This is the value outside the parentheses. payoffFlag This sets a flag for payoff payments.1 - yes, 0 - no info This is info recorded about the payment. Normally, it includes the apply date and the payment method. date This is the date that the payment should apply, and it is formatted as YYYY-MM-DD. priorcutoff This determines if the payment is prior to the tenant cutoff date. amount This is the amount of the payment. paymentMethodId This is the payment method used for the payment. These IDs can be found under Settings > Loan > Payments > Methods. extra This determines how extra is applied. This parameter uses a collection entity, and you can see the available options on our API – Payments Collections article. active This determines if the payment will apply to the loan. Setting it to "not active" means that there is a record, but it has no bearing on the loan.1 - active, 0 - not active beforeAmountPastDue This sets the amount past due before the payment being made. beforeDaysPastDue This sets the amount of days past due before the payment being made. beforeNextDueAmount This sets the amount of the next due payment. beforeNextDueDate This sets the date of the next due date, formatted as YYYY-MM-DD. beforePayoff This is the payoff remaining before the payment being made. beforePrincipalBalance This is the remaining principal balance before the payment being made. comments This parameter is used to describe any changes to the payment. It is required for this request to work. early This determines if the payment should apply to the next payment as "early".1 - yes, 0 - no echeckAuthType This determines the type of e-check authorization that the payment uses. This values uses a collection entity, and you can see the available options on our API – Payments Collections article. status This updates the status of the loan. sortDate This determines how to sort the loan, if applicable. It needs to be entered as an (int). systemComments This field is used for comments added by the system. chargeOffRecovery This determines whether this payment is a charge-off recovery.1 - yes, 0 - no CustomFieldValues This can be used to display any custom field values. order This is used as a tiebreaker if a tie exists in ordering. _notEditable This determines if the loan update should be editable. payoffPayment This determines if the payment is a pay-off payment.1 - yes, 0 - no quickPay This sets the QuickPay amount, if applicable. QuickPay is a feature that auto-fills the remaining balance on a pay-off payment. __logOnly This determines if the update only logs the payment. __id This is the system ID of the payment, like listed earlier. __update This determines if the payment is updated.