PaymentData

public final class PaymentData extends Object
implements Parcelable AutoResolvableResult

Parcelable representing a payment data response, which contains the necessary payment result to complete the payment. See the available fields for more information.

Inherited Constant Summary

Field Summary

public static final Creator<PaymentData> CREATOR

Public Method Summary

static PaymentData
fromJson(String paymentDataJson)
Constructs PaymentData from a JSON object serialized as a string.
CardInfo
String
Bundle
static PaymentData
getFromIntent(Intent intent)
Gets the PaymentData stored in the given Intent extra.
String
PaymentMethodToken
getPaymentMethodToken()
Gets the token representing the payment method selected by the buyer for a transaction tokenized according to PaymentMethodTokenizationParameters passed with corresponding PaymentDataRequest.
UserAddress
void
putIntoIntent(Intent intent)
Saves the current PaymentData instance as an extra in the given Intent.
String
toJson()
Returns PaymentData in JSON format.
void
writeToParcel(Parcel dest, int flags)

Inherited Method Summary

Fields

public static final Creator<PaymentData> CREATOR

Public Methods

public static PaymentData fromJson (String paymentDataJson)

Constructs PaymentData from a JSON object serialized as a string.

To convert back to a JSON object serialized as string use toJson().

Note that you shouldn't rely on the values returned by getters in PaymentData as they will not be populated with the data set in the given JSON.

For the expected format of this JSON, please see PaymentData object reference documentation.

public CardInfo getCardInfo ()

Returns
  • info about the card used in the transaction.

public String getEmail ()

Returns
  • the buyer's email if requested.

public Bundle getExtraData ()

Returns
  • Additional payment data pertaining to the transaction.

public static PaymentData getFromIntent (Intent intent)

Gets the PaymentData stored in the given Intent extra.

Use this method to extract PaymentData from the Intent received in onActivityResult(int, int, Intent).

public String getGoogleTransactionId ()

Returns
  • The unique ID assigned to this payment transaction by Google.

public PaymentMethodToken getPaymentMethodToken ()

Gets the token representing the payment method selected by the buyer for a transaction tokenized according to PaymentMethodTokenizationParameters passed with corresponding PaymentDataRequest.

public UserAddress getShippingAddress ()

Returns
  • the buyer's shipping address if requested.

public void putIntoIntent (Intent intent)

Saves the current PaymentData instance as an extra in the given Intent.

public String toJson ()

Returns PaymentData in JSON format.

Note that this will be null if PaymentDataRequest was not constructed using fromJson(String).

For the expected format of this JSON, please see PaymentData object reference documentation.

public void writeToParcel (Parcel dest, int flags)