paymentquickbooksqbxmlqbwc

With QBXML how can I unapply a transaction from a ReceivePayment from the remote system?


I want to unapply a payment from an invoice from the remote system.

First I sync from QuickBooks Desktop a ReceivePayment item. It has 1 invoice transaction in AppliedToTxnRet of the ReceivePaymentQueryRS response.

Then on the remote system the transaction is removed from the invoice. So now there are no transactions that this payment is applied to. In QBXML how can I specify this in the ReceivePaymentModRq or is there some other way to specify it to send it back to QuickBooks so that the payment is no longer applied to the invoice in QuickBooks?

I tried to send an empty <AppliedToTxnMod/> or <AppliedToTxnMod></AppliedToTxnMod> like this:

        <ReceivePaymentModRq>
            <ReceivePaymentMod>
                <TxnID>612-1631305229</TxnID>
                <EditSequence>1631418450</EditSequence>
                <CustomerRef>
                    <ListID>80000089-1613077827</ListID>
                </CustomerRef>
                <ARAccountRef>
                    <ListID>8000001B-1578805288</ListID>
                </ARAccountRef>
                <TxnDate>2021-09-04</TxnDate>
                <RefNumber>cash11</RefNumber>
                <TotalAmount>11.00</TotalAmount>
                <PaymentMethodRef>
                    <ListID>80000001-1578006261</ListID>
                </PaymentMethodRef>
                <Memo/>
                <DepositToAccountRef>
                    <ListID>80000021-1620340635</ListID>
                </DepositToAccountRef>
                <AppliedToTxnMod/>
            </ReceivePaymentMod>
        </ReceivePaymentModRq>

But the validator gives me:

Line: 13
LinePos: 48
Src Text: <AppliedToTxnMod></AppliedToTxnMod>
Reason: Element cannot be empty according to the DTD/Schema.

I was going off of what I thought the QBSDK was saying (https://static.developer.intuit.com/resources/QBSDK_ProGuide.pdf) on p. 126 for clearing an aggregate, but I guess maybe that doesn't apply to aggregates that reference other transactions??:

"Clearing an aggregate such as an address or shipping address is similar to clearing a reference in a Modify request. You can either provide empty versions of all the elements in the aggregate, or you can simply provide an empty aggregate"


Solution

  • To unapply a payment from a transaction, such as an invoice, in the <ReceivePaymentMod> send the <AppliedToTxnMod> aggregate referencing the <TxnID> that you want to remove with a zero amount in <PaymentAmount>. For example:

    <ReceivePaymentMod>
        <TxnID>612-1631305229</TxnID>
        ...
        <AppliedToTxnMod>
            <TxnID>52F-1630633150</TxnID>
            <PaymentAmount>0.00</PaymentAmount>
        </AppliedToTxnMod>
    </ReceivePaymentMod>