Welcome to our new developer portal! Use the "Ask" button to chat with our AI Agent.

Android

Step 1: Showing the Add to Wallet button

Your issuer application uses the Push Provisioning SDK to check whether the target xPay Wallet is supported on the device and whether a token already exists for the card. Based on the result, it shows or hides the Add to Wallet button.

Follow these wallet brand guidelines for using Add to Wallet in your issuer application:

Using the last four digits of the PAN, the issuer application can retrieve the token for a card that is already provisioned to a wallet on the device (Samsung Pay and Google Pay for Android).

Each token includes:

  • The token ID.

  • The last four digits of the digital card (DPAN).

  • The token state (digitization status).

OEMPayType type = OEMPayType.GOOGLE_PAY; // or OEMPayType.SAMSUNG_PAY
GetTokenInput input = new GetTokenInput("1234"); // last four digits of the physical card (FPAN)
PushProvisioning pushProvisioning = TPCManager.getInstance().getPushProvisioning(type);
pushProvisioning.getToken(input, new TPCSDKListener<Token>() {
    @Override
    public void onStart() {
    }
    @Override
    public void onSuccess(TPCResult<Token> result) {
        //Token can be retrieved using result.getResult().
        //result.getResult() will return null  if the OEM wallet does not have a corresponding token.
        //Token state is used as follows:
        if(result.getResult()==null || TextUtils.isEmpty(result.getResult().getState())){
            //API did not return a token.
            //Displays the "Add to GPay/SPay" button.
        }else{
            Token token = result.getResult();
            if(type==OEMPayType.GOOGLE_PAY){
                //For Google Pay.
                try {
                    int tokenState = Integer.parseInt(token.getState());
                    switch (tokenState){
                        case CardDigitizationStatus.GOOGLE_PAY_TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION:
                            // Refer to Token life cycle management for Activate action.
                            // card is pending for ID&V. 
                            break;
                        case CardDigitizationStatus.GOOGLE_PAY_TOKEN_STATE_PENDING:
                        case CardDigitizationStatus.GOOGLE_PAY_TOKEN_STATE_SUSPENDED:
                        case CardDigitizationStatus.GOOGLE_PAY_TOKEN_STATE_ACTIVE:
                            //Card is already added.
                            break;
                        case CardDigitizationStatus.GOOGLE_PAY_TOKEN_STATE_UNTOKENIZED:
                            //Display "Add to GPay" button.
                            break;
                    }
                } catch (NumberFormatException e) {
                    //Handles the exception.
                }
            }else if(type==OEMPayType.SAMSUNG_PAY){
                //For Samsung Pay.
                String tokenState = token.getState();
                switch (tokenState){
                    case CardDigitizationStatus.SAMSUNG_PAY_PENDING_PROVISION:
                        // Refer to Token life cycle management for Activate action.
                        // card is pending for ID&V
                        break;
                    case CardDigitizationStatus.SAMSUNG_PAY_ACTIVE:
                    case CardDigitizationStatus.SAMSUNG_PAY_EXPIRED:
                    case CardDigitizationStatus.SAMSUNG_PAY_PENDING_ENROLLED:
                    case CardDigitizationStatus.SAMSUNG_PAY_SUSPENDED:
                    case CardDigitizationStatus.SAMSUNG_PAY_PENDING_ACTIVATION:
                        //Card is already added.
                        break;
                    case CardDigitizationStatus.SAMSUNG_PAY_DISPOSED:
                        //Displays the "Add to SPay" button.
                        break;
                }
            }
        }
    }
    @Override
    public void onError(TPCSDKException exception) {
        // specific for Samsung Pay
        Throwable exceptionCause = exception.getCause();
        if (exceptionCause != null && exceptionCause instanceof TPCSpayException) {
            // get more details of the error for Samsung Pay
            TPCSpayException spayException = (TPCSpayException) exceptionCause;
        }
    }
});

For Google Pay, the status of the token is as follows:

Google Pay State
Description

GOOGLE_PAY_TOKEN_STATE_NEEDS_IDENTITY_VERIFICATION

Card is digitized, pending for ID&V.

GOOGLE_PAY_TOKEN_STATE_PENDING

Card is digitized.

GOOGLE_PAY_TOKEN_STATE_SUSPENDED

Card is digitized.

GOOGLE_PAY_TOKEN_STATE_ACTIVE

Card is digitized.

GOOGLE_PAY_TOKEN_STATE_UNTOKENIZED

Card is not digitized.

CARD_IS_NOT_DIGITIZED

Card is not digitized.

For Samsung Pay, the status of the token is as follows:

Samsung Pay State
Description

SAMSUNG_PAY_PENDING_PROVISION

Card is digitized, pending for ID&V.

SAMSUNG_PAY_ACTIVE

Card is digitized.

SAMSUNG_PAY_EXPIRED

Card is digitized.

SAMSUNG_PAY_PENDING_ENROLLED

Card is digitized.

SAMSUNG_PAY_PENDING_ACTIVATION

Card is digitized.

SAMSUNG_PAY_SUSPENDED

Card is digitized.

SAMSUNG_PAY_DISPOSED

Card is not digitized.

exclamation-circle

Caution

  • For Google Pay, if the card still appears as NOT_DIGITIZED after digitization, check that the issuer application is configured correctly in the TSP portal.

  • For Samsung Pay, some issuers must register multiple ISSUER NAME values in the portal. This depends on the issuer application and/or TSP requirements. Make sure the ISSUER NAME value in the API matches the value registered in the portal. The API returns only exact matches.

  • The getToken API is not supported for Huawei Pay. Use isCardDigitized to check the digitization status.

Step 2: Provisioning a request

On Android, the success result varies by OEMPayType. For Google Pay, the SDK returns a token ID. For Samsung Pay, it returns a Card object. For Huawei Pay, it returns a boolean.

info-circle

Note

Since TPC SDK v1.9.0, Google Pay push provisioning can use the new API: addCard(Activity activity, CardInfo cardInfo, TPCSDKListener<T> listener).

Last updated

Was this helpful?