PHP code example of simpleclick / google-play-billing
1. Go to this page and download the library: Download simpleclick/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/ */
simpleclick / google-play-billing example snippets
use Simpleclick\GooglePlay\ClientFactory;
use Simpleclick\GooglePlay\Products\Product;
$client = ClientFactory::create([ClientFactory::SCOPE_ANDROID_PUBLISHER]);
$product = new Product($client, 'com.example.package.name', 'productId', 'Purchase_Token');
$product->acknowledge();
use Simpleclick\GooglePlay\ClientFactory;
use Simpleclick\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 Simpleclick\GooglePlay\ClientFactory;
use Simpleclick\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(); // Imdhemy\GooglePlay\Subscriptions\SubscriptionPurchase