Client reference

Stay organized with collections Save and categorize content based on your preferences.

The com.google.android.gms.wallet documentation contains full documentation for the library across multiple versions of the Google Pay API. Below is a summary of objects and methods most applicable to the most recent version of the Google Pay API: version 2.0

Wallet

Generate a PaymentsClient for a test or production environment.

Example

mPaymentsClient = Wallet.getPaymentsClient(
  this,
  new Wallet.WalletOptions.Builder()
      .setEnvironment(WalletConstants.ENVIRONMENT_TEST)
      .build()
);

PaymentsClient

A client for interacting with the Google Pay APIs.

isReadyToPay(IsReadyToPayRequest)

Use the isReadyToPay(IsReadyToPayRequest) method to determine a user's ability to return a form of payment from the Google Pay API.

If the device supports Google Pay, and the user either has already saved a payment method or can add one, IsReadyToPay returns true. To determine whether the user already saved a payment method in Google Pay, set IsReadyToPayRequest.existingPaymentMethodRequired to true.

loadPaymentData(PaymentDataRequest)

Present a Google Pay payment sheet allowing selection of a payment method and optionally configured parameters.

IsReadyToPayRequest

Build an IsReadyToPayRequest Java object suitable for use with PaymentsClient.isReadyToPay().

fromJson(java.lang.String)

Create an IsReadyToPayRequest Java object from a JSON-formatted string. See the IsReadyToPayRequest object reference for the expected structure of the provided JSON-formatted string.

PaymentDataRequest

Build a PaymentDataRequest Java object suitable for use with PaymentsClient.loadPaymentData.

fromJson(java.lang.String)

Create a PaymentDataRequest Java object from a JSON-formatted string. See the PaymentDataRequest object reference for the expected structure of the provided JSON-formatted string.

PaymentData

Handle a Google Pay API JSON-formatted response for use in your app.

toJson()

Output a Google Pay API response as a JSON-formatted string. See the PaymentData object reference for more information about the structure of the JSON object.