How to update Credit Account balance

I am working for a customer on a procedure that needs to reset Credit Account balance. Following code ignores creditAccountID and does not update balance at CreditAccount.
What am I missing? Thank you.
url: https://api.lightspeedapp.com/API/Account/<UserAccountID>/Sale.json
Body:{
"employeeID": "1",
"registerID": "3",
"shopID": "1",
"customerID": "1",
"completed": "true"
"SaleLines": {
"SaleLine": {
"itemID": "0",
"note": "test reset CA balance",
"unitQuantity": "1",
"unitPrice": "-1.13",
"taxClassID": "0",
"avgCost": "0",
"fifoCost": "0"
}
},
"SalePayments": {
"SalePayment": {
"amount": "-1.13",
"paymentTypeID": "11",
"creditAccountID": "1"
}
}
}
This ignores creditAccountID
"paymentTypeID": "11" is custom paymentType.
If I use "paymentTypeID": "4" it works fine.
Answers
Hi Zoran,
You need to use the payment type 'credit account' (in this case '4') to apply a deposit to a credit account with the API. This is similar to the workflow in the UI, where after you add a misc item with a negative amount to a sale in order to credit the customer account, when you click on 'Payment,' you need to use type 'Account' to credit the amount to the account. If you use a different type, it's as if you're refunding to that type, not the account.
This is not made explicit in the documentation, so I will update it to make it more clear.
Lightspeed HQ
Hi Leah,
Thank you for the answer. I will have to play with what I have.
I will use paymentTypeID=4 to balance out the credits, but I will need to save a note to mark this 'balancing' process.
The code above (with paymentTypeID=4) works , but the "note" is not saved. Can you help me figure out why.
Or, if you have a suggestion on how to mark payments done by this 'Reset Credit Account Balance' procedure.
Thank you
The answer to your question is likely found here: https://developers.lightspeedhq.com/retail/tutorials/salenotes/
If that doesn't help, could you explain your workflow and end goal in a bit more detail so I can advise? Thanks!
Lightspeed HQ
Thank you Leah,
Let me try this and I'll get back to you.
Zoran
Hello Lea,
I found a way to get the result I wanted.
Thank you,
Zoran