Мне нужно интегрировать оплату QuickBook на моем сайте с PHP, но я сталкиваюсь с ошибкой, приведенной ниже:
Неустранимая ошибка: Uncaught QuickBooksOnline \ API \ Exception \ ServiceException: Http Status Code [403]: Запрос не выполнен успешным.Код ответа: [403] с телом: [message = AuthorizationFailed;ERRORCODE = 003100;statusCode = 403 Маркер доступа не имеет достаточной области действия].добавляется в /home/treasu46/public_html/qb/qb/payment_int/vendor/quickbooks/v3-php-sdk/src/Core/HttpClients/SyncRestHandler.php в строке 226
<?php
require "../vendor/autoload.php";
use QuickBooksOnline\API\DataService\DataService;
use QuickBooksOnline\API\Core\Http\Serialization\XmlObjectSerializer;
use QuickBooksOnline\API\Facades\Invoice;
// Prep Data Services
$dataService = DataService::Configure(array(
'auth_mode' => 'oauth2',
'ClientID' => "xxxxxxxxxx",
'ClientSecret' => "xxxxxxxxx",
'accessTokenKey' =>'xxxxxxxxxxxxxx',
'refreshTokenKey' => "xxxxxxxxxxxxxx",
'QBORealmID' => "xxxxxxxxxxx",
'baseUrl' => "Development"
));
$dataService->setLogLocation("/Users/hlu2/Desktop/newFolderForLog");
$dataService->throwExceptionOnError(true);
//Add a new Invoice
$theResourceObj = Invoice::create([
"Line" => [
[
"Amount" => 100.00,
"DetailType" => "SalesItemLineDetail",
"SalesItemLineDetail" => [
"ItemRef" => [
"value" => 20,
"name" => "Hours"
]
]
]
],
"CustomerRef"=> [
"value"=> 1
],
"BillEmail" => [
"Address" => "Familiystore@intuit.com"
],
"BillEmailCc" => [
"Address" => "a@intuit.com"
],
"BillEmailBcc" => [
"Address" => "v@intuit.com"
]
]);
$resultingObj = $dataService->Add($theResourceObj);
$error = $dataService->getLastError();
if ($error) {
echo "The Status code is: " . $error->getHttpStatusCode() . "\n";
echo "The Helper message is: " . $error->getOAuthHelperError() . "\n";
echo "The Response message is: " . $error->getResponseBody() . "\n";
}
else {
echo "Created Id={$resultingObj->Id}. Reconstructed response body:\n\n";
$xmlBody = XmlObjectSerializer::getPostXmlFromArbitraryEntity($resultingObj, $urlResource);
echo $xmlBody . "\n";
}