I'm the programmer for a company that sells a web-based business software product, that lets the user run their business. It has an A/R module. Our users use our software to enter payments from their customers and apply the payments to their customer-invoices in our system.
Our system is also required to sync all financial information to our user's Desktop QuickBoooks. We use the QB Web Connector to do this. I have written the code to send a ReceivePaymentAdd to their QB when they enter a payment in our system, and it works well. The only caveat is when our user's customer sends them an overpayment.
For example, their customer sends them a check for $50.00, but that customer only has an outstanding invoice for $45.00.
The way I'm handling that now is to reduce the check amount to $45.00 and create a credit memo in our system for $5.00. Then import the $45.00 payment into their QB (applied to the $45.00 invoice), and also import the credit memo for $5.00 (as a credit memo in QB).
We've realized that this approach doesn't work because it throws off their bank account (They have a check for $50.00 in their hands and we've only added a $45.00 payment to their QB).
I know I can send a ReceivePaymentAdd for the full $50.00, and have only $45.00 applied to invoices. If I do that, their customer will have a $5.00 credit balance in QB. And if I remove the code that reduces the payment amount and creates a credit memo in our system, then our system will also record a $5.00 credit for the customer.
I can program our Receive Payment screen to allow our users to apply such customer credits to invoices when entering a new payment, but how do I tell QB to do so? I see nothing in the IDN Unified OSR for that when I look at the ReceivePaymentAdd request.
So to continue the above example, suppose our user informs their customer they have a $5.00 credit, and the user makes a $25.00 purchase and sends a check for $20.00. Then I will have a ReceivePaymentAdd request with a $20.00 check payment amount, and $25.00 applied to an invoice. Will this work? Won't QB throw back an error that the amount applied to invoices is greater than the amount paid?
How do I tell QB (through the Web Connector) to use up the customer credit?
The QuickBooks API works exactly like the UI in this case. So, how would you do it in the UI?
In the UI, you'd ADD a RECEIVED PAYMENT for $50 initially, and apply only $45 of it. That leaves $5 of it unapplied.
Then, when they place the next order you'd ADD a RECEIVED PAYMENT of $20, and apply that to the new invoice. Then you'd go to the original, older received payment and UPDATE (modify) the RECEIVED PAYMENT to apply that remaining $5 to the new invoice.
You'll do the same thing via the API.
Do a ReceivePaymentMod
on the original payment, and apply the remaining unapplied payment amount to your new invoice.