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

@pisell/pi-payment-sdk

v0.0.3

Published

Pisell headless payment SDK

Readme

@pisell/pi-payment-sdk

Standalone PiPayment Headless SDK. The package does not import React, CSS, Pisell materials, Engine Context, or appHelper.

Initialization

import { PiPaymentSDK } from '@pisell/pi-payment-sdk';

const sdk = new PiPaymentSDK({
  environment: 'prod',
  serverRegion: 'cn',
  // Called for every request and sent as-is in Authorization.
  getToken: () => tokenManager.getValidToken(),
});

For prod and beta, serverRegion selects the regional API origin and accepts au, cn, us, or ap. It defaults to au when omitted. The dev environment keeps its development origin and ignores serverRegion. A custom baseURL takes precedence over both environment and region. A Provider registry and diagnostic logger port can also be supplied. Logger failures are isolated from payment state. Requests use a 60-second timeout and support AbortSignal.

Create one SDK per application/login lifecycle, then create an isolated Session for each payment:

const session = sdk.createSession({
  paymentMethod: 'eftpos',
  paymentProvider: 'mx51',
  salesId: 'sale-1',
  onChange(event) {
    // Render or adapt the neutral event in the host UI.
  },
});

PaymentMethod separates the existing routes:

  • eftpos: terminal providers such as MX51, Tyro, and Adyen POS.
  • ecom: the existing Adyen Alipay/WeChat Scan protocol.
  • online: online providers; Alipay H5 currently uses the lightweight payAsync API, while Apple Pay, Google Pay, and credit-card 3DS remain future integrations.

Alipay H5 payment link

Alipay H5 does not create a Session. payAsync creates the backend payment attempt and returns the payment number plus a host-owned redirect action:

const handoff = await sdk.payAsync({
  paymentProvider: 'alipay',
  orderId: 103372,
  paymentGroupId: 4678,
  amount: 0.01,
  returnUrl: 'https://pos.example/payment-finish',
});

// Persist handoff.paymentNumber before navigating. This is not payment success.
window.location.assign(handoff.nextAction.url);

The SDK does not navigate, observe the browser return, or confirm the final payment result. The host's return page and backend payment callback are the source of truth after the user leaves for Alipay.

Host boundary

This package does not implement Pisell printing task dispatch, durable Recovery tasks, native scanner bridges, log persistence, deviceTask, interaction, or appHelper. Those capabilities and all UI belong in the host, such as @pisell/private-materials.

currency is caller-owned data. SCI pay/refund requests do not send it, and the package does not infer, convert, or validate symbols versus ISO codes.