Check digital card state
Overview
Flow
Sequence diagram
SDK
Check digital card state
Last updated
Was this helpful?
Was this helpful?
fun checkCardDigitizationState(d1Task: D1Task, cardID: String) {
val callback: D1Task.Callback<CardDigitizationState> =
object : D1Task.Callback<CardDigitizationState> {
override fun onSuccess(state: CardDigitizationState) {
// Update UI bases on the state value
// Hide button "Enable NFC Payment"
when (state) {
NOT_DIGITIZED -> {
// Check Device is Eligible
// Show button "Enable NFC Payment"
}
DIGITIZATION_IN_PROGRESS -> {
// Hide button "Enable NFC Payment"
// Show digitization in progress
}
DIGITIZED -> {
// Tap&Pay settings
// Check issuer application is the default payment application
}
}
}
override fun onError(exception: D1Exception) {
// Refer to D1 SDK Integration – Error Management section
// Exception: Not Supported: Display message 'Not Supported'
}
}
val d1PayWallet: D1PayWallet = d1Task.d1PayWallet
d1PayWallet.getCardDigitizationState(cardID, callback)
}public void checkCardDigitizationState(@NonNull D1Task d1Task, @NonNull String cardID) {
D1Task.Callback<CardDigitizationState> callback = new D1Task.Callback<CardDigitizationState>() {
@Override
public void onSuccess(@NonNull CardDigitizationState state) {
// Update UI bases on the state value
// Hide button "Enable NFC Payment"
switch (state) {
case NOT_DIGITIZED:
// Check Device is Eligible
// show button "Enable NFC Payment"
break;
case DIGITIZATION_IN_PROGRESS:
// Hide button "Enable NFC Payment"
// Show digitization in progress
break;
case DIGITIZED:
// Tap&Pay settings
// Check issuer application is the default payment application
break;
}
}
@Override
public void onError(@NonNull D1Exception exception) {
// Refer to D1 SDK Integration – Error Management section
// Exception: Not Supported: Display message 'Not Supported'
}
};
D1PayWallet d1PayWallet = d1Task.getD1PayWallet();
d1PayWallet.getCardDigitizationState(cardID, callback);
}