npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@ravenpay/bankbox-me-sdk

v0.1.37

Published

Raven Bankbox JS Payment SDK

Downloads

79

Readme

Bankbox Me SDK Documentation

Table of Contents

Introduction

Bankbox Me SDK is a flexible payment integration solution that allows you to seamlessly embed payment functionality into your web applications. It provides a simple API for initializing payment widgets, handling payment flows, and managing the payment experience for your users.

Installation

# Using npm
npm install @ravenpay/bankbox-me-sdk

# Using yarn
yarn add @ravenpay/bankbox-me-sdk

Quick Start

Here's a basic implementation to get started with Bankbox SDK:

import React from 'react'
import BankboxManager from '@ravenpay/bankbox-me-sdk'

const PaymentComponent = () => {
  // Initialize the Bankbox manager
  const bankbox = new BankboxManager({
    appName: 'your-app-name',
    environment: 'production', // or 'development'
    widgetOptions: {
      isPersistent: true,
    },
    onSuccess: (data) => {
      console.log('Payment succeeded:', data)
    },
    onLoad: () => {
      console.log('Bankbox is ready')
    },
    onError: (error) => {
      console.error('An error occurred:', error)
    },
  })

  // Function to initiate payment
  const handlePayment = () => {
    bankbox.open({
      amount: 1000, // Amount in smallest currency unit
    })
  }

  return (
    <div>
      <button onClick={handlePayment}>Pay Now</button>

      <button
        onClick={() =>
          alert(
            `Bankbox is ${
              bankbox.isBluethoothConnected ? 'connected' : 'disconnected'
            }`
          )
        }
      >
        Check Connection Status
      </button>
    </div>
  )
}

export default PaymentComponent

Legacy CRA

If you encounter issues running the SDK with create-react-app (CRA), which has become obsolete, you can use the following approach. This method accesses the bundle file directly, bypassing React auto-import.

Here's a basic implementation to get started with Bankbox SDK:

import React from 'react'
import BankboxManager from '@ravenpay/bankbox-me-sdk/bundles/index.esm.js'

// The rest of the implementation follows...

Core Concepts

BankboxManager

The BankboxManager is the main entry point for the SDK. It handles initialization, configuration, and provides methods to control the payment flow.

Event System

Bankbox uses an event system to handle communication between your application and the payment widget. This enables you to receive updates and send data to the payment flow.

API Reference

BankboxManager Configuration

When initializing the BankboxManager, you can provide the following configuration options:

| Option | Type | Description | Required | Default | | --------------- | -------- | ------------------------------------ | -------- | ------- | | appName | string | Your application's identifier | Yes | - | | environment | string | 'development' or 'production' | Yes | - | | containerId | string | ID of the container element | No | - | | widgetOptions | object | Configuration for the payment widget | No | {} | | onSuccess | function | Callback when payment succeeds | No | - | | onLoad | function | Callback when widget loads | No | - | | onFail | function | Callback when payment fails | No | - | | onError | function | Callback when an error occurs | No | - |

Widget Options

| Option | Type | Description | Default | | --------------- | ------- | ---------------------------------- | ------- | | isPersistent | boolean | Keep widget instance after closure | false | | theme | string | 'light' or 'dark' | 'light' | | paymentMethod | string | Default payment method | - |

Methods

open(options)

Opens the payment widget with the specified options.

Parameters:

  • options (object):
    • amount (number): The payment amount in the smallest currency unit

Returns: Boolean - true if the widget was opened successfully, false otherwise

const opened = bankbox.open({ amount: 1000 })
if (opened) {
  console.log('Payment widget opened successfully')
}

close()

Closes the payment widget.

bankbox.close()

isBluethoothConnected

Checks if the SDK is properly connected and ready to use, this value returns a boolean.

Returns: Boolean - true if connected, false otherwise

if (bankbox.isBluethoothConnected) {
  console.log('Bankbox is connected and ready')
} else {
  console.log('Bankbox is not connected yet')
}

Events

The SDK allows you to handle various payment events:

Available Events

The SDK provides constants for common events that you can listen for in your callbacks:

  • onSuccess: Called when payment completes successfully
  • onFail: Called when payment fails
  • onError: Called when an error occurs
  • onLoad: Called when the Bankbox widget is fully loaded

Updating Payment Data

You can update the payment details using events. For example, you can update the payment amount dynamically based on user input.

TIP: You can hook this to your input element's onChange event.

// Updating payment amount
bankbox.$event.emit(bankbox.constants.sdkPaymentData, { amount: 1500 })

Here's an example of how to use the onChange event to update the payment amount:

import React, { useState } from 'react'
import BankboxManager from '@ravenpay/bankbox-me-sdk'

const PaymentComponent = () => {
  const [amount, setAmount] = useState(1000)
  const bankbox = new BankboxManager({
    appName: 'your-app-name',
    environment: 'production',
    widgetOptions: {
      isPersistent: true,
    },
    onSuccess: (data) => {
      console.log('Payment succeeded:', data)
    },
    onLoad: () => {
      console.log('Bankbox is ready')
    },
    onError: (error) => {
      console.error('An error occurred:', error)
    },
  })

  const handleAmountChange = (event) => {
    const newAmount = parseInt(event.target.value, 10)
    setAmount(newAmount)
    bankbox.$event.emit(bankbox.constants.sdkPaymentData, { amount: newAmount })
  }

  const handlePayment = () => {
    bankbox.open({ amount })
  }

  return (
    <div>
      <input
        type="number"
        value={amount}
        onChange={handleAmountChange}
        placeholder="Enter amount"
      />
      <button onClick={handlePayment}>Pay Now</button>
    </div>
  )
}

export default PaymentComponent

Troubleshooting

Widget Not Appearing

Ensure that:

  • You've provided a valid appName and environment
  • The container element exists (if containerId is specified)

Payment Processing Issues

If payments aren't processing correctly:

  • Verify the amount is in the correct format (smallest currency unit)
  • Ensure all required payment fields are provided
  • Check your callbacks are properly handling success and error cases
  • Check that isBluethootConnected returns true before attempting to process payment

Best Practices

  • Always check connection status before initiating payment flows
  • Implement proper error handling in your callbacks
  • Test thoroughly in development before moving to production
  • Provide clear feedback to users during or after the payment process
  • Hooking into the onSuccess & onFailure would allow take custom actions in your application based on transaction status