PHP code example of bestys-mobile / google-play-billing
1. Go to this page and download the library: Download bestys-mobile/google-play-billing library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
bestys-mobile / google-play-billing example snippets
use Bestys\GooglePlay\ClientFactory;
use Bestys\GooglePlay\Products\Product;
$client = ClientFactory::create([ClientFactory::SCOPE_ANDROID_PUBLISHER]);
$product = new Product($client, 'com.example.package.name', 'productId', 'Purchase_Token');
$product->acknowledge();
use Bestys\GooglePlay\ClientFactory;
use Bestys\GooglePlay\Products\Product;
$client = ClientFactory::create([ClientFactory::SCOPE_ANDROID_PUBLISHER]);
$product = new Product($client, 'com.example.package.name', 'productId', 'Purchase_Token');
$resource = $product->get();
use Bestys\GooglePlay\ClientFactory;
use Bestys\GooglePlay\Subscriptions\Subscription;
$client = ClientFactory::create([ClientFactory::SCOPE_ANDROID_PUBLISHER]);
$subscription = new Subscription($client, 'com.example.package.name', 'subscriptionId', 'Purchase_Token');
$subscription->acknowledge();
$resource = $subscription->get(); // Bestys\GooglePlay\Subscriptions\SubscriptionPurchase