Create an Invoiceīy now, you should be able to connect and authorize your sandbox company to use your app. This is why the code to check for the access token was created in the index file. If this step was done correctly, you'll find your access token object displayed in the code block that you created in the index page. The final step in this file is calling the processCallbackCode() and redirecting to the index.php page. To generate the access token, this object uses the exchangeAuthorizationCodeForToken() method, which takes two arguments-the URI code and realmId sent in the callback URI from the previous step. In the processCallbackCode() function, the first thing is to create the data service instance and then to load the OAuth2LoginHelper object. This array shows you the most important data that you need from the access token, which will be shown at the bottom of the HTML code below. If a token is generated, the token information is stored in $accessTokenArray. The following code inside the if statement checks if a token has already been generated and saved in the session variables. You have set this up already in the config.php file, so the parameters used are all imported from the $config array. To create an SDK instance using the data service object, you need to provide the right parameter to the DataService::Configure() function. You'll use this class in every step of this tutorial to connect with the API, handle authentication, generate and refresh the access token, and many other functions. The first three lines in this file are to load composer packages, the config.php file, and the DataService class from the QuickBooks API. To install the QuickBooks Online PHP SDK via composer, run the following line in your terminal after navigating to your project folder: QuickBooks offers an official PHP SDK for the Online Accounting API.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |