I am trying to post a payment and have it applied to an invoice, My code is below and when I run it I get the following error. Am I missing something here? Any help would be appreciated.
<errormessage><error><errorno>DL03000005</errorno><description></description><description2>No record exists for the invoice key INV00002 [Support ID: RWTqRWEB031%7EZetZCP5G0hF4r1u-NS7-KwAAAAw]</description2><correction></correction></error></errormessage>
here is the code - it's pretty much straight from sdk/tests
const record = new IA.Functions.AccountsReceivable.ArPaymentCreate();
record.customerId = 'valid_cid';
record.transactionPaymentAmount = 123.00;
record.receivedDate = new Date();
record.paymentMethod = 'Credit Card';
record.referenceNumber = 'abc123';
const applyToRecordA = new IA.Functions.AccountsReceivable.ArPaymentItem();
applyToRecordA.applyToRecordId = 'INV00002';
applyToRecordA.amountToApply = 123.00;
record.applyToTransactions = [
applyToRecordA
];
record.creditCardType = 'Visa';
record.bankAccountId = 'bank_123';
return this.iaClient.execute(record);