Create Customer Payment via REST API with Invoices applied
I am creating a series of payments via API and for each of them, I want to be able to apply invoice(s) in the apply sublist. I am using a POST to /record/v1/customerpayment with a body that contains a set of fields that work on their own, but when I include an object for the “apply” field with an array of one “items” I get an error:
“Error while accessing a resource. You have attempted an invalid sublist or line item operation. You are either trying to access a field on a non-existent line or you are trying to add or remove lines from a static sublist.”
For reference, here is the block that I have included that triggers the failure:
I have checked that the invoice refNum of 39659 is one of the options that appears as open on the referenced customer. Is there something obvious I am doing wrong? I am following a similar approach that a user in this thread has stated works for them:
https://netsuiteprofessionals.com/question/how-can-i-batch-invoices-into-customer-payments-using-the-rest-api/ – using ‘doc’ to reference an invoice, but I can’t seem to get that to work. Thanks!