PHP code example of omcrn / yii2-quickbooks
1. Go to this page and download the library: Download omcrn/yii2-quickbooks library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
omcrn / yii2-quickbooks example snippets
QB_BASE_URL = https://quickbooks.api.intuit.com/
QB_DISCOVERY_DOCUMENT = https://developer.intuit.com/.well-known/openid_sandbox_configuration/
QB_CLIENT_ID = ****************************************
QB_CLIENT_SECRET = ****************************************
QB_OAUTH_SCOPE = com.intuit.quickbooks.accounting
QB_REALM_ID = ****************************************
$qb = new Quickbooks([
'authMode' => "oauth2",
'clientId' => getenv("QB_CLIENT_ID"),
'clientSecret' => getenv("QB_CLIENT_SECRET"),
'baseUrl' => getenv("QB_BASE_URL"),
'realmId' => getenv("QB_REALM_ID"),
'discoveryDocumentUrl' => getenv("QB_DISCOVERY_DOCUMENT"),
'oauthScope' => getenv("QB_OAUTH_SCOPE")
]);
https://developer.intuit.com/docs/00_quickbooks_online/2_build/10_authentication_and_authorization/40_oauth_1.0a/widgets
intuit.ipp.anywhere.setup({
grantUrl: '/redirect-url', //the one you saved in KeyStorage
datasources: {
quickbooks : true,
payments : true
},
paymentOptions:{
intuitReferred : true
}
});
$qb->connect();
$newCustomer = $qb->createCustomer([
"BillAddr" => [
"Line1" => $address->address,
"Line2" => $address->address2,
"City" => $address->town,
"Country" => $address->country->name,
"CountrySubDivisionCode" => $address->country->iso_code_2,
"PostalCode" => $address->postcode
],
"Notes" => $notes,
"Title" => $title,
"GivenName" => $name,
"MiddleName" => "",
"FamilyName" => $surname,
"Suffix" => $suffix,
"FullyQualifiedName" => $this->name . " " . $this->surname,
"CompanyName" => $companyName,
"DisplayName" => $displayName,
"PrimaryPhone" => [
"FreeFormNumber" => $mobile
],
"PrimaryEmailAddr" => [
"Address" => $email
]
]);
php composer.phar