I hope to provide you with enough information to get you familiar with coding PHP to work with Quickbooks Web Connector. I am going to expand on the very useful php tutorial for Quickbooks Web Connector posted by the wonderful guys at ubercart. Please read what they have provided, and then come back here for a few things I thought to be helpful.
Where to put the Webservice
Initially, I just assumed I would put the webservice on one of my sites. I found out that when you create and try to add your QB Web Connector (QBWC) application, it will try to verify the security of your site. I ran into that problem so I decided to host my web service on the local machine that had QBWC installed on it. So I installed Wamp on the machine, then put my webservice on there as well, and it worked great because when your QWC app is looking on the localhost it ignores the security check. My action queue table has a few fields like: ID, orderNumber, isComplete, and a timestamp.
Since the Quickbooks Web Connector basically processes “batches”, I needed a way for an employee to request a single order to be processed. We used to use QB RDS server (remote data sharing server) which was an “on command” type of method. QBWC works backwards from that requests originate from QB instead of from an employee. So I added the functionality for an employee to add an order to the queue to be processed. This helped fill the void left from the RDS server that we no longer use. Its not immediate, but it works.
It took me awhile to figure out how the action queue worked. I was used to making one call to the web service to process a list of orders or transactions or whatever. The QWC app makes one call though, and then your web service says back to it either, “Please make another call because I’ve got another order to process” or it’ll say, “I’m done so don’t make another call to this web service.” In the beginning I was hoping to just query what orders needed to be processed, process them, and then say back to the QWC app, “I’m done.” Since it makes seperate calls though, I created a table (an action queue table) that my web service could call at anytime and say things like: “Is there an order ready to be put into Quickbooks? If so, which one?”, “How many orders are left before I’m finished?”, and “Please mark this order as being processed so I don’t process it again.” Those turn into your functions that the ubercart guys have used in their code.
I know I didn’t cover everything, and I didn’t provide any code sample. The guys at Ubercart did provide code sample though that gave me a good enough idea of how the Quickbooks Web Connector works in PHP. If you have any questions, feel free to ask here by posting a comment and I’ll see if I can help. But know in advance, I’m no “Quickbooks know-it-all” kind of person so don’t expect a perfect answer.
Filed under: Web Developing on August 3rd, 2007