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
getCardInfo()
This method is deprecated. Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).
String
getEmail()
This method is deprecated. Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).
Bundle
getExtraData()
This method is deprecated. Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).
static PaymentData
getFromIntent(Intent intent)
Gets the PaymentData stored in the given Intent extra.
String
getGoogleTransactionId()
This method is deprecated. Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).
Bundle
getLastSavedState()
Returns the last saved state associated with this PaymentsClient.loadPaymentData(PaymentDataRequest) invocation.
PaymentMethodToken
getPaymentMethodToken()
This method is deprecated. Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).
UserAddress
getShippingAddress()
This method is deprecated. Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).
void
putIntoIntent(Intent intent)
Saves the current PaymentData instance as an extra in the given Intent.
String
toJson()
Returns PaymentData in JSON format.
PaymentData
withLastSavedState(Bundle savedState)
Returns a new instance of PaymentData with getLastSavedState() returning the given savedState.
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 ()

This method is deprecated.
Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).

Returns
  • info about the card used in the transaction.

public String getEmail ()

This method is deprecated.
Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).

Returns
  • the buyer's email if requested.

public Bundle getExtraData ()

This method is deprecated.
Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).

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 Activity.onActivityResult(int, int, Intent).

public String getGoogleTransactionId ()

This method is deprecated.
Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).

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

public Bundle getLastSavedState ()

Returns the last saved state associated with this PaymentsClient.loadPaymentData(PaymentDataRequest) invocation.

See PaymentDataRequest.withSavedState(Bundle) for more details.

public PaymentMethodToken getPaymentMethodToken ()

This method is deprecated.
Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).

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 ()

This method is deprecated.
Instead use the JSON request format (see PaymentDataRequest.fromJson(String)) which provides you the same data in JSON response format (see toJson()).

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 PaymentDataRequest.fromJson(String).

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

public PaymentData withLastSavedState (Bundle savedState)

Returns a new instance of PaymentData with getLastSavedState() returning the given savedState.

See PaymentDataRequest.withSavedState(Bundle) for more details.

public void writeToParcel (Parcel dest, int flags)