Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-datatrans-light-box

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-datatrans-light-box

Datatrans Lightbox component for React apps

  • 4.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
414
decreased by-79.74%
Maintainers
2
Weekly downloads
 
Created
Source

NPM version CI

Datatrans React Light Box

Official Datatrans light box library for showing our payment page in React applications. React is defined as a peer dependency and expected to be made available by your project. Other than that this library is completely dependency-free.

Compatibility

Beginning with v3.0.0, this component is using the Datatrans Payment JSON API.

If you're still using the legacy XML API, please refer to react-datatrans-light-box v2.0.2.

How to install

# Use with current JSON API
npm install react-datatrans-light-box

# Use with legacy XML API (supported by react-datatrans-light-box <= 2.x)
npm install react-datatrans-light-box@2

Example usage

import React, { useState } from 'react'
import Lightbox from 'react-datatrans-light-box'

export default (props) => {
  const { transactionId } = props

  const [lightbox, showLightbox] = useState(false)

  const onLoaded = () => console.log('Loaded')
  const onOpened = () => console.log('Opened')
  const onCancelled = () => showLightbox(false)
  const onError = (data) => {
    console.log('Error:', data)
    showLightbox(false)
  }

  return <div>
    <h1>Datatrans Lightbox Demo</h1>
    <div>
      {lightbox
        ? <Lightbox
            transactionId={transactionId}
            production={true}
            onLoaded={this.onLoaded}
            onOpened={this.onOpened}
            onCancelled={this.onCancelled}
            onError={this.onError}
          />
        : <button onClick={() => showLightbox(true)}>Start Lightbox</button>
      }
    </div>
  </div>
}

Properties

The Lightbox component takes the following properties as input.

PropertyMandatoryTypeDescription
transactionIdYesStringTransaction ID returned by Initializing Transactions.
productionNoBooleanIndicates whether requests hit Datatrans' production or sandbox environment. Defaults to false (sandbox).
onLoadedNoFunctionCalled when payment page is loaded.
onOpenedNoFunctionCalled when payment page is opened.
onCancelledNoFunctionCalled when user has cancelled payment.
onErrorNoFunctionCalled when there was an error loading the payment page.

Keywords

FAQs

Package last updated on 04 Jul 2023

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