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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sqala/threedsecure-react

v0.4.4

Published

A React library for implementing 3D Secure authentication flows in payment applications

Downloads

38

Readme

TypeScript GitHub GitHub Actions Visual Studio Code

3D Secure React Library

A modern React library that simplifies the integration of 3D Secure (3DS) authentication for secure payment processing in web applications.

Overview

This library provides a set of React hooks and utilities to implement 3D Secure authentication flows in your payment applications. It supports the full 3DS authentication lifecycle including directory server interactions, challenges, and result handling.

Features

  • Complete 3D Secure authentication flow
  • React hooks-based API
  • Handles the entire authentication lifecycle
  • Type-safe implementation with TypeScript
  • Responsive challenge rendering
  • Cancellable authentication processes

Installation

npm install @sqala/threedsecure-react
# or
yarn add @sqala/threedsecure-react

Quick Start

import { useRef } from 'react';
import { useThreeDSecure } from '@sqala/threedsecure-react';

function PaymentComponent() {
  const containerRef = useRef<HTMLDivElement>(null);
  
  const { isExecuting, status, result, execute, cancel } = useThreeDSecure({
    baseUrl: 'https://api.sqala.tech/core/v1/threedsecure',
    publicKey: 'your-public-key',
    container: containerRef
  });

  const handleAuthentication = async () => {
    await execute({
      id: 'authentication-id' // Unique identifier for the authentication
      ip: 'user-ip' // Optional user's IP address
    });
  };

  return (
    <div>
      <button 
        onClick={handleAuthentication}
        disabled={isExecuting}
      >
        Process Payment
      </button>
      
      {isExecuting && <p>Processing payment authentication...</p>}
      {status && <p>Current status: {status}</p>}
      
      {/* Container for 3DS challenges */}
      <div ref={containerRef} style={{ width: '100%', height: '400px' }} />
      
      {isExecuting && (
        <button onClick={cancel}>Cancel</button>
      )}
      
      {result && (
        <div>
          <h3>Authentication Result</h3>
          <pre>{JSON.stringify(result, null, 2)}</pre>
        </div>
      )}
    </div>
  );
}

When calling execute on a useEffect, pass an AbortController and call abort on the cleanup function:

useEffect(() => {
  const abortController = new AbortController()

  execute({
    id: "authentication-id",
    ip: "user-ip",
    abortController,
  })

  return () => abortController.abort()
})

Development Setup

Prerequisites

  • Node.js 18+ and npm/yarn
  • Modern browser with DevTools for debugging

Setting Up the Development Environment

  1. Clone the repository:

    git clone https://github.com/rpo-pay/threedsecure-react.git
    cd threedsecure-react
  2. Install dependencies:

    npm install
    # or
    yarn
  3. Start the development server:

    npm run start:dev
    # or
    yarn start:dev

This will concurrently:

  • Build the library TypeScript files
  • Watch for changes in the lib folder
  • Start Vite's development server

Project Structure

threedsecure-react/
├── lib/                  # Library source code
│   ├── hooks/            # React hooks
│   ├── models/           # Data models
│   ├── types/            # TypeScript type definitions
│   └── main.ts           # Main entry point
├── src/                  # Demo application
├── dist/                 # Build output
├── .vscode/              # VS Code configuration
├── tsconfig.lib.json     # TypeScript config for the library
└── vite.config.ts        # Vite configuration

Debugging

The project is configured with source maps for easy debugging. When using VS Code:

  1. Open the project in VS Code
  2. Set breakpoints in your code
  3. Press F5 to start debugging (this launches Edge with the development server)
  4. The debug session will automatically terminate the development server when stopped

Running Tests

npm run test
# or
yarn test

Building for Production

npm run build
# or
yarn build

This generates the library output in the dist directory.

Contributing

We welcome contributions from the community! Here are some ways you can contribute:

Reporting Issues

  • Use the issue tracker to report bugs
  • Include detailed steps to reproduce the issue
  • Mention your environment (browser, OS, library version)

Feature Requests

  • Open an issue describing the feature
  • Explain the use case and benefits
  • Discuss implementation approaches

Pull Requests

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Development Guidelines

  • Follow the existing code style and patterns
  • Write unit tests for new features
  • Update documentation for any API changes
  • Keep commits focused and atomic
  • Use semantic commit messages

License

MIT

Acknowledgements

  • This library is developed and maintained by Sqala
  • Special thanks to all the contributors who have helped improve this project