Given that my server end point has received a Purchase Token relating to a Google In App Billing purchase, how do I go about programmatically verifying it and gaining access to its contents?
I can already verify a Google Sign-In token using php
$client = new Google_Client(['client_id' => $client_id]);
$payload = $client->verifyIdToken($token);
if ($payload)
return $payload['sub'];
But how would I use the Google_Client
to verify a purchase token and gain access to its contents.
Is it really just a case of sending a GET
to the Google server much like in the following Ruby example ?
Or is their a specific Google_Client
command I should be calling?
I'm beginning to think it's a case of replicating the mentioned Ruby code in php
using OAuth2
or something since the Google Docs do actually say that once the server has the purchase token to:
Use the Subscriptions and In-App Purchases portion of the Google Play Developer API to perform a GET request to retrieve the purchase details from Google Play (Purchases.products for a one-time product purchase or Purchases.subscriptions for a subscription). The GET request includes the app package name, product ID, and a token (purchase token).
Just wanted some clarification if possible? Thanks.