1

我正在使用 Lumen 版本 Laravel Framework 版本 Lumen (5.3.3) (Laravel Components 5.3.*)。以下是我的代码。但抛出异常:

在 \vendor\guzzlehttp\guzzle\src\Client.php 第 147 行中找不到类“GuzzleHttp\Psr7\UriResolver”。

代码:

$applicationName = 'xxx';
$configLocation = storage_path() . '/receiptValidation/GooglePlayAndroidDeveloper-7cb840b98626.json';
$scope = ['https://www.googleapis.com/auth/androidpublisher'];
$packageName = 'xxxxx';
$productId = 'xxxxx';
$purchaseToken = 'xxxxx';

$client = new \Google_Client();
$client->setApplicationName($applicationName);
$client->setAuthConfig($configLocation);
$client->setScopes($scope);

$validator = new PlayValidator(new \Google_Service_AndroidPublisher($client));

try {
$response = $validator->setPackageName($packageName)
    ->setProductId($productId)
    ->setPurchaseToken($purchaseToken)
    ->validatePurchase();
} catch (Exception $e) {
    var_dump($e->getMessage());
    // example message: Error calling GET ....: (404) Product not found for this application.
}
4

0 回答 0