aporat / store-receipt-validator

PHP receipt validator for Apple iTunes, Google Play and Amazon App Store
Apache License 2.0
633 stars 153 forks source link

Play Store Receipt return ununderstandable object #132

Closed YudeMgoy closed 4 years ago

YudeMgoy commented 4 years ago

Why the response return data like this? what is this? Capture

this is my code on server side ` require_once app_path().'/../vendor/autoload.php';

    // receipt data
    $packageName = "com.smeatech.weeby";
    $productId = "weeby_premium2";
    $purchaseToken = "olgkmglhgekmamomdhfaeidm.AO-J1OzIeJpD-lu1wJbbneIRXY_2Plzp6scVRfcAHtrxyW1tCQFVumpASKR0Pgk5c9TDqKLVgRxtC_75ziaPvyVDndYbIzUx7w";

    $client = new \Google_Client();
    $client->setApplicationName("Weeby");
    $client->setAuthConfig(app_path().'/googleserviceconfig.json');
    $client->setScopes([\Google_Service_AndroidPublisher::ANDROIDPUBLISHER]);

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

    try {
        $response = $validator->setPackageName($packageName)->setProductId($productId)->setPurchaseToken($purchaseToken)->validateSubscription();

        return response()->json($response);
    } catch (Exception $e) {
        echo 'got error = '.$e->getMessage().PHP_EOL;
    }`
Stafox commented 4 years ago

Could you show the raw response? you shown response handled by your response() function.

YudeMgoy commented 4 years ago

Capture

Now it's return error like that

Stafox commented 4 years ago

Problem connected with other libraries, firebase-jwt in your case.