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

endozpay-sdk

v1.0.7

Published

The official Endozpay JavaScript/React SDK

Readme

Endozpay Open Banking JS SDK

A universal, framework-agnostic JavaScript SDK for securely embedding the Endozpay checkout and bank-selection flow into any web application.

🏗 Architecture Overview

The Endozpay SDK is built defensively to ensure absolute stability and security on third-party merchant websites.

  • Framework Agnostic: While authored in React and Tailwind, the SDK compiles down to pure Vanilla JavaScript. The host application does not need React installed.
  • CSS Encapsulation: The entire UI is mounted inside an open Shadow DOM. This guarantees zero CSS bleed—the host's styles will not break the widget, and the widget's Tailwind utility classes will not leak into the host application.
  • Idempotent Initialization: Safe against multiple instantiation calls (e.g., React 18 Strict Mode double-renders) preventing memory leaks and DOM duplication.

📦 Installation

Choose your distribution method based on your tech stack.

Option A: NPM / Yarn (Modern Frameworks)

For applications using bundlers (React, Next.js, Vue, Angular, Svelte).

npm install endozpay-sdk
# or
yarn add endozpay-sdk

Option B: CDN (Vanilla HTML / PHP / Webflow)

For direct browser inclusion, utilize the pre-compiled UMD build via unpkg or jsDelivr.

<script src="https://unpkg.com/[email protected]/dist/endozpay-sdk.umd.js"></script>

🚀 Quick Start Guides

1. React / Next.js Integration

Import the SDK class and initialize it within a useEffect. Always call .destroy() in the cleanup function to prevent memory leaks during component unmounting.

import { useEffect, useRef } from 'react';
import { EndozpaySDK } from 'endozpay-sdk';

export default function CheckoutPage() {
  const isInitialized = useRef(false);

  useEffect(() => {
    // Prevent double-initialization in React StrictMode
    if (isInitialized.current) return;
    isInitialized.current = true;

    const endozpay = new EndozpaySDK();

    endozpay.init({
      containerId: 'endozpay-checkout-node',
      payload: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...', // Replace with dynamic JWT from your backend
      environment: 'sandbox',
      onSuccess: (data) => {
        console.log('Payment authorized successfully:', data);
        // Redirect to success page or update UI
      },
      onError: (error) => {
        console.error('Payment failed:', error);
      },
      onCancel: () => {
        console.log('User cancelled the flow.');
      },
      onRedirect: (url) => {
        console.log('User redirected to:', url);
      }
    });

    // Cleanup memory and remove DOM nodes on unmount
    return () => {
      endozpay.destroy();
      isInitialized.current = false;
    };
  }, []);

  // Ensure the target node has explicit dimensions
  return (
    <div className="flex justify-center items-center w-full min-h-screen bg-gray-50">
      <div id="endozpay-checkout-node" className="w-full max-w-md h-[600px] relative" />
    </div>
  );
}

2. Vanilla HTML / Inline JS Integration

When loaded via the CDN script tag, the SDK exposes the Endozpay class globally on the window object.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Merchant Checkout</title>
    <!-- 1. Load the SDK -->
    <script src="https://unpkg.com/[email protected]/dist/endozpay-sdk.umd.js"></script>
    <style>
        /* Define the boundaries for the widget */
        #payment-container { width: 100%; max-width: 500px; height: 600px; margin: 0 auto; position: relative; }
    </style>
</head>
<body>

    <!-- 2. Target Container -->
    <div id="payment-container"></div>

    <!-- 3. Initialize SDK -->
    <script>
        document.addEventListener("DOMContentLoaded", function() {
            // The class is available globally via window.Endozpay
            const sdk = new window.Endozpay();

            sdk.init({
                containerId: 'payment-container',
                payload: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...',
                environment: 'production',
                onSuccess: function(data) {
                    alert("Payment Success!");
                },
                onCancel: function() {
                    console.log("Payment window closed.");
                }
            });
        });
    </script>
</body>
</html>

⚙️ API Reference

EndozpayConfig Object

The configuration object passed into the .init() method.

| Property | Type | Required | Description | | --- | --- | --- | --- | | containerId | string | Yes | The DOM id of the empty <div> where the widget will mount. | | payload | string | Yes | The encrypted payment intent or JWT payload generated by your backend. | | environment | 'sandbox', 'production' | No | The environment in which the SDK is running. | Dictates the API base URL. Defaults to 'production'. | | onSuccess | (data: any) => void | No | Fired when the Open Banking authorization is successful. | | onError | (error: any) => void | No | Fired if a network error occurs or the user encounters a strict API failure. | | onCancel | () => void | No | Fired when the user explicitly clicks the "Cancel" button. | | onRedirect | (url: string) => void | No | Overrides default WebSocket behavior. If provided, the SDK passes the banking redirect URL to this callback instead of immediately changing window.location.href. |

SDK Methods

  • sdk.init(config: EndozpayConfig): Mounts the Shadow DOM, injects encapsulated styles, and boots the React UI.
  • sdk.destroy(): Safely unmounts the internal React tree, disconnects active WebSockets, and cleans up the Shadow DOM to prevent memory leaks in Single Page Applications (SPAs).

🔒 Security Notes for Implementers

  1. Never pass plain text parameters: The payload must be securely generated on your server and passed to the frontend. Do not construct payment details directly in the browser.
  2. CSP (Content Security Policy): If your site utilizes strict CSP headers, ensure you allow connections to https://endozapi.celergate.net (and your WebSocket domains) in your connect-src directives.