Package com.meawallet.mpp
Class MeaPushProvisioning.GooglePay
java.lang.Object
com.meawallet.mpp.MeaPushProvisioning.GooglePay
- Enclosing class:
- MeaPushProvisioning
Methods which can be used to simplify Google Pay Push Provisioning flow.
https://developers.google.com/pay/issuers/apis/push-provisioning/android
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Decline activation type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Returns the user to Google Wallet after the activation process is complete.static void
Passes Activation Code to to Google Wallet.static void
activate
(com.google.android.gms.tapandpay.issuer.TokenInfo tokenInfo, Activity activity, MppActivateListener listener) Activates token using TSP and returns back to the Google Wallet.static void
activate
(String tokenUniqueReference, MppPaymentNetwork paymentNetwork) Activates using TSP.static void
activate
(String tokenUniqueReference, MppPaymentNetwork paymentNetwork, MppActivateListener listener) Activates using TSP.static void
checkWalletForCardSuffix
(String cardSuffix, GooglePayRegisteredTokensListener listener) Checks if the Google Pay token with provided PAN suffix is available in the Google Pay Wallet.static void
checkWalletForCardToken
(MppCardDataParameters cardData, GooglePayTokenListener listener) Checks if the Google Pay token for the corresponding card is available in the Google Pay Wallet.static void
checkWalletForToken
(MppPaymentNetwork paymentNetwork, String tokenId, GooglePayTokenListener listener) Checks if the Google Pay token with passed payment network and tokenId is available in the Google Pay Wallet.static void
declineActivation
(Activity activity, MeaPushProvisioning.GooglePay.ActivationResult activationResult) Declines activation with status.static void
getActivationCode
(MppCardDataParameters cardData, Context context, MppActivationCodeListener listener) Gets activation code (authentication code, TAV) for app-to-app verification.static String
getActivationCode
(MppCardDataParameters cardData, String walletId, String deviceId, Context context) Gets activation code (authentication code, TAV) for app-to-app verification.static void
getActivationCode
(MppCardDataParameters cardData, String walletId, String deviceId, Context context, MppActivationCodeListener listener) Gets activation code (authentication code, TAV) for app-to-app verification.static void
Get a list of tokens and associated metadata registered to the active wallet.static void
getTokenInfo
(Intent intent, GooglePayTokenInfoListener listener) Gets TokenInfo using Token Unique Reference from Intent's data.getTokenizationData
(MppCardDataParameters cardData, String walletId, String deviceId, Context context) Get Google Pay Push Provisioning tokenization data which includes Opaque Payment Card (OPC) - a binary blob of information which needs to be shared with Google Pay 'as is' and will be presented to TSP to receive a token.static void
getTokenizationData
(MppCardDataParameters cardData, String walletId, String deviceId, Context context, MppGetOemTokenizationDataListener listener) Get Google Pay Push Provisioning tokenization data.static MppGetTokensResponseData
getTokens
(MppCardDataParameters cardData, String walletId, String deviceId, Context context) Get Google Pay tokens for the specified card.static void
getTokens
(MppCardDataParameters cardData, String walletId, String deviceId, Context context, MppGetTokensListener listener) Get Google Pay tokens for the specified card.static boolean
handleOnActivityResult
(int requestCode, int resultCode, Intent intent, Activity activity) Handles intermediate results returned by Activity.onActivityResult(int, int, Intent) method as a result of method calls from MPP SDK related to the Google Pay.static void
handlePushCardOnActivityResult
(int requestCode, int resultCode, Intent intent, Activity activity) Deprecated.static boolean
isDefaultPaymentApplication
(Context context) Issuer app should check if Google Pay is the default NFC payment app after card tokenization.static boolean
isPushCardRequestCode
(int requestCode) Deprecated.Should not be used anymore,handleOnActivityResult(int, int, Intent, Activity)
method returns a boolean flag showing whether data are handled by MPP SDK or not.static void
isTokenized
(String tokenId, String issuerName, MppPaymentNetwork paymentNetwork, GooglePayIsTokenizedListener listener) Checks if card is tokenizedstatic boolean
isWalletAvailable
(Context context) Checks if Google Wallet is installed on device.static void
pushCard
(MppCardDataParameters cardData, String cardDisplayName, com.google.android.gms.tapandpay.issuer.UserAddress userAddress, Activity activity, MppPushCardToGooglePayListener listener) Starts push tokenization flow to Google Pay application for a card, first checking Google Pay wallet state, then getting Opaque Payment Card (OPC) by making remote request to MeaWallet backend, finally OPC with other card attributes are pushed to Google Pay using Google Pay Push Provisioning API.static void
Registers Google Pay wallet data changed listener.static void
Removes Google Pay wallet data changed listener.static void
requestTokenDeleteDialog
(Activity activity, GooglePayTokenInfo googlePayTokenInfo, GooglePayTokenDeleteListener listener) Shows a dialog asking the user to confirm the deletion of the passed Google Pay token from the Google Pay Wallet.static void
requestTokenSelectDialog
(Activity activity, GooglePayTokenInfo googlePayTokenInfo, GooglePayTokenSelectListener listener) Shows a dialog asking the user to confirm the intention to set the passed Google Pay token as their Default card in Google Pay Wallet.static void
sendUserToGooglePay
(Activity activity) Helper method to send user to the Google Pay app to see the tokenized card.static void
setAsDefaultPaymentApplication
(Activity activity, int requestCode) Set Google Pay as a default app for NFC payments.static void
tokenize
(GooglePayTokenInfo googlePayTokenInfo, String cardDisplayName, Activity activity, GooglePayTokenizeListener listener) Activates a token in yellow path or starts the manual tokenization flow in which the user needs to scan the card or enter all card details manually in a form.static void
viewToken
(String tokenId, MppPaymentNetwork paymentNetwork, GooglePayPendingIntentListener listener) Method will only return an intent that have been registered by an app with the same Android package as the caller.
-
Constructor Details
-
GooglePay
public GooglePay()
-
-
Method Details
-
pushCard
public static void pushCard(@NonNull MppCardDataParameters cardData, @NonNull String cardDisplayName, @Nullable com.google.android.gms.tapandpay.issuer.UserAddress userAddress, @NonNull Activity activity, @NonNull MppPushCardToGooglePayListener listener) throws MppException Starts push tokenization flow to Google Pay application for a card, first checking Google Pay wallet state, then getting Opaque Payment Card (OPC) by making remote request to MeaWallet backend, finally OPC with other card attributes are pushed to Google Pay using Google Pay Push Provisioning API.In the process of wallet creation or token push provisioning the Google Pay application may return intermediate results through the Activity.onActivityResult(int, int, Intent) method. In order to support automatic push tokenization flow the issuer application needs to pass these intermediate results to the
handleOnActivityResult(int, int, Intent, Activity)
method. Result of the push tokenization flow will be returned usingMppPushCardToGooglePayListener
callback.protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (MeaPushProvisioning.GooglePay.handlePushCardOnActivityResult(requestCode, resultCode, data, this) { // ... handled by MPP SDK } }
- Parameters:
cardData
- Card data object containing the card information to be provisioned by the token requester.cardDisplayName
- Display name or nickname used to describe the payment card in the Google Pay application user interface.userAddress
- The user's address. Push token'ization takes a UserAddress that must be provided in order to skip manual address entry. The issuer application should provide the entire address and phone number on file. Missing or invalid address information may result in the user being prompted to complete or correct the address. The address should be the correct address of the issuer's knowledge. Using a fake or intentionally incorrect addresses is not permitted by the Push Provisioning API terms of service.activity
- TheActivity
which will handleActivity.onActivityResult(int, int, Intent)
callback.listener
- The listener asMppPushCardToGooglePayListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
checkWalletForCardToken
public static void checkWalletForCardToken(@NonNull MppCardDataParameters cardData, @NonNull GooglePayTokenListener listener) throws MppException Checks if the Google Pay token for the corresponding card is available in the Google Pay Wallet. This check requires a network call, therefore it is recommended to usecheckWalletForToken(MppPaymentNetwork, String, GooglePayTokenListener)
whenever the data required for this method call is available.- Parameters:
cardData
- Card data object containing the card information to be provisioned by the token requester.listener
- The listener asGooglePayTokenListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
checkWalletForToken
public static void checkWalletForToken(@NonNull MppPaymentNetwork paymentNetwork, @NonNull String tokenId, @NonNull GooglePayTokenListener listener) throws MppException Checks if the Google Pay token with passed payment network and tokenId is available in the Google Pay Wallet.- Parameters:
paymentNetwork
- Card payment networktokenId
- token Idlistener
- The listener asGooglePayTokenListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
checkWalletForCardSuffix
public static void checkWalletForCardSuffix(@NonNull String cardSuffix, @NonNull GooglePayRegisteredTokensListener listener) throws MppException Checks if the Google Pay token with provided PAN suffix is available in the Google Pay Wallet.- Parameters:
cardSuffix
- Card suffix.listener
- The listener asGooglePayRegisteredTokensListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
tokenize
public static void tokenize(@NonNull GooglePayTokenInfo googlePayTokenInfo, @NonNull String cardDisplayName, @NonNull Activity activity, @NonNull GooglePayTokenizeListener listener) throws MppException Activates a token in yellow path or starts the manual tokenization flow in which the user needs to scan the card or enter all card details manually in a form. Tokens added using this method are added to the active wallet.- Parameters:
googlePayTokenInfo
- GooglePayTokenInfo containing token information for continuing tokenization.cardDisplayName
- Display name or nickname used to describe the payment card in the Google Pay application user interface.activity
- Activity instance to be used for Dialog.listener
- The listener asGooglePayTokenizeListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
getActivationCode
public static void getActivationCode(@NonNull MppCardDataParameters cardData, @NonNull Context context, @NonNull MppActivationCodeListener listener) Gets activation code (authentication code, TAV) for app-to-app verification.- Parameters:
cardData
- Card data object containing the card information to be provisioned by the token requester.context
- TheActivity
providing context.listener
- The listener asMppActivationCodeListener
instance.
-
getActivationCode
public static void getActivationCode(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context, @NonNull MppActivationCodeListener listener) Gets activation code (authentication code, TAV) for app-to-app verification.- Parameters:
cardData
- Card data object containing the card information to be provisioned by the token requester.walletId
- Optional wallet ID of the active wallet.deviceId
- Optional device ID of the active wallet.context
- Application context.listener
- The listener asMppActivationCodeListener
interface.
-
getActivationCode
public static String getActivationCode(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context) throws MppException, NetworkOnMainThreadException Gets activation code (authentication code, TAV) for app-to-app verification.- Parameters:
cardData
- Card data object containing the card information to be provisioned by the token requester.walletId
- Optional wallet ID of the active wallet.deviceId
- Optional device ID of the active wallet.context
- Application context.- Returns:
- Activation code.
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
activate
public static void activate(@NonNull Activity activity, @NonNull String activationCode) throws MppException Passes Activation Code to to Google Wallet.- Parameters:
activity
- Token activation activity.activationCode
- Activation code.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
activate
Returns the user to Google Wallet after the activation process is complete.- Parameters:
activity
- Token activation activity.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
declineActivation
public static void declineActivation(@NonNull Activity activity, @NonNull MeaPushProvisioning.GooglePay.ActivationResult activationResult) throws MppException Declines activation with status.- Parameters:
activity
- Token activation activity.activationResult
- Activation result.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
getTokenInfo
public static void getTokenInfo(@NonNull Intent intent, @NonNull GooglePayTokenInfoListener listener) throws MppException Gets TokenInfo using Token Unique Reference from Intent's data.- Parameters:
intent
- Intentlistener
- The listener asGooglePayTokenInfoListener
interface.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
activate
public static void activate(@NonNull com.google.android.gms.tapandpay.issuer.TokenInfo tokenInfo, @Nullable Activity activity, @Nullable MppActivateListener listener) Activates token using TSP and returns back to the Google Wallet.- Parameters:
tokenInfo
- TokenInfo object's instance.activity
- Token activation activity.listener
- The listener asMppActivateListener
interface.
-
activate
public static void activate(@NonNull String tokenUniqueReference, @NonNull MppPaymentNetwork paymentNetwork) throws MppException Activates using TSP.- Parameters:
tokenUniqueReference
- Token Unique Reference, correspond to the token ID in TSP.paymentNetwork
- Payment network- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
activate
public static void activate(@NonNull String tokenUniqueReference, @NonNull MppPaymentNetwork paymentNetwork, MppActivateListener listener) Activates using TSP.- Parameters:
tokenUniqueReference
- Token Unique Reference, correspond to the token ID in TSP.paymentNetwork
- Payment networklistener
- The listener asMppActivateListener
interface.
-
isTokenized
public static void isTokenized(@NonNull String tokenId, @NonNull String issuerName, @NonNull MppPaymentNetwork paymentNetwork, @NonNull GooglePayIsTokenizedListener listener) throws MppException Checks if card is tokenized- Parameters:
tokenId
- Token IdissuerName
- Issuer NamepaymentNetwork
- Card payment networklistener
- The listener asGooglePayIsTokenizedListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
viewToken
public static void viewToken(@NonNull String tokenId, @NonNull MppPaymentNetwork paymentNetwork, @NonNull GooglePayPendingIntentListener listener) throws MppException Method will only return an intent that have been registered by an app with the same Android package as the caller. These tokens do not necessarily have to be push provisioned by the calling app, but the package must match the package name in the metadata received from the token service provider when created. If you have multiple packages you will only receive a successful response associated with whichever app package you are calling with.- Parameters:
tokenId
- Token IdpaymentNetwork
- Card payment networklistener
- The listener asGooglePayIsTokenizedListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
getRegisteredTokens
public static void getRegisteredTokens(@NonNull GooglePayRegisteredTokensListener listener) throws MppException Get a list of tokens and associated metadata registered to the active wallet.- Parameters:
listener
- The listener asGooglePayRegisteredTokensListener
interface.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
getTokens
public static MppGetTokensResponseData getTokens(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context) throws MppException, NetworkOnMainThreadException Get Google Pay tokens for the specified card. Synchronous method.- Parameters:
cardData
- Card data object containing the card information.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.- Returns:
- Returns data containing card payment network, last four digits and related tokens.
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
getTokens
public static void getTokens(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context, @NonNull MppGetTokensListener listener) Get Google Pay tokens for the specified card. Asynchronous method.- Parameters:
cardData
- Card data object containing the card information.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.listener
- The listener asMppGetTokensListener
interface.
-
getTokenizationData
public static MppGetOemTokenizationDataResponseData getTokenizationData(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context) throws MppException, NetworkOnMainThreadException Get Google Pay Push Provisioning tokenization data which includes Opaque Payment Card (OPC) - a binary blob of information which needs to be shared with Google Pay 'as is' and will be presented to TSP to receive a token.- Parameters:
cardData
- Card data object containing the card information.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.- Returns:
- return Opaque Payment Card (OPC) - a binary blob of information which needs to be shared with Google Pay 'as is' and will be presented to TSP to receive a token.
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.NetworkOnMainThreadException
- Method should not be called on the Main thread.
-
getTokenizationData
public static void getTokenizationData(@NonNull MppCardDataParameters cardData, @Nullable String walletId, @Nullable String deviceId, @NonNull Context context, @NonNull MppGetOemTokenizationDataListener listener) Get Google Pay Push Provisioning tokenization data. In listener onSuccess() callback return Opaque Payment Card (OPC) - a binary blob of information which needs to be shared with Google Pay 'as is' and will be presented to TSP to receive a token.- Parameters:
cardData
- Card data object containing the card information.walletId
- Wallet ID of the active wallet.deviceId
- Device ID of the active wallet.context
- Application context.listener
- The listener asMppGetOemTokenizationDataListener
interface.
-
registerDataChangedListener
public static void registerDataChangedListener(@NonNull GooglePayDataChangedListener listener) throws MppException Registers Google Pay wallet data changed listener. Issuer app callback is called immediately whenever the following events occur: - The active wallet changes (by changing the active account) - The selected card of the active wallet changes - Tokenized cards are added or removed from the active wallet - The status of a token in the active wallet changes - Registering for these broadcasts allows an issuer app to re-query information about their digitized cards whenever the user makes a change.- Parameters:
listener
- Listener.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
removeDataChangedListener
public static void removeDataChangedListener(@NonNull GooglePayDataChangedListener listener) throws MppException Removes Google Pay wallet data changed listener.- Parameters:
listener
- Listener.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
requestTokenDeleteDialog
public static void requestTokenDeleteDialog(@NonNull Activity activity, @NonNull GooglePayTokenInfo googlePayTokenInfo, @NonNull GooglePayTokenDeleteListener listener) throws MppException Shows a dialog asking the user to confirm the deletion of the passed Google Pay token from the Google Pay Wallet.- Parameters:
activity
- Activity instance to be used for Dialog.googlePayTokenInfo
- Object describing card token added to the Google Pay Wallet.listener
- The listener asGooglePayTokenDeleteListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
requestTokenSelectDialog
public static void requestTokenSelectDialog(@NonNull Activity activity, @NonNull GooglePayTokenInfo googlePayTokenInfo, @NonNull GooglePayTokenSelectListener listener) throws MppException Shows a dialog asking the user to confirm the intention to set the passed Google Pay token as their Default card in Google Pay Wallet.- Parameters:
activity
- Activity instance to be used for Dialog.googlePayTokenInfo
- Object describing card token added to the Google Pay Wallet.listener
- The listener asGooglePayTokenSelectListener
instance.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
isPushCardRequestCode
Deprecated.Should not be used anymore,handleOnActivityResult(int, int, Intent, Activity)
method returns a boolean flag showing whether data are handled by MPP SDK or not.Checks result code of Activity.onActivityResult(int, int, Intent) to detect if received results needs to be handled by thehandlePushCardOnActivityResult(int, int, Intent, Activity)
method.- Parameters:
requestCode
- Request code received as a parameter from Activity.onActivityResult(int, int, Intent) method.- Returns:
- true if results needs to be passed to the
handlePushCardOnActivityResult(int, int, Intent, Activity)
method. - Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
handlePushCardOnActivityResult
@Deprecated public static void handlePushCardOnActivityResult(int requestCode, int resultCode, @Nullable Intent intent, @NonNull Activity activity) throws MppException Deprecated.Should not be used anymore, usehandleOnActivityResult(int, int, Intent, Activity)
instead.Handles intermediate results returned by Activity.onActivityResult(int, int, Intent) method as a result ofpushCard(MppCardDataParameters, String, UserAddress, Activity, MppPushCardToGooglePayListener)
method call.- Parameters:
requestCode
- Request code received as a parameter from Activity.onActivityResult(int, int, Intent) method.resultCode
- Result code received as a parameter from Activity.onActivityResult(int, int, Intent) method.intent
- Result intent received as a parameter from Activity.onActivityResult(int, int, Intent) method.activity
- Activity which received result from Activity.onActivityResult(int, int, Intent) method.- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
handleOnActivityResult
public static boolean handleOnActivityResult(int requestCode, int resultCode, @Nullable Intent intent, @NonNull Activity activity) throws MppException Handles intermediate results returned by Activity.onActivityResult(int, int, Intent) method as a result of method calls from MPP SDK related to the Google Pay.- Parameters:
requestCode
- Request code received as a parameter from Activity.onActivityResult(int, int, Intent) method.resultCode
- Result code received as a parameter from Activity.onActivityResult(int, int, Intent) method.intent
- Result intent received as a parameter from Activity.onActivityResult(int, int, Intent) method.activity
- Activity which received result from Activity.onActivityResult(int, int, Intent) method.- Returns:
- true if requestCode is handled by MPP SDK, false otherwise
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
isDefaultPaymentApplication
Issuer app should check if Google Pay is the default NFC payment app after card tokenization. This will ensure that the users who provision a token will be able to use it in Google Pay.- Parameters:
context
- Context needed for check.- Returns:
- true if Google Pay is the default application for contactless, false otherwise
- Throws:
MppException
- UseMppException.getMppError()
()} to get error object with error code and error description.
-
setAsDefaultPaymentApplication
Set Google Pay as a default app for NFC payments.- Parameters:
activity
- Activity to be used forActivity.startActivityForResult(Intent, int)
call.requestCode
- a request code value to be passed intoActivity.startActivityForResult(Intent, int)
call.
-
sendUserToGooglePay
Helper method to send user to the Google Pay app to see the tokenized card.- Parameters:
activity
- Activity to be used for launching Google Pay app.
-
isWalletAvailable
Checks if Google Wallet is installed on device.- Parameters:
context
- Application context.- Returns:
- true Google Wallet is installed on device, false otherwise.
- Throws:
MppException
- UseMppException.getMppError()
to get error object with error code and error description.
-
handleOnActivityResult(int, int, Intent, Activity)
instead.