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

@payconnect.me/kyc-core

v0.6.3

Published

Framework-agnostic KYC core: Partners API client, DTOs, zod schemas, field mappers, error maps, flow model, host event protocol. No React/React Native — shared by the RN SDK (and portable back to web).

Readme

@payconnect.me/kyc-core

The parts of the PayConnect KYC integration that have nothing to do with the user interface: the Partners API client, the request and response types, validation rules, and the country data.

There is no React or React Native code in this package.

Do you need this?

| You are | Install | | --- | --- | | Building a React Native app with the KYC flow in it | @payconnect.me/kyc-react-native. This package comes with it — you do not install it separately. | | Building the backend that starts KYC sessions | This package. Keep reading. | | Building a client that is not React Native | This package. |

Most people reading this are here for one function: createKycSession.

Install

npm install @payconnect.me/kyc-core

Node 20.19 or newer. This package is ESM-only, so import works directly. If your backend is CommonJS you can still require('@payconnect.me/kyc-core') — Node supports requiring an ESM package from that version onwards. You do not need a bundler; the example below runs under plain node.

Mint a session code

Your app cannot start a KYC session on its own. Your backend does it, using your secret API key, and hands the app only the resulting code.

// On YOUR backend. Never in the app.
import express from 'express';
import { createKycSession } from '@payconnect.me/kyc-core';

const app = express();
app.use(express.json());

app.post('/kyc-session', async (req, res) => {
  try {
    const code = await createKycSession({
      baseUrl: 'https://partners-api.payconnect.me',
      apiKey: process.env.PARTNERS_API_KEY, // secret — server environment only
      productId: req.body.productId, // the KYC product you are starting
    });
    res.json({ code }); // hand ONLY the code to the app
  } catch (error) {
    res.status(502).json({ error: String(error) });
  }
});

app.listen(3000);

Your app fetches { code } from that endpoint and passes it to <PayConnectKyc sessionCode={code} />.

Options

| Option | Type | Required | What it is | | --- | --- | --- | --- | | baseUrl | string | Yes | The PayConnect Partners API: https://partners-api.payconnect.me. | | apiKey | string | Yes | Your partner API key. A secret. | | productId | string | Yes | The UUID of the KYC product to start. PayConnect gives you this. | | fetch | typeof fetch | No | Your own fetch, if you need one. Defaults to the global. |

It returns the session code as a string, or throws a KycApiError carrying status and errorCode.

Keep the key on the server

Three rules, and they are not negotiable:

  1. The X-API-Key never ships in an app. A mobile app can be unpacked, and a key inside one cannot be rotated without a new release.
  2. The app only ever gets the session code. It is short-lived and scoped to one applicant.
  3. The webhook is the verdict. The SDK's completed event means the applicant reached the end of the flow, not that they passed. Verify the x-pc-signature HMAC on PayConnect's webhook with your webhook secret — also a backend secret — and use that.

createKycSession is deliberately not re-exported by @payconnect.me/kyc-react-native, so it cannot reach app code by accident.

What else is in here

You will not need most of this unless you are writing your own client. Everything is fully typed.

| Export | What it is | | --- | --- | | KycClient | The Partners API client. Takes { baseUrl, sessionCode } — plus optional token, surfaceId and fetch — and covers assessments, questions, identity, additional documents and submission. | | KycApiError | The only error class in the package. Carries status, errorCode and kind. | | classifyIdentityError | Turns a Partners API error code into the category the UI should react to. | | passportVerifySchema, thaiIdVerifySchema, kycAddressSchema | Zod schemas for the identity and address forms — document number formats, the minimum age (MIN_AGE_YEARS), and the Thai postcode and district rules. | | countries, countryByIso3, countryLabel, countryFlagEmoji, suggestedCountries | The 249-country dataset used by the nationality pickers. | | normalizeNationality | Canonicalise an ISO-3 nationality code, or null if it names no country in the dataset. | | safeReturnTo, appendKycStatus | Validate a return URL and add the session and status query values to it. | | surfaceIdFor | Derive a stable device identifier from a session code, for handing a session between devices. | | normalizeNfcAvailability, chipErrorCodeForVendorFailure | Working out whether a chip read is possible, and what a failed one means. | | Route helpers and the flow model | The URL templates and step arithmetic every PayConnect KYC client shares. |

The wire values these are built on — enums, route templates, the error-code map, the reference datasets — come from @payconnect.me/kyc-contract, which this package depends on.

Support