rstewart
rstewart

Reputation: 465

quickbooks online recievepaymentadd

i am trying to add a payment to quickbooks online from my web app. This is the xml that i am sending:

          <?xml version="1.0" encoding="utf-8"?>
          <?qbxml version="6.0"?>
          <QBXML>
                <SignonMsgsRq>
                      <SignonTicketRq>
                            <ClientDateTime>2013-05-09T01:37:58</ClientDateTime>
                            <SessionTicket>V1-115-Q04ffswegvh9uzxaw8qrud:689712285</SessionTicket>
                            <Language>English</Language>
                            <AppID>688664435</AppID>
                            <AppVer>1</AppVer>
                      </SignonTicketRq>
                </SignonMsgsRq>
                <QBXMLMsgsRq onError="stopOnError">
                      <ReceivePaymentAddRq>
                            <ReceivePaymentAdd defMacro="MACROTYPE"> <!-- required -->
                                  <CustomerRef> <!-- required -->
                                        <ListID >5</ListID> <!-- optional -->
                                  </CustomerRef>
                                  <ARAccountRef> 
                                        <FullName>Accounts Receivable:Customer Receivables</FullName>
                                  </ARAccountRef>
                                  <AppliedToTxnAdd> <!-- optional, may repeat -->
                                        <TxnID useMacro="MACROTYPE" >143</TxnID> <!-- required -->
                                  </AppliedToTxnAdd>
                                  <TxnDate >2013-05-09</TxnDate>
                                  <RefNumber >123</RefNumber>
                            </ReceivePaymentAdd>
                      </ReceivePaymentAddRq> 
                </QBXMLMsgsRq>
          </QBXML>

I get an error saying:

 SAX parser encountered an error parsing request file.
Exception from other package:
 org.xml.sax.SAXParseException: The content of element type "ReceivePaymentAdd" must match "(CustomerRef,ARAccountRef?,TxnDate?,RefNumber?,TotalAmount?,PaymentMethodRef?,Memo?,DepositToAccountRef?,CreditCardTxnInfo?,(IsAutoApply|AppliedToTxnAdd+)

I just need to apply a payment to an invoice. The payment will always be for the full amount of the invoice.

Any ideas what is wrong?

Thanks Randy

Upvotes: 2

Views: 474

Answers (1)

Keith Palmer Jr.
Keith Palmer Jr.

Reputation: 28032

The order of tags in qbXML matters.

So if the Intuit OSR reference shows you that the correct order of tags is:

<CustomerRef>
  <ListID>IDTYPE</ListID>
</CustomerRef>
<ARAccountRef>
  <FullName>STRTYPE</FullName>
</ARAccountRef>
<TxnDate>DATETYPE</TxnDate>
<RefNumber>STRTYPE</RefNumber>
...
<AppliedToTxnAdd> ...

And you instead send tags in this order:

<CustomerRef>
  <ListID >5</ListID>
</CustomerRef>
<ARAccountRef> 
  <FullName>Accounts Receivable:Customer Receivables</FullName>
</ARAccountRef>
<AppliedToTxnAdd>
  <TxnID useMacro="MACROTYPE" >143</TxnID>
</AppliedToTxnAdd>
<TxnDate >2013-05-09</TxnDate>
<RefNumber >123</RefNumber>

Then you're going to get errors.

(notice you have TxnDate and RefNumber after the AppliedToTxnAdd tag, when the spec defines it as coming before the AppliedToTxnAdd tag)

What it's trying to tell you here:

The content of element type "ReceivePaymentAdd" must match "(CustomerRef,ARAccountRef?,TxnDate?,RefNumber?,TotalAmount?,PaymentMethodRef?,Memo?,DepositToAccountRef?,CreditCardTxnInfo?,(IsAutoApply|AppliedToTxnAdd+)

Is that it's expecting tags in that order, and you sent them in a different order than it expected.

If you fix the order of the tags, it will work.

We have some example qbXML requests on our QuickBooks integration wiki guide if that helps.

Upvotes: 2

Related Questions