Payments

public interface Payments

This interface was deprecated.
Use PaymentsClient instead by getting an instance to it from getPaymentsClient(Activity, WalletOptions) or getPaymentsClient(Context, WalletOptions).

Entry point for interacting with Wallet buyflow APIs.

To allow the user to select and change the account associated with the transaction and Google transaction ID, use null or simply do not set it using setAccountName(String). No special action is required when a user changes the selected account through the UI in this case, and the Google transaction ID associated with the transaction can continue to be used.

To specify the account and prevent the user from selecting another account, set the account using setAccountName(String). To change the account, construct a new GoogleApiClient with the new account and do not reuse the Google transaction ID associated with the old account - this is a new transaction.

We recommend that you apply for API access at //getinstantbuy.withgoogle.com/ before starting development. During development, use the test environment by specifying ENVIRONMENT_TEST using setEnvironment(int). For production access, you must specify ENVIRONMENT_PRODUCTION.

Public Method Summary

abstract void
changeMaskedWallet(GoogleApiClient googleApiClient, String googleTransactionId, String merchantTransactionId, int requestCode)
This method brings up a Google Wallet selector screen to allow your customer to select a new payment instrument or shipping address from their Google Wallet.
abstract void
checkForPreAuthorization(GoogleApiClient googleApiClient, int requestCode)
This method was deprecated. This API will be removed soon.
abstract PendingResult<BooleanResult>
isReadyToPay(GoogleApiClient googleApiClient, IsReadyToPayRequest request)
Determines if the user can make payments using Google Pay.
abstract PendingResult<BooleanResult>
isReadyToPay(GoogleApiClient googleApiClient)
This method was deprecated. This API will be removed soon. Please use isReadyToPay(GoogleApiClient, IsReadyToPayRequest) instead.
abstract void
loadFullWallet(GoogleApiClient googleApiClient, FullWalletRequest request, int requestCode)
Requests a FullWallet, which contains the payment credentials.
abstract void
loadMaskedWallet(GoogleApiClient googleApiClient, MaskedWalletRequest request, int requestCode)
If an application has authorization, loadMaskedWallet() allows you to skip the Google Wallet selector and directly request the masked payment credentials.

Public Methods

public abstract void changeMaskedWallet (GoogleApiClient googleApiClient, String googleTransactionId, String merchantTransactionId, int requestCode)

This method brings up a Google Wallet selector screen to allow your customer to select a new payment instrument or shipping address from their Google Wallet.

Parameters
googleApiClient An instance of GoogleApiClient configured to use the Wallet API
googleTransactionId Required field. Must be identical to the value returned in an earlier MaskedWallet in the same transaction.
merchantTransactionId Optional merchant identifier for the transaction. The value will be echoed back in MaskedWallet, but is not otherwise used by the Wallet API. To omit, pass null
requestCode will be passed back in onActivityResult where you can retrieve the result via EXTRA_MASKED_WALLET.

public abstract void checkForPreAuthorization (GoogleApiClient googleApiClient, int requestCode)

This method was deprecated.
This API will be removed soon.

This API checks to see if a user has previously authorized the application to access their Wallet account.

Parameters
googleApiClient An instance of GoogleApiClient configured to use the Wallet API
requestCode will be passed back in onActivityResult where you can retrieve the result via EXTRA_IS_USER_PREAUTHORIZED.

public abstract PendingResult<BooleanResult> isReadyToPay (GoogleApiClient googleApiClient, IsReadyToPayRequest request)

Determines if the user can make payments using Google Pay. Returns true if the user has at least one card set up in Google Pay that meets the additional criteria specified in the IsReadyToPayRequest.

Important: This call only works with Google Pay and will return an error if used for anything else, including Google Wallet.

Parameters
googleApiClient An instance of GoogleApiClient configured to use the Wallet API.

Important: Any account set here will be ignored.

request An instance of IsReadyToPayRequest used to specify additional filtering criteria.

public abstract PendingResult<BooleanResult> isReadyToPay (GoogleApiClient googleApiClient)

This method was deprecated.
This API will be removed soon. Please use isReadyToPay(GoogleApiClient, IsReadyToPayRequest) instead.

Determines if the user can make payments using Google Pay. Returns true if the user has at least one card set up in Google Pay.

Important: This call only works with Google Pay and will return an error if used for anything else, including Google Wallet.

Parameters
googleApiClient An instance of GoogleApiClient configured to use the Wallet API.

Important: Any account set here will be ignored.

public abstract void loadFullWallet (GoogleApiClient googleApiClient, FullWalletRequest request, int requestCode)

Requests a FullWallet, which contains the payment credentials. You can retrieve the FullWallet in onActivityResult using the requestCode that you provide to this method. If there is a problem with the transaction then the Google Wallet selector will be shown and a MaskedWallet will be returned to reflect new selections by the user.

This function should only be called when the customer confirms the purchase.

Important: Because the credentials are in plain text it is important to transfer the payment credentials following PCI standards.

Parameters
googleApiClient An instance of GoogleApiClient configured to use the Wallet API
request
requestCode will be passed back in onActivityResult where you can retrieve the result via EXTRA_FULL_WALLET or EXTRA_MASKED_WALLET if the user had to make new selections.

public abstract void loadMaskedWallet (GoogleApiClient googleApiClient, MaskedWalletRequest request, int requestCode)

If an application has authorization, loadMaskedWallet() allows you to skip the Google Wallet selector and directly request the masked payment credentials. This provides a more seamless purchase experience for your customers. When you call this method, the Google Wallet selector will be shown only if necessary. Either way, you can retrieve the MaskedWallet in onActivityResult using the specified requestCode.

Parameters
googleApiClient An instance of GoogleApiClient configured to use the Wallet API
request
requestCode will be passed back in onActivityResult where you can retrieve the result via EXTRA_MASKED_WALLET.