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
WalletGenerate a PaymentsClient
for a test or production environment.
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
.
Present a Google Pay payment sheet allowing selection of a payment method and optionally configured parameters.
IsReadyToPayRequestBuild an IsReadyToPayRequest
Java object suitable for use with PaymentsClient.isReadyToPay().
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.
Build a PaymentDataRequest
Java object suitable for use with PaymentsClient.loadPaymentData.
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.
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.
PayButton public void initialize(ButtonOption buttonOptions)The convenience method is used to initialize a Google Pay payment button styled with the latest Google Pay branding.
Arguments Name DescriptionbuttonOptions
An object that configures the Google Pay payment button. See ButtonOptions for configurable properties. Example: Initialize the payment button with custom configurations:
PayButton googlePayPaymentButton = layoutBinding.googlePayPaymentButton; JSONArray paymentMethods = new JSONArray().put(getBaseCardPaymentMethod()); googlePayPaymentButton.initialize( ButtonOptions.newBuilder() .setButtonTheme(ButtonConstants.ButtonTheme.DARK) .setButtonType(ButtonConstants.ButtonType.BUY) .setCornerRadius(100) .setAllowedPaymentMethods(paymentMethods.toString()) .build() );public void setVisibility(View view)
The convenience method sets the payment button visibility.
Arguments Name DescriptionView
View.VISIBLE
sets the payment button to visible (default).
View.GONE
hides the button from users.
payButton.setVisibility(View.VISIBLE);public void setOnClickListener(View.OnClickListener listener)
Method is called when the user clicks on the Google Pay payment button.
Arguments Name Descriptionlistener
An event listener callback to call when a click event is delivered to the Google Pay payment button.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-14 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["The `com.google.android.gms.wallet` library provides tools for integrating Google Pay into Android applications, including generating a `PaymentsClient`, checking user readiness for payment, and loading a payment sheet."],["The `PaymentsClient` class enables interaction with Google Pay APIs, offering methods like `isReadyToPay()` to assess the user's payment capabilities and `loadPaymentData()` to initiate payment transactions."],["`IsReadyToPayRequest` and `PaymentDataRequest` objects are used to configure the `isReadyToPay()` and `loadPaymentData()` methods, respectively, and can be constructed from JSON strings."],["`PaymentData` facilitates handling Google Pay responses, offering methods like `toJson()` for outputting the response data, while `PayButton` provides a pre-built UI component for initiating Google Pay transactions and can be customized with options like button theme and corner radius."]]],["The provided content outlines the core components of the Google Pay API, version 2.0, within the `com.google.android.gms.wallet` library. Key actions include generating a `PaymentsClient` via `Wallet`, using `isReadyToPay` to check for Google Pay availability, and loading a payment sheet with `loadPaymentData`. `IsReadyToPayRequest` and `PaymentDataRequest` objects can be built from JSON. `PaymentData` objects can be converted to JSON. Finally, `PayButton` can be initialized, configured, made visible, and have a click listener set.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4