Skip to main content

Card activation and setting preference

After the tokenized account is enrolled into the wallet, a card will be added into the wallet and can be fetched via Wallet#cards() method. If the card does not need additional authentication, it will also be automatically activated shortly after.

When the card activation is complete, the CardEventListener#onCardActivated(context, cardId) callback will be triggered. At this point, we can set it as the default card for NFC payment.

Set default card for NFC payment
wallet.setDefaultCard(cardId)
success

The app is now ready to make NFC payments with any NFC enabled payment terminal.

Activating a card

In some scenarios additional user authentication is required. In such cases, you should ask the customer's consent for NFC payment and prompt them to input the authentication data (for example an OTP) sent to the customer by yourself or the third party issuer. Once the authentication data is collected, you can activate the card manually using the Card#activateCard(authenticationData) method.

note

By default, when tokenizing customer accounts using Open Fabric, we do not require the activation step. However, when creating accounts from existing cards not managed through Open Fabric this activation step is more common.

Activating card
val card = wallet.cards().find {
it.status == CardStatus.NOT_ACTIVATED && it.isActivationRequired()
}

card?.activateCard(authenticationData)

Card preference

A single secure device wallet can provision multiple cards. This section helps you modify the default payment card preference.

Set default card: Wallet#setDefaultCard() method can be used to change the default payment card to the transaction. This function can be called using the identifier of the card.

Get default card: Wallet#getDefaultCardId() method can be used to get the identifier of the default card which will be used for transaction processing.

Next payment card: Wallet#setNextTransactionCard() method can be used to change the card for the next payment. A card remains set as the next payment card until a payment is performed.

Reset next payment card: Wallet#resetNextTransactionCard() method can be used to reset the Card to be used for the next payment to the default card.

Wallet state change

The state of the wallet can be updated from actions triggered from outside of the app. For example, updated from the backend, upon detecting security issues such as a rooted device, tampered application, or changes in device fingerprint. In order to be aware of any change occurring on the wallet, the hosting app can register a wallet notification listener implementing the WalletNotificationServiceCallback class.

The overriding functions of the listener will be called upon the occurrence of the associated events on the wallet:

  1. onWalletLocked: Signifying that the customer's wallet has been locked.
  2. onWalletUnlocked: Indicating that the customer's wallet has been successfully unlocked.
  3. onWalletDeleted: Triggered when the customer's wallet is deleted.
  4. onSettingsUpdated: Triggered when wallet settings have been updated.
  5. onLostEligibility: Triggered when the device loses eligibility for using the wallet
note

The registration of the listener is done by declaring the listener class in your manifest file under the key co.openfabric.nfc.WalletNotificationListener, as shown below:

AndroidManifest.xml
<meta-data
android:name="co.openfabric.nfc.WalletNotificationListener"
android:value="mypackage.MyWalletNotificationListener" />