c# - quickbooks sdk add payment -
hi i've been trying add payments using quickbooks sdk, far i'm able when send request quickbooks got message transaction empty
here sample code: code using 1 of sample company quickbooks if past on c# project run right away
private static void createpayment() { //var customers = getcustomers(); bool sessionbegun = false; bool connectionopen = false; qbsessionmanager sessionmanager = null; try { //create session manager object sessionmanager = new qbsessionmanager(); //create message set request object hold our request imsgsetrequest requestmsgset = sessionmanager.createmsgsetrequest("us", 8, 0); requestmsgset.attributes.onerror = enrqonerror.roecontinue; //connect quickbooks , begin session sessionmanager.openconnection(@"qid", "quickbooks integration demo"); connectionopen = true; sessionmanager.beginsession(@"c:\users\public\documents\intuit\quickbooks\sample company files\quickbooks enterprise solutions 15.0\sample_product-based business.qbw", enopenmode.ommultiuser); //sessionmanager.beginsession("", enopenmode.omdontcare); sessionbegun = true; ireceivepaymentadd payment = requestmsgset.appendreceivepaymentaddrq(); payment.customerref.listid.setvalue("260000-933272658"); //payment.totalamount.setvalue(100.00); //payment.orapplypayment.isautoapply.setvalue(true); ////// create appliedtotxn request payment. iappliedtotxnadd paymentline = payment.orapplypayment.appliedtotxnaddlist.append(); //// set invoice txnid , amount of payment apply paymentline.txnid.setvalue("8b8-933372331"); paymentline.paymentamount.setvalue(100.00); //send request , response quickbooks imsgsetresponse responsemsgset = sessionmanager.dorequests(requestmsgset); iresponse response = responsemsgset.responselist.getat(0); var statusmessage = response.statusmessage; console.writeline(statusmessage); //ireceivepaymentadd done = (ireceivepaymentadd)response.detail; } catch (exception ex) { console.writeline(ex.message); //messagebox.show(ex.message, "error"); } { //end session , close connection quickbooks if (sessionbegun) { sessionmanager.endsession(); } if (connectionopen) { sessionmanager.closeconnection(); } } console.readline(); }
you must sent total amount in order add payment quickbooks.
you have line set total amount commented out:
//payment.totalamount.setvalue(100.00);
uncomment , you're go.
Comments
Post a Comment