We want to make it as easy as possible for developers to launch their ideas with QuickBooks Online, which is why we provide a variety of SDKs and libraries to help with the leg-work of your integration. In this post, Ill walk through the steps to get up and running with the PHP SDK for QuickBooks Online.
Authentication can be the hardest part of getting an API connection set up, so we created an example application that you can use to see how a successful OAuth connection works.
You can either clone the project from GitHub here: https://github.com/IntuitDeveloper/oauth-php or download it directly to your computer: https://github.com/IntuitDeveloper/oauth-php/archive/master.zip
This application is just a thin client on top of our PHP SDK to show the different legs of OAuth authentication. It was originally intended to be used with a local Apache instance, but any web server setup that allows for you to navigate to the different pages and that will execute the PHP code will work just fine.
Next (if you haven’t yet), youll want to create an account on the Intuit Developer site, and create a new app. It’s easy and free, just head over to developer.intuit.com and and click on the sign-in on the top right. If you dont have an account already, select the ‘create an account and fill out your information.
Navigate to the ‘My Apps menu item at the top, and create a new app. From there, you can select the ‘Keys tab and see your apps token, which identifies your app uniquely to Intuit, as well as the OAuth consumer Keys and Secrets that you will need to authenticate your requests.
You can use those credentials to complete your first authentication with the PHP SDK. In the oauth-php project you downloaded, open up the PHPOAuthSample folder and a file inside named ‘config.php. There you will be able to add in the OAuth consumer key and secret from the Intuit Developer site to work with the OAuth PHP sample project.
Now, with your webserver started, you should be able to access the index.php page through a browser and see a button with a ‘Connect to QuickBooks image. This is similar to the user experience that your end users will have when authenticating your app. If you just see a bunch of unformatted PHP code, then you probably do not have your webserver configured to execute PHP. Note that this demo uses the QuickBooks Online Sandbox companies, which is great for testing but isn’t what your final application will use.
After connecting your app to your sandbox QuickBooks Online account (which finishes the last legs of OAuth) you should see a page with your OAuth access tokens. These tokens are only good for a limited amount of time, but you can use them along with your OAuth consumer key and secret to start making requests with the PHP SDK. Hopefully this will help you get started with the QuickBooks Online APIs and the PHP SDK.
As always, feel free to ask questions or share your success (or struggles!) on our developer forums or DM to us on twitter at @IntuitDev.
Note: the OAuth-PHP example project isn’t meant to be taken and used in production business applications. In other words, this is not a seed project to be taken carte blanche and deployed to your production environment. For example, certain concerns such as security or scalability are not addressed, so it is important to understand how your application will need to address them.
Leave a Reply