快速书籍付款整合问题

时间:2019-01-03 05:56:06

标签: php quickbooks

我需要将自己的站点中的Quickbook Payment与PHP集成在一起,但是我遇到了以下错误:

  

致命错误:未捕获的QuickBooksOnline \ API \ Exception \ ServiceException:   Http状态码[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";
}

0 个答案:

没有答案