QBFC- entity reference keys between recievePaymentsToDeposits and Invoices and Customers

StackOverflow https://stackoverflow.com/questions/21240716

  •  30-09-2022
  •  | 
  •  

Question

I am developing a accounting third party C# form application for my company which bulk load the payments from external source, for prototype, I using an excel file for actual payment data.

Now that I have IRecievePaymenttoDeposit, I get all unpaid invoices with customer refs and by IInvoiceQuery I can get customers, but what is the reference keys for these two queries?

I will be getting a customer name, customer id and invoice no, how can I add the amount to the selected payment.

Was it helpful?

Solution

In order to apply a payment to an invoice, you need the TxnID of the invoice, which is different than the invoice number. You can use the invoice number, however to query for the invoice to get the TxnID.

IInvoiceQuery invQuery = MsgRequest.AppendInvoiceQueryRq();
invQuery.ORInvoiceQuery.InvoiceFilter.ORRefNumberFilter.RefNumberFilter.RefNumber.SetValue(invoiceNumber);

// Use either the full name of the customer or the ListID invQuery.ORInvoiceQuery.InvoiceFilter.EntityFilter.OREntityFilter.FullNameList.Add(customerName); invQuery.ORInvoiceQuery.InvoiceFilter.EntityFilter.OREntityFilter.ListIDList.Add(customerid);

Once you have the invoice, you get can get the TxnID. Then, when you create your ReceivePaymentAdd you specify the TxnID to apply the payment to:

// Create the payment add request
IReceivePaymentAdd pmtAdd = MsgRequest.AppendReceivePaymentAddRq();

// Create the AppliedToTxn request for the payment. IAppliedToTxnAdd appAdd = pmtAdd.ORApplyPayment.AppliedToTxnAddList.Append();

// Set the invoice TxnID and amount of the payment to apply appAdd.TxnID.SetValue(invoiceTxnID); appAdd.PaymentAmount.SetValue(amountToApply);

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top