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

secure-connect-js

v0.0.8

Published

[![npm version](https://img.shields.io/npm/v/secure-connect-sdk?color=blue)](https://www.npmjs.com/package/secure-connect-sdk) [![Downloads](https://img.shields.io/npm/dm/secure-connect-sdk)](https://www.npmjs.com/package/secure-connect-sdk) [![Licens

Downloads

101

Readme

SecureConnect SDK

npm version
Downloads
License

SecureConnect SDK provides a secure and simple way to integrate a payment iframe on your website and generate payment tokens. Built for modern JavaScript and TypeScript applications, it supports sandbox and production environments, with AES-256-GCM encryption for card data.


Features

  • 🚀 Mount a secure payment iframe easily
  • 🔐 AES-256-GCM encryption for sensitive card data
  • 🪙 Generate payment tokens securely
  • 🌐 Supports both sandbox and production environments
  • 🧩 Works with plain JavaScript, React, or any frontend framework

Installation

npm install secure-connect-sdk

Quick Start

Add domain iframe url here

Change your iframe origin here in config.ts

    export const configs = {
      iframeOriginSandbox: "http://localhost:5173",
      iframeOriginProduction: "https://secureconnect-iframe.yourdomain.com",
}   ;

1. Add the container to your HTML

Add a container element where the payment form should appear, and a button to trigger the payment:

<div id="secureconnect-container"></div>
<button id="pay-btn">Pay Now</button>

2. Initialize the SDK

Import the SDK, initialize it with your credentials, and mount the iframe.


import { createSecureConnect } from "secure-connect-sdk";

// 1. Initialize the SDK
const sdk = createSecureConnect(
"YOUR_API_LOGIN_ID", // e.g. dfa0b1...
"YOUR_TRANSACTION_KEY", // e.g. 7063b19beef9...
{
environment: "sandbox", // 'sandbox' or 'production'
}
);

// 2. Mount the iframe
sdk.mount("secureconnect-container");

// 3. Handle Payment
document.getElementById("pay-btn").addEventListener("click", async () => {
try {
// Request a data from the iframe
const data = await sdk.createPayment();

    console.log("Payment successful! Data:", data);

    // Send this token to your backend to finalize the charge
    // await sendTokenToBackend(data.token);

} catch (err) {
console.error("Payment failed:", err);
alert("Payment failed. Please try again.");
}
});

API Reference

createSecureConnect(apiLoginId, transactionKey, options)

Creates a new instance of the SecureConnect SDK.

| Parameter | Type | Description | | ---------------- | ------ | -------------------------------------------------------- | | apiLoginId | string | Required. Your unique merchant login ID. | | transactionKey | string | Required. Your public API key provided by the dashboard. | | options | object | Configuration object. |

Options Object:

| Key | Type | Default | Description | | ------------- | ------ | ----------- | ------------------------------------------- | | environment | string | 'sandbox' | Set to 'production' for live transactions |


sdk.mount(elementId)

Mounts the payment iframe into the DOM.

  • elementId (string): The ID of the HTML element where the iframe should be rendered.

sdk.createPayment()

Triggers the tokenization process.

  • Returns: Promise<string>
  • Resolves: A secure payment token string
  • Rejects: An error object if validation fails or the network request fails

Framework Examples

React Example

import React, { useEffect, useRef } from "react";
import { createSecureConnect } from "secure-connect-sdk";

export const PaymentForm = () => {
  const sdkRef = useRef<any>(null);

  useEffect(() => {
    sdkRef.current = createSecureConnect(
      "API_LOGIN_ID",
      "YOUR_TRANSACTION_KEY",
      { environment: "sandbox" }
    );

    sdkRef.current.mount("payment-div");

    // Cleanup iframe on unmount if supported by SDK
    return () => {
      // sdkRef.current.unmount();
    };
  }, []);

  const handlePay = async () => {
    try {
      const data = await sdkRef.current.createPayment();
      console.log("Token:", data.token);
    } catch (err) {
      console.error(err);
    }
  };

  return (
    <div>
      <div id="payment-div" style={{ minHeight: "300px" }}></div>
      <button onClick={handlePay}>Pay Now</button>
    </div>
  );
};

Security Best Practices

  • Never expose your Secret Key: The keys used in the frontend SDK (Initialize) should be your Public keys. Keep your Secret keys on your backend server.
  • HTTPS: Ensure your payment page is served over HTTPS (required for production).

License

MIT © Your Company Name