Android
Step 1: Showing the Add to Wallet button
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;
}
}
});Google Pay State
Description
Samsung Pay State
Description
Caution
Step 2: Provisioning a request
Note
Last updated
Was this helpful?