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

epic-collection-gateway-sdk

v1.0.7

Published

A lightweight TypeScript/JavaScript SDK for integrating **Epic Collections Web Checkout** into your web storefront. It handles authentication and redirect-flow initiation.

Downloads

513

Readme

Epic Collection Gateway SDK

A lightweight TypeScript/JavaScript SDK for integrating Epic Collections Web Checkout into your web storefront. It handles authentication and redirect-flow initiation.


Features

  • startEpicCollectionPayment – Authenticate with the Epic Collections API and get the redirect URL to the hosted payment portal in one call.
  • Zero dependencies, ESM-only, full TypeScript types included.

Installation

npm install epic-collection-gateway-sdk

Quick Start

import { startEpicCollectionPayment } from "epic-collection-gateway-sdk";

const url = await startEpicCollectionPayment({
  environment: "sandbox",
  clientId: "YOUR_CLIENT_ID",
  clientSecret: "YOUR_CLIENT_SECRET",
  redirectUrl: "https://your-site.com/order-result",
  amount: 2500,
  sessionId: "unique_order_session_id",
  customerDetails: { email: "[email protected]" },
});

// Navigate the user to the hosted payment portal
window.location.assign(url);

React Integration Example

Here is a practical example of integrating the SDK within a React component (e.g., a Header or Checkout button).

import { useState } from 'react';
import { startEpicCollectionPayment } from 'epic-collection-gateway-sdk';

const CheckoutButton = ({ cart, total }) => {
  const [paying, setPaying] = useState(false);

  const handleCheckout = async () => {
    if (cart.length === 0) return;
    try {
      setPaying(true);
      
      // Generate a unique session ID
      const sessionId = `${Date.now()}${Math.floor(Math.random() * 1e9)}`;
      
      const url = await startEpicCollectionPayment({
        environment: 'production', // or 'sandbox'
        clientId: 'YOUR_CLIENT_ID',
        clientSecret: 'YOUR_CLIENT_SECRET',
        redirectUrl: 'https://your-site.com/checkout-success',
        amount: total,
        sessionId,
        customerDetails: {
          email: '[email protected]',
          name: 'John Doe'
        },
      });

      // Redirect the user to the portal
      window.location.assign(url);
    } catch (error) {
      console.error("Payment failed", error);
    } finally {
      setPaying(false);
    }
  };

  return (
    <button 
      onClick={handleCheckout} 
      disabled={paying || cart.length === 0}
      className="btn-primary"
    >
      {paying ? 'Processing…' : `Proceed to Pay (₦${total})`}
    </button>
  );
};

export default CheckoutButton;

API Reference

startEpicCollectionPayment(options)Promise<string>

Authenticates your session with the Epic Collections backend and returns the fully-qualified portal redirect URL. This is the primary integration function for most storefronts.

| Option | Type | Required | Description | |---|---|---|---| | environment | string | ✅ | Environment (sandbox or production). | | clientId | string | ✅ | Issued from the Epic Collections Admin Portal (min 16 chars). | | clientSecret | string | ✅ | Issued from the Epic Collections Admin Portal (min 16 chars). | | redirectUrl | string | ✅ | Merchant callback URL — where the user lands after payment or cancellation. | | amount | number | ✅ | Checkout amount (e.g. 2500 for ₦2,500). | | sessionId | string | ✅ | Unique identifier for this checkout session / order (min 16 chars). | | customerDetails | EpicCollectioncustomerDetails | — | Optional customer info forwarded to the portal. |

EpicCollectioncustomerDetails

interface EpicCollectioncustomerDetails {
  name?: string;
  email?: string;
  phone?: string;
}

TypeScript Types

All types are exported from the package root:

import type {
  EpicPayEnvironment,
  StartEpicCollectionPaymentOptions,
  EpicCollectioncustomerDetails,
  EpicPayConfig,
  PaymentEvent,
  PaymentResult,
  CustomerInfo,
} from "epic-collection-gateway-sdk";

Default Export

A convenience object is available as the default export:

import EpicCollectionSdk from "epic-collection-gateway-sdk";

const { startEpicCollectionPayment } = EpicCollectionSdk;

License

MIT