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

@finteqhub/sdk-js

v0.17.0

Published

SDK for interacting with the processing API

Readme

processing-sdk

Use new Processing(options: ProcessingOptions) to create an instance of the Processing object. The Processing object is your entrypoint to the processing SDK.

interface ProcessingOptions {
  apiUrl: string;
  fingerprintVisitorId: string;
  sessionId: string;
  isSecure?: boolean; // default false
  retryOptions?: RetryOptions; // default {}
}

const processing = new Processing({
  apiUrl: 'api-url',
  fingerprintVisitorId: 'fingerprint-visitor-id',
  sessionId: 'session-id',
});

The constructor validates its options and throws a TypeError when they are not an object, when they contain an unknown key (for example a misspelled issecure), when apiUrl, fingerprintVisitorId or sessionId is missing, empty or not a string, when isSecure is not a boolean, or when retryOptions is malformed (see Retries and error diagnostics).

Retries and error diagnostics

Failed HTTP requests are retried automatically with exponential backoff (100ms → 200ms → 500ms → 1000ms → 2000ms; every retry after the fifth waits 2000ms). Retries can be configured via the optional retryOptions constructor option:

interface RetryOptions {
  retryCount?: number; // number of retries after the initial attempt, default 5; 0 disables retries
  retryStatusCode?: (statusCode: number) => boolean; // default: statusCode < 200 || statusCode === 408 || statusCode >= 500
}

const processing = new Processing({
  apiUrl: 'api-url',
  fingerprintVisitorId: 'fingerprint-visitor-id',
  sessionId: 'session-id',
  retryOptions: { retryCount: 3 },
});

To disable retries entirely, pass retryCount: 0 — every request is then sent exactly once, as in 0.11.0. Error diagnostics (RequestError, the console.error dump) are still collected:

const processing = new Processing({
  apiUrl: 'api-url',
  fingerprintVisitorId: 'fingerprint-visitor-id',
  sessionId: 'session-id',
  retryOptions: { retryCount: 0 },
});

The constructor throws a TypeError when retryOptions is not an object, retryCount is not a non-negative integer, or retryStatusCode is not a function.

Network errors (the browser could not reach the server at all, e.g. TypeError: Failed to fetch, or the connection dropped while the response body was being read) are always retried too.

Every retry attempt is reported with console.warn. When a request finally fails, the SDK logs console.error (sdk-js: request failed: <message>) with a full diagnostic dump and rejects with a RequestError whose diagnostics field carries the same payload — include it in your error reporting. diagnostics.kind tells the failure class apart:

  • "network" — the browser never got a complete response (e.g. TypeError: Failed to fetch, or the body could not be read); diagnostics.error describes the thrown error, diagnostics.response.status is present when headers had arrived before the failure, message is request to <url> failed after N attempt(s): ...;
  • "http_error" — an error response (non-200 status, or an error field in the body); message is the error text from the response body (or unexpected response status <code> when the body has none), diagnostics.response.status carries the HTTP status and diagnostics.response.error the error text from the body;
  • "invalid_json" — the response body is not valid JSON; both diagnostics.error (the parse error; its message follows the same policy as the body — sanitized for non-200, omitted for 200 responses) and diagnostics.response are set.

Every diagnostics payload also includes:

  • sdkVersion;
  • request: url, method, x-request-id, session id, and per-attempt log attempts: [{ durationMs, status?, error? }] — attempt durations help tell an instant failure (DNS/connection refused) from a hang (timeout/handshake);
  • response.body for non-200 responses — truncated to 500 chars with long digit runs masked (***); the body of a 200 response is never included since it may carry session credentials; the request body is never included anywhere;
  • response.error — the error field of the response body, for any status (including a 200 response with an error field); it is a business error text, so it is neither truncated nor masked;
  • environment: navigator.onLine, document.visibilityState, navigator.connection (effectiveType/rtt/downlink, Chromium only), timestamp.

Diagnostics are collected regardless of whether retries are enabled.

SDK identification header

Every request the SDK makes carries an extra header:

x-pgw-sdk: sdk-js/<version>

The value contains the SDK name and version (kept in sync with package.json by a test) — for example sdk-js/0.11.0. The backend uses this header to identify traffic coming from the official SDK integration — for example to notify affected merchants when a security fix is released. It does not affect authentication or request routing.

The header is added automatically to every request and cannot be disabled.

API

processing.getSession()

Use processing.getSession to get session information (payment methods, credential fields, operation amount and currency, init credentials) for rendering the form. It is optional: submitForm does not depend on it and can be called right after constructing the instance.

processing
  .getSession()
  .then(result => console.log(result))
  .catch(error => console.warn(error));

processing.submitForm(data)

Use processing.submitForm to submit transaction. When called, processing.submitForm will attempt to complete any required actions to process the transaction. This method returns promise which resolves with response ({ "type": "redirect", "redirectUrl": string}) or error that describes the failure.

processing
  .submitForm(data)
  .then(result => console.log(result))
  .catch(error => console.warn(error));

Usage

Submit only

The minimal flow is to construct the instance and call submitForm — no other request is needed before it. Use it when your own UI already knows what to collect from the customer (for example, the payment method and its credential fields are fixed on your side):

import { Processing } from "@finteqhub/sdk-js";
import FingerprintJS from "@fingerprintjs/fingerprintjs";

const fp = await FingerprintJS.load();
const result = await fp.get();

const processing = new Processing({ apiUrl, fingerprintVisitorId: result.visitorId, sessionId });

const data = {/** collect data from form **/}

processing
  .submitForm(data)
  .then(result => console.log(result))
  .catch(error => console.warn(error));

Render the form from session data

Call getSession first when the form itself is built from the session: available payment methods, their credential fields, the operation amount and currency. submitForm does not use the result — it only drives your UI:

const processing = new Processing({ apiUrl, fingerprintVisitorId: result.visitorId, sessionId });

const session = await processing.getSession();

const data = {/** collect data from form rendered from session **/}

processing
  .submitForm(data)
  .then(result => console.log(result))
  .catch(error => console.warn(error));

Releasing

On every version bump update both package.json version and SDK_VERSION in src/version.ts — they must stay in sync so the x-pgw-sdk header reports the right version. src/version.test.ts fails CI if they drift (node scripts/sync-version.js updates src/version.ts from package.json). Describe the release in CHANGELOG.md, including migration notes for breaking changes.

Beta releases

To try changes before bumping the version, run the publish-beta workflow (GitHub → Actions → publish-beta → Run workflow, pick your branch). It publishes <current version>-beta.<run number> to npm under the beta dist-tag — latest and the version in the repo stay untouched. Install it with:

npm i @finteqhub/sdk-js@beta

or pin the exact version printed in the workflow summary.