Skip to content

Most visited

Recently visited

navigation

Purchase

public class Purchase
extends Object

java.lang.Object
   ↳ com.android.billingclient.api.Purchase


Represents an in-app billing purchase.

Summary

Nested classes

class Purchase.PurchasesResult

Result list and code for queryPurchases method  

Public constructors

Purchase(String jsonPurchaseInfo, String signature)

Public methods

boolean equals(Object o)
String getOrderId()

Returns an unique order identifier for the transaction.

String getOriginalJson()

Returns a String in JSON format that contains details about the purchase order.

String getPackageName()

Returns the application package from which the purchase originated.

long getPurchaseTime()

Returns the time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).

String getPurchaseToken()

Returns a token that uniquely identifies a purchase for a given item and user pair.

String getSignature()

Returns String containing the signature of the purchase data that was signed with the private key of the developer.

String getSku()

Returns the product Id.

int hashCode()
boolean isAutoRenewing()

Indicates whether the subscription renews automatically.

String toString()

Inherited methods

From class java.lang.Object

Public constructors

Purchase

Purchase (String jsonPurchaseInfo, 
                String signature)

Parameters
jsonPurchaseInfo String

signature String

Throws
JSONException

Public methods

equals

boolean equals (Object o)

Parameters
o Object

Returns
boolean

getOrderId

String getOrderId ()

Returns an unique order identifier for the transaction. This identifier corresponds to the Google payments order ID.

Returns
String

getOriginalJson

String getOriginalJson ()

Returns a String in JSON format that contains details about the purchase order.

Returns
String

getPackageName

String getPackageName ()

Returns the application package from which the purchase originated.

Returns
String

getPurchaseTime

long getPurchaseTime ()

Returns the time the product was purchased, in milliseconds since the epoch (Jan 1, 1970).

Returns
long

getPurchaseToken

String getPurchaseToken ()

Returns a token that uniquely identifies a purchase for a given item and user pair.

Returns
String

getSignature

String getSignature ()

Returns String containing the signature of the purchase data that was signed with the private key of the developer. The data signature uses the RSASSA-PKCS1-v1_5 scheme.

Returns
String

getSku

String getSku ()

Returns the product Id.

Returns
String

hashCode

int hashCode ()

Returns
int

isAutoRenewing

boolean isAutoRenewing ()

Indicates whether the subscription renews automatically. If true, the subscription is active, and will automatically renew on the next billing date. If false, indicates that the user has canceled the subscription. The user has access to subscription content until the next billing date and will lose access at that time unless they re-enable automatic renewal (or manually renew, as described in Manual Renewal). If you offer a grace period, this value remains set to true for all subscriptions, as long as the grace period has not lapsed. The next billing date is extended dynamically every day until the end of the grace period or until the user fixes their payment method.

Returns
boolean

toString

String toString ()

Returns
String

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields

Hooray!

Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience.
(Sep 2017 survey)