Question

I am using C# to connect with QuickBooks desktop 2013. I need to record payments against a bill, but cannot figure out why it is not working. My current code keeps throwing an error of 3120 saying it can't find the bill, even though the bill object is open in my control. I've used the IDN Unified OSR provided by intuit for the BillPaymentCheckAdd object structure, but the "data" they pass in is just random and not helpful for what I actually need to pass in as values. So I could use some help. Here is my code for the pay bill method:

            IBillPaymentCheckAdd paymentAdd = requestMsgSet.AppendBillPaymentCheckAddRq();
            paymentAdd.PayeeEntityRef.ListID.SetValue(vendorId);
            paymentAdd.TxnDate.SetValue(DateTime.Now);
            paymentAdd.BankAccountRef.ListID.SetValue(bankAccount.ListID.GetValue());
            paymentAdd.ORCheckPrint.IsToBePrinted.SetValue(true);
            paymentAdd.Memo.SetValue(bankAccount.Name.GetValue());

            IAppliedToTxnAdd appliedToTxnAdd = paymentAdd.AppliedToTxnAddList.Append();
            appliedToTxnAdd.TxnID.SetValue(bill.TxnID.GetValue());
            appliedToTxnAdd.PaymentAmount.SetValue((double)amount);

            ISetCredit setCredit = appliedToTxnAdd.SetCreditList.Append();
            setCredit.CreditTxnID.SetValue(bill.TxnID.GetValue());
            setCredit.AppliedAmount.SetValue((double)amount);
            paymentAdd.IncludeRetElementList.Add(bankAccount.Name.GetValue());

            IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
            IResponse response = responseMsgSet.ResponseList.GetAt(0);
            IBillPaymentCheckRet paymentRet = (IBillPaymentCheckRet)response.Detail;
Was it helpful?

Solution

I think the error that you are getting is referring to the setCredit section. The credits are used to apply a previous vendor credit to a bill. You are passing in the Bill TxnID as the credit, but it's a bill transaction, not a credit transaction so QuickBooks is saying it can't find the credit transaction as it doesn't really exist.

If you remove the 4 line section for the ISetCredit, your payment should go through correctly.

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