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
http://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 void |
isNewUser(GoogleApiClient googleApiClient, int requestCode)
This method was deprecated.
This API will be removed soon.
|
abstract PendingResult<BooleanResult> |
isReadyToPay(GoogleApiClient googleApiClient)
Determines if the user can make payments using Android Pay.
|
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.
|
abstract void |
notifyTransactionStatus(GoogleApiClient googleApiClient, NotifyTransactionStatusRequest request)
This method was deprecated.
Calling this API is no longer required and will become a no-op soon.
|
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 void isNewUser (GoogleApiClient googleApiClient, int requestCode)
This method was deprecated.
This API will be removed soon.
Checks if this is a new user, i.e. if they have used Google to make a purchase for your app before or not. If the user has multiple accounts on the device, each will be checked. If any of the accounts has been used to make purchase with your app, then false will be returned. True is only returned if none of the accounts on the device have been used to make a purchase with your app.
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_NEW_USER . |
public abstract PendingResult<BooleanResult> isReadyToPay (GoogleApiClient googleApiClient)
Determines if the user can make payments using Android Pay. Returns true if the user has at least one card set up in Android Pay.
Important: This call only works with Android 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 |
---|---|
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 |
---|---|
requestCode | will be passed back in onActivityResult where you can retrieve the result
via EXTRA_MASKED_WALLET .
|
public abstract void notifyTransactionStatus (GoogleApiClient googleApiClient, NotifyTransactionStatusRequest request)
This method was deprecated.
Calling this API is no longer required and will become a no-op soon.
Sends a notification to Google on whether the transaction succeeded or failed.
Parameters
googleApiClient | An instance of GoogleApiClient configured to use the Wallet
API |
---|