Wallet

Wallet Configuration

Wallet Dependencies

If you intend to use the wallet feature of the VenueNext SDK, add the following dependencies and compile options to your app’s build.gradle file:

Dependencies:

implementation 'com.venuenext:vnwallet:0.12.3'
implementation 'com.venuenext:vnwalletui:0.12.3'
implementation 'androidx.camera:camera-core:1.0.0-alpha06'
implementation 'androidx.camera:camera-camera2:1.0.0-alpha06'

Compile Options:

compileOptions {
    sourceCompatibility = 1.8
    targetCompatibility = 1.8
}
// kotlinOptions is optional for now
kotlinOptions {
  jvmTarget = JavaVersion.VERSION_1_8
}

Wallet Setup

To use wallet, you must do the following:

  • Implement the WalletInterface
    • virtualCurrencyName will be the name that is displayed in wallet and checkout areas of the SDK.
    • showWallet() will show the VenueNext wallet UI.
  • Implement the TicketingInterface, and specifically the startLoginFlow() function.
    • If using JWT, the TicketingInterface does not need to be implemented.
    • Note about the TicketingInterface: Some experiences that are currently being sold are exclusive to Season Ticket Holders. We determine if a user is a Season Ticket Holder by using their ticketing provider account. If a user has not yet signed into your ticketing provider, a button will appear in the UI that says “Sign In”. Tapping that button calls VenueNext.ticketingInterface.startLoginFlow(). This means that the ticketing interface you supply to the SDK during the initialization process will need to be available when users are viewing experiences. This also includes utilizing the VNTicket calls to inform the SDK of login success and failure. For additional details, see Wallet Setup.
  • Pass the instance of each of these interfaces to the VenueNext object in the setup seen in the Initialize the SDK section (we recommend setting these after calling the the VenueNext::initialize function):
    • VenueNext.walletInterface = myWalletInterface
    • VenueNext.ticketingInterface = myTicketingInterface Ignore if using JWT

Have you been provided a config file from VenueNext? Skip the rest of this section and the section on Virtual Currency - this part of the setup is handled for you already. See Wallet Setup with Config File as your next step.

  • You have the ability to show or hide the toggle that changes the displayed QR code in the wallet view and configure wallet functionality
    • Add the call in the code sample below to the SDK setup seen in the Initialize the SDK section, passing true if you would like to show the toggle and false if you would like to hide it.
  • Additionally, to display the QR code, utilize the camera to read QR codes from the kiosk, or use both, pass one of these additional QRConfig Enum values as the second parameter of the VNWalletUI::configure function.
val isVirtualCurrencyToggleVisible = false
val qrConfig = QrConfig.VC_AND_SCANNER
VNWalletUI.configure(isVirtualCurrencyToggleVisible, qrConfig)

See the Virtual Currency section for more information on the isVirtualCurrencyEnabled parameter of the VNWalletUI::configure function.

Virtual Currency

Skip this section if virtual currency is available for purchasing all product types

Virtual currency can be used to make purchases for any ProductType. By default, all product types may be purchased with virtual currency. You may wish to restrict virtual currency purchasing per product type (this will remove the virtual currency toggle from the checkout screen).

See the following example (refer to the Demo App for more detail):

val virtualCurrencyProductTypes = listOf(
  ProductType.FOOD
)

VNWalletUI.configure(
  isVirtualCurrencyToggleVisible = true,
  qrConfig = QrConfig.VC_AND_SCANNER,
  isVirtualCurrencyEnabled = virtualCurrencyProductTypes.isNotEmpty()
  // isVirtualCurrencyEnabled does not need to be set if all are allowed because
  // all are allowed by default
  )

VNOrderUI.configureVirtualCurrencyProductTypes(virtualCurrencyProductTypes)

Since the allowed virtual currency product types in VNOrderUI also has implications in the Wallet, we also explicitly set the isVirtualCurrencyEnabled flag for Wallet configuration in the example above.

  • Note: Remember that if all ProductTypes should be virtual currency enabled, this section can be skipped.

Wallet Setup with Config File

Since you have initialized the SDK with a config file, the only additional piece of code you need to after creating and setting the TicketingInterface and the WalletInterface is initializing the VNWalletUI object. See below:

VNWalletUI.initialize()

QR Scanner

When using the scanner add the following to your project’s AndroidManifest.xml

<uses-permission android:name="android.permission.CAMERA" />
  • Note: The default behavior of the wallet (if this call is not made) is that the virtual currency toggle will be shown, and VC_ONLY will be applied, meaning the wallet will only display QR codes.

Wallet Deep Linking Setup

Add the following call to the SDK setup from the Initialize the SDK section:

VenueNext.registerDeepLinkable(VNWalletUI)

This enables deep linking from emails to accept a virtual currency transfer.

Wallet Flow and Navigation

When the user has not logged into your ticketing platform:

Example (assumes that this sample class implements LoginResultListener):

// Your ticketing login callback
private fun onLogin( ... ) {

    ...

    val ticketingLoginData = TicketingLoginData(
        email,
        memberId,
        firstName,
        lastName
    )

    // Register the login listener
    VNTicket.registerLoginResultListener(this)

    // Kick off the (asynchronous) SDK login handler
    VNTicket.onLoginSuccess(ticketingLoginData)

    // We recommend showing a progress bar or other loading UI here

    ...
}


...

// Called asynchronously. Ticketing data can be safely ignored
override fun onLoginSuccess(ticketingLoginData: TicketingLoginData) {
    VNTicket.unregisterLoginResultListener(this)

    // Wallet is ready to be shown!
    VenueNext.walletInterface?.showWallet() ?: throw IllegalStateException("Wallet not configured")
}

// Unhide loading UI and show an error here
override fun onLoginFailure() {
    ...
}


override fun onLogoutAllSuccessful() {
    VNTicket.logout(this::ticketingLogoutSuccess, this::ticketingLogoutFailure)
}

private fun ticketingLogoutSuccess() {
    // Hide UI, perform back press, etc.
}
private fun ticketingLogoutFailure(exception: Exception) {
    exception.printStackTrace()
}

// Unregister the listener to avoid a memory leak
override fun onDestroy() {
    super.onDestroy()
    VNTicket.unregisterLoginResultListener(this)
}

Note: If the wallet is shown before logging in, our UI will call TicketingInterface.startLoginFlow(). We recommend against launching the wallet before you have logged in.

Adding Season Ticket Holder Banner Color and Program Name

You can set up the program name and the color displayed to season ticket holders in the wallet. To do this, add the following values:

  • Add a color to your colors.xml file called vn_sth_color that contains the color that you would like the wallet banner to transition to
  • Add a string to your strings.xml file called vn_sth_member_name that contains the program name for season ticket holders (e.g. <string name="vn_sth_member_name">VIP MEMBER</string>)

Updated: