New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bankbox-me-sdk

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bankbox-me-sdk

Raven Bankbox JS Payment SDK

  • 0.0.2
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

@ravenpay/bankbox-me-sdk

Introduction

@ravenpay/bankbox-me-sdk is a JavaScript SDK designed to seamlessly integrate the Bankbox payment widget into web applications. This SDK allows developers to embed and manage the Bankbox widget for handling transactions with customizable configurations.

Installation

Install the SDK via npm:

npm install @ravenpay/bankbox-me-sdk

Or using yarn:

yarn add @ravenpay/bankbox-me-sdk

Usage

Importing the SDK

import BankboxManager from '@ravenpay/bankbox-me-sdk';

Initializing the SDK

Create an instance of BankboxManager with the required configuration:

const bankbox = new BankboxManager({
  appName: 'your-app-name',
  environment: 'sandbox', // or 'production' only production supported, you can leave blank for production
  // widgetOptions: {},
  containerId: 'bankbox-container' //optional,
  onSuccess: (data) => console.log('Transaction Successful:', data),
  onFail: (data) => console.log('Transaction Failed:', data),
  onError: (error) => console.error('Error:', error),
  onLoad: () => console.log('Bankbox Loaded'),
});

Mounting the Widget

To mount the Bankbox widget inside a specific container:

bankbox.mount({
  email: 'user@example.com',
  amount: 1000,
  containerId: 'custom-container-id',
});

Opening the Widget

To display the Bankbox widget as an overlay:

bankbox.open({
  email: 'user@example.com',
  amount: 1000,
});

Closing the Widget

To close the Bankbox widget manually:

bankbox.close();

Event Listeners

You can listen to various events using event listeners:

bankbox.addEventListener('success', (data) => {
  console.log('Transaction Successful:', data);
});

bankbox.addEventListener('fail', (data) => {
  console.log('Transaction Failed:', data);
});

bankbox.addEventListener('error', (error) => {
  console.error('Error:', error);
});

To remove an event listener:

bankbox.removeEventListener('success', callbackFunction);

Destroying the Widget

To completely remove the Bankbox instance and clean up event listeners:

bankbox.destroy();

Configuration Options

PropertyTypeDescription
appNamestringYour application name
environment`'sandbox''production'`
widgetOptionsobjectAdditional configuration options for the widget
containerIdstringID of the container element for embedding the widget
onSuccessfunctionCallback triggered on successful transactions
onFailfunctionCallback triggered on failed transactions
onErrorfunctionCallback triggered on widget errors
onLoadfunctionCallback triggered when the widget loads

Events

Event TypeDescription
successTriggered when a transaction is successful
failTriggered when a transaction fails
errorTriggered when an error occurs in the widget
loadTriggered when the widget loads

Styling Notes

The default container includes:

  • Semi-transparent overlay with blur effect
  • Bottom-mounted modal with rounded corners
  • Close button styled with black background
  • Responsive iframe sizing

Override styles by:

  • Providing your own container element
  • Adding custom CSS rules targeting #bankbox-container

Security Considerations

  • Uses postMessage with strict origin validation
  • Ensure your domain is whitelisted for production use
  • Never expose API keys in client-side code

Browser Support

Modern browsers (Chrome 80+, Firefox 72+, Safari 13+). Requires:

  • ES6 support
  • Promise API
  • postMessage API

Troubleshooting

Widget not loading:

  • Check if the container element exists in the DOM
  • Verify network requests aren't blocked
  • Ensure correct environment configuration

Events not firing:

  • Verify origin matches your appName configuration
  • Check for console errors
  • Ensure event listeners are registered before mount

License

MIT License. See LICENSE for details.

Keywords

FAQs

Package last updated on 06 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc