Search code examples
sdkquickbooksqbxmlqbfc

qbfc/qbxml ReceivePaymentAdd assign Payment to Invoice


When I try to associate a Payment with an Invoice, I get the following error:

ReceivePaymentAdd
ORApplyPayment:
OR object has multiple values
End of ORApplyPayment
End of ReceivePaymentAdd

What does that error mean? How do I get this to work?

Note that I am pushing the Invoice into QuickBooks in a separate session, so I cannot use Macros. If I use IsAutoApply true without the AppliedToTxnAdd block, the payment pushes just fine.

Here is the generated xml:

<?xml version="1.0" encoding="utf-8"?>
<?qbxml version="10.0"?>
<QBXML>
<QBXMLMsgsRq onError = "continueOnError">
<ReceivePaymentAddRq requestID = "0">
<ReceivePaymentAdd>
<CustomerRef>
<ListID>8000003F-1415364262</ListID>
</CustomerRef>
<ARAccountRef>
<FullName>Accounts Receivable</FullName>
</ARAccountRef>
<TxnDate>2014-02-14</TxnDate>
<RefNumber>1003 - P1</RefNumber>
<TotalAmount>850.00</TotalAmount>
<PaymentMethodRef>
<FullName>20 - Check</FullName>
</PaymentMethodRef>
<Memo/>
<IsAutoApply>0</IsAutoApply>
<AppliedToTxnAdd>
<TxnID>C7-1415364350</TxnID>
<PaymentAmount>850.00</PaymentAmount>
</AppliedToTxnAdd>
</ReceivePaymentAdd>
</ReceivePaymentAddRq>
</QBXMLMsgsRq>
</QBXML>

Solution

  • This:

    ORApplyPayment: OR object has multiple values End of ORApplyPayment

    Means that the specification (see the QuickBooks OSR) specifies that you can use EITHER AppliedToTxnAdd OR you can use IsAutoApply, but you may not use both of them. You can use one, OR the other.

    You're using both, so you're getting an error message. Either remove <IsAutoApply> or remove your <AppliedToTxnAdd> tag.

    Here's an example for you: