API Reference

Listening to events

You can listen to various events in the WalletBalance using the onEvent prop.

import { WalletBalance } from '@card91/react-native-sdk';

export function Page() {
  const onWalletEvent = (event) => {
    switch (event) {
      case 'C91_WALLET_SCREEN_INITIALISED':
        // Do something to indicate that the wallet screen has been initialized
        break;
      case 'c91_WALLET_SCREEN_SUCCESS':
        // Do something to handle the success of a wallet API call
        break;
      case 'C91_WALLET_API_FAILURE':
        // Do something to handle the failure of a wallet API call
        break;
      case 'C91_WALLET_AUTHENTICATION_FAILURE':
        // Do something to handle authentication failure in the wallet
        break;
      case 'C91_WALLET_SERVER_FAILURE':
        // Do something to handle server failure in the wallet
        break;
      case 'C91_WALLET_MISSING_PARAMETER':
        // Do something to handle missing parameter in the wallet
        break;
      default:
        // Handle any other event that is not explicitly listed
        break;
    }
  };
  
  return (
    <View>
	  	<WalletBalance ... onEvent={onWalletEvent} />
		</View>
  );
}

The events are as follows:

Event NameDescription
C91_WALLET_SET_PARAMSIndicates setting parameters in the wallet.
C91_WALLET_SCREEN_INITIALISEDDenotes the initialization of the wallet screen.
c91_WALLET_SCREEN_SUCCESSRepresents a successful response from a wallet API.
C91_WALLET_API_FAILUREIndicates a failure in a wallet-related API call.
C91_WALLET_AUTHENTICATION_FAILURESignifies an authentication failure in the wallet.
C91_WALLET_SERVER_FAILUREIndicates a failure related to the wallet's server.
C91_WALLET_MISSING_PARAMETERRepresents a scenario where a wallet parameter is missing.