Reputation: 11
I am trying to debug an issue.
TLDR: Quickbooks is returning an error saying the Invoice does not exist. But checking in QB or searching via sync, it exists.
Everything was working fine, until 1 day, it stopped.
Background Details
No Code changes whatsoever.
I believe no Quickbooks changes that would cause any issue. Client says they didn't make any changes to their quickbooks either.
There was a QB software update a week before. But the Sync worked fine after that.
Everything else still works.
PHP Version: 5.4.45
Quickbooks PHP Integrator Version: 1.5.2 (https://github.com/consolibyte/quickbooks-php)
Quickbooks Version: Quickbooks 2018 Premier
It is a very basic system. It just adds new Customers, adds new Invoices/Charges, and adds Payments to those Invoices/Charges into their quickbooks. It has worked for 10+ years. Yes, the PHP Quickbooks Sync is quite old. I don't believe the issue is with that though?
The Issue
As of a few days ago, ANY payment trying to be sent to quickbooks to apply to an invoice, gets rejected and returns the following error message in the php quickbooks queue table:
3120: Object "6741D-1666222191" specified in the request cannot be found.
This happens with ANY and EVERY payment being sent. Same error, everytime (with the invoice TxnID accordingly). It is still able to sync over new customers, add new invoices. But payments return this error. This all happened pretty suddenly. On a Wednesday, it worked fine. The next day Thursday, error.
Debugging
I have checked quickbooks itself to verify if the charge/invoice is there. It shows under the customer. I have run a Invoice Query () to search for the invoice, and the invoice exists and is returned in the results. I have verified that the customer exists. I have verified that the ListIDs are correct. The Quickbooks user should have permissions as it is being tested under their Admin user.
The Transaction ListID that it is trying to apply the payment is correct. The Customer it is trying to apply it to, is correct (as you can see below in the XML of what is being sent)
Code
Here is the XML being sent for the invoice being sent over. I have made changes such as removing sensitive info.
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="4.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<InvoiceAddRq requestID="SW52b2ljZUFkZHwyNTk0Ng==">
<InvoiceAdd>
<CustomerRef>
<ListID>80000717-1371847043</ListID>
</CustomerRef>
<TemplateRef>
<ListID>80000001-1214875504</ListID>
</TemplateRef>
<TxnDate>2022-10-18</TxnDate>
<InvoiceLineAdd>
<ItemRef>
<ListID>800000F0-1639001986</ListID>
</ItemRef>
<Desc>Item Description</Desc>
<Quantity>1</Quantity>
<Amount>350.00</Amount>
</InvoiceLineAdd>
</InvoiceAdd>
</InvoiceAddRq>
</QBXMLMsgsRq>
</QBXML>
Response
<?xml version="1.0" ?>
<QBXML>
<QBXMLMsgsRs>
<InvoiceAddRs requestID="SW52b2ljZUFkZHwyNTk0Ng==" statusCode="0" statusSeverity="Info" statusMessage="Status OK">
<InvoiceRet>
<TxnID>6741D-1666222191</TxnID>
<TimeCreated>2022-10-19T16:29:51-08:00</TimeCreated>
<TimeModified>2022-10-19T16:29:51-08:00</TimeModified>
<EditSequence>1666222191</EditSequence>
<TxnNumber>79922</TxnNumber>
<CustomerRef>
<ListID>80000717-1371847043</ListID>
<FullName>LastName, FirstName</FullName>
</CustomerRef>
<ARAccountRef>
<ListID>8000002C-1215020650</ListID>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TemplateRef>
<ListID>80000001-1214875504</ListID>
<FullName>Intuit Product Invoice</FullName>
</TemplateRef>
<TxnDate>2022-10-18</TxnDate>
<RefNumber>27345</RefNumber>
<BillAddress>
<Addr1>Address 1</Addr1>
<Addr2>Address 2</Addr2>
<City>City</City>
<State>State</State>
<PostalCode>ZIP</PostalCode>
</BillAddress>
<IsPending>false</IsPending>
<IsFinanceCharge>false</IsFinanceCharge>
<DueDate>2022-10-18</DueDate>
<ShipDate>2022-10-18</ShipDate>
<Subtotal>350.00</Subtotal>
<SalesTaxPercentage>0.00</SalesTaxPercentage>
<SalesTaxTotal>0.00</SalesTaxTotal>
<AppliedAmount>0.00</AppliedAmount>
<BalanceRemaining>350.00</BalanceRemaining>
<IsPaid>false</IsPaid>
<IsToBePrinted>true</IsToBePrinted>
<InvoiceLineRet>
<TxnLineID>6741F-1666222191</TxnLineID>
<ItemRef>
<ListID>800000F0-1639001986</ListID>
<FullName>Item Name</FullName>
</ItemRef>
<Desc>Item Description</Desc>
<Quantity>1</Quantity>
<Rate>350</Rate>
<Amount>350.00</Amount>
<SalesTaxCodeRef>
<ListID>80000002-1214875507</ListID>
<FullName>Non</FullName>
</SalesTaxCodeRef>
</InvoiceLineRet>
</InvoiceRet>
</InvoiceAddRs>
</QBXMLMsgsRs>
</QBXML>
Sending Payment
<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="2.0"?>
<QBXML>
<QBXMLMsgsRq onError="stopOnError">
<ReceivePaymentAddRq requestID="UmVjZWl2ZVBheW1lbnRBZGR8MzM0MDU=">
<ReceivePaymentAdd>
<CustomerRef>
<ListID>80000717-1371847043</ListID>
</CustomerRef>
<TxnDate>2022-10-18</TxnDate>
<RefNumber>RefNumber</RefNumber>
<TotalAmount>350.00</TotalAmount>
<PaymentMethodRef>
<ListID>80000005-1214879441</ListID>
</PaymentMethodRef>
<Memo></Memo>
<AppliedToTxnAdd>
<TxnID>6741D-1666222191</TxnID>
<PaymentAmount>350.00</PaymentAmount>
</AppliedToTxnAdd>
</ReceivePaymentAdd>
</ReceivePaymentAddRq>
</QBXMLMsgsRq>
</QBXML>
Searching Invoices, it returns in the search
<InvoiceRet>
<TxnID>6741D-1666222191</TxnID>
<TimeCreated>2022-10-19T16:29:51-08:00</TimeCreated>
<TimeModified>2022-10-19T16:29:51-08:00</TimeModified>
<EditSequence>1666222191</EditSequence>
<TxnNumber>79922</TxnNumber>
<CustomerRef>
<ListID>80000717-1371847043</ListID>
<FullName>LastName, FullName</FullName>
</CustomerRef>
<ARAccountRef>
<ListID>8000002C-1215020650</ListID>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TxnDate>2022-10-18</TxnDate>
<RefNumber>27345</RefNumber>
<BillAddress>
<Addr1>Address 1</Addr1>
<Addr2>Address 2</Addr2>
<City>City</City>
<State>State</State>
<PostalCode>ZIP</PostalCode>
</BillAddress>
<IsPending>false</IsPending>
<IsFinanceCharge>false</IsFinanceCharge>
<DueDate>2022-10-18</DueDate>
<ShipDate>2022-10-18</ShipDate>
<Subtotal>350.00</Subtotal>
<SalesTaxPercentage>0.00</SalesTaxPercentage>
<SalesTaxTotal>0.00</SalesTaxTotal>
<AppliedAmount>0.00</AppliedAmount>
<BalanceRemaining>350.00</BalanceRemaining>
<IsPaid>false</IsPaid>
<IsToBePrinted>true</IsToBePrinted>
</InvoiceRet>
Upvotes: 0
Views: 209
Reputation: 27952
Other things you should check on:
qbXML
version. You're using 2.0
, which is like 15+ years old.ARAccountRef/FullName
the invoice is in when adding the payment. If you have multiple A/R
accounts, it's possible QuickBooks is defaulting you to the other A/R
account when trying to create the payment, and thus can't find the invoice that's in Accounts Receivable
ReceivePaymentAdd
request?<IsAutoApply>true</IsAutoApply>
instead of the <AppliedToTxnAdd>
node.Upvotes: 0