I want to integrate QuickBooks Online app with my PHP application. I have downloaded the latest PHP SDK. But there I need realm id to start with. Please help me here.
And if any other requirements I need, please guide me for the same.
Please take a look at the documentation as you need to go through a 3 legged Oauth process and in your callback URL you will receive the realmId.
https://developer.intuit.com/docs/0025_quickbooksapi/0010_getting_started
regards,
Jarred
I built a nice sample app that you can run: http://runnable.com/UtEZ4OpSEoFzAACs/quickbooks-oauth-%2B-list-customers-example-for-php-intuit-intuit-partner-platform-and-ipp
Ping me if you have issues running this code.
If you go to the index.php file and uncomment the line:
//echo "realmId: $realmId <br />";
That will print the realmId for you.
After you implement Oauth one of the returns from the Oauth process is the realmID.
If you use our open source PHP DevKit it includes a sample of how to get your realm ID and other OAuth credentials. It's also documented on Intuit's website - but unless you're very familiar with OAuth, usually it's easier to start with something pre-built.
If you take a look at the example app we provide:
It comes with the components to get your OAuth tokens built-in. You just slap a bit of JavaScript on your page:
<script type="text/javascript" src="https://appcenter.intuit.com/Content/IA/intuit.ipp.anywhere.js"></script>
<script type="text/javascript">
intuit.ipp.anywhere.setup({
menuProxy: '<?php print($quickbooks_menu_url); ?>',
grantUrl: '<?php print($quickbooks_oauth_url); ?>'
});
</script>
<ipp:connectToIntuit></ipp:connectToIntuit>
Which show's the "Connect to QuickBooks" button on your site. Click the button and you'll be walked through getting the OAuth tokens and realm ID. They will automatically be stored in a database so you can use them to access data from QuickBooks Online.
Data access is then as easy as:
// Get our OAuth credentials from the database $creds = $IntuitAnywhere->load($the_username, $the_tenant);
// Tell the framework to load some data from the OAuth store $IPP->authMode( QuickBooks_IPP::AUTHMODE_OAUTH, $the_username, $creds);
// This is our current realm $realm = $creds['qb_realm'];
// Load the OAuth information from the database if ($Context = $IPP->context()) { // Set the IPP version to v3 $IPP->version(QuickBooks_IPP_IDS::VERSION_3);
$CustomerService = new QuickBooks_IPP_Service_Customer(); $customers = $CustomerService->query($Context, $realm, "SELECT * FROM Customer ");
Additional help for using the DevKit can be found on these forums.