Download the PHP package simpleclick/google-play-billing without Composer

On this page you can find all versions of the php package simpleclick/google-play-billing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package google-play-billing

PHP Google Play Billing

Latest Version on Packagist Total Downloads

PHP Google Play Billing provides the required implementation to add Google Play's billing system to your php project.

Google Play's billing system overview

Google Play's billing system is a service that enables you to sell digital products and content in your Android app.

You can use Google Play's billing system to sell the following types of digital content:

Installation

Install the package via composer:

Configuration

Requests to the Google Play Developer API, requires authentication and scopes. To authenticate your machine create a service account, then set the environment variable GOOGLE_APPLICATION_CREDENTIALS

  1. In the Cloud Console, go to the Create service account key page.
  2. From the Service account list, select New service account.
  3. In the Service account name field, enter a name.
  4. From the Role list, select Project > Owner.
  5. Click Create. A JSON file that contains your key downloads to your computer.
  6. You can set the environment variable by:

Sell products

With any type of your products, you can use the REST api to:

  1. acknowledge: Acknowledges a purchase of an inapp item.
  2. get: Checks the purchase and consumption status of an inapp item.

Acknowledge a product

To acknowledge a product, you need a Client, which can be created by ClientFactory using the android publisher scope , then create an instance of the Imdhemy\Products\Product class, finally trigger the acknowledge() method.

Get the consumption state of a product

To check the purchase and consumption status of an inapp item, use the same steps used to acknowledge a product , but trigger the get() method not the acknowledge one.

The get() method returns a Imdhemy\GooglePlay\Products\ProductPurchase object, which contains the following methods:

Method Description
getKind ...
getPurchaseTime ...
getPurchaseState ...
getConsumptionState ...
getDeveloperPayload ...
getOrderId ...
getAcknowledgementState ...
getPurchaseToken ...
getProductId ...
getQuantity ...
getObfuscatedExternalAccountId ...
getObfuscatedExternalProfileId ...
getRegionCode ...

Sell subscriptions

This section describes how to handle subscription lifecycle events, such as renewals and expiration.

Life of a purchase

Here's a typical purchase flow for a one-time purchase or a subscription.

Subscriptions automatically renew until they are canceled. A subscription can go through the following states:

Handling the subscription lifecycle

A subscription can go through various state changes throughout its lifecycle and your app needs to respond to each change . To check the subscriber's state, your app can query using the Purchases.subscriptions:get (provided by this package) in the Google Play Developer API.

State Is returned expiryTimeMillis paymentState autoRenewing
Active Yes Future 1 (Payment Received) True
Cancelled Yes Future 1 (Payment Received) False
In grace period Yes Future 0 (Payment Pending) True
On hold Yes Past 0 (Payment Pending) True
Paused Yes Past 1 (Payment Received) True
Expired Yes Past 1 (Payment Received) False

The following methods are available to be used on a subscription:

  1. acknowledge: Acknowledges a subscription purchase.
  2. get: Checks whether a user's subscription purchase is valid and returns its expiry time.
  3. cancel: Cancels a user's subscription purchase.
  4. defer: Defers a user's subscription purchase until a specified future expiration time.
  5. refund: Refunds a user's subscription purchase, but the subscription remains valid until its expiration time and it will continue to recur.
  6. revoke: Refunds and immediately revokes a user's subscription purchase.

N.B. The stroked method are not implemented yet. help us with your contributions 😅.

The Following methods are available in Imdhemy\GooglePlay\Subscriptions\SubscriptionPurchase Object

Method Description
getKind ...
isAutoRenewing ...
getPriceCurrencyCode ...
getPriceAmountMicros ...
getCountryCode ...
getDeveloperPayload ...
getOrderId ...
getLinkedPurchaseToken ...
getEmailAddress ...
getGivenName ...
getProfileId ...
getExternalAccountId ...
getObfuscatedExternalAccountId ...
getObfuscatedExternalProfileId ...
getStartTime ...
getExpiryTime ...
getAutoResumeTime ...
getIntroductoryPriceInfo ...
getPriceChange ...
getCancellation ...
getPromotionType ...
getAcknowledgementState ...

Your app should listen for state changes using Real-time developer notifications to ensure state is kept in-sync. A SubscriptionNotification is sent for events affecting subscription state such as renewals and cancellations. You need to call the developer API after receiving a Real-time developer notifications to get the complete status and update your own backend state. These notifications tell you only that the subscription state changed. They do not give you complete information about overall subscription status.

Note: Due to quota restrictions, it is not recommended to check state by polling the Google Play Developer API at regular intervals instead of leveraging Real-time developer notifications.

Your app needs to handle the state changes that are described in the following table:

State Notification Value
New subscriptions SUBSCRIPTION_PURCHASED 4
Renewals SUBSCRIPTION_RENEWED 2
Expiration SUBSCRIPTION_EXPIRED 13
Cancellations SUBSCRIPTION_CANCELLED
Revocations SUBSCRIPTION_REVOKED 3
Account hold SUBSCRIPTION_ON_HOLD 5
Grace period SUBSCRIPTION_IN_GRACE_PERIOD 6
Paused subscriptions SUBSCRIPTION_PAUSED 10
Restorations ... ...
Upgrades, downgrades, and re-sign-ups ... ...

After receiving a real-time developer notification, you can parse its contents as follows:

The Following methods are available in Imdhemy\GooglePlay\DeveloperNotifications\DeveloperNotification

Method Description
parse ...
getType ...
getVersion ...
getPackageName ...
getEventTime ...
getSubscriptionNotification ...
getOneTimeProductNotification ...
getTestNotification ...

The Following methods are available in Imdhemy\GooglePlay\DeveloperNotifications\SubscriptionNotification

Method Description
getVersion ...
getNotificationType ...
getPurchaseToken ...
getSubscriptionId ...

All versions of google-play-billing with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
ext-json Version *
nesbot/carbon Version ^2.41
guzzlehttp/guzzle Version ^6.0|^7.0
google/auth Version ^1.15
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package simpleclick/google-play-billing contains the following files

Loading the files please wait ....