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;