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

@hipaymn/miniapp-sdk

v1.0.6

Published

Hipay MiniApp SDK – A global bridge for building MiniApps in the Hipay SuperApp ecosystem.

Readme

Hipay MiniApp SDK

Typed JavaScript/TypeScript API for calling native Hipay SuperApp features from a MiniApp running inside the Hipay WebView.

The SDK communicates through window.HPSNative, which is injected by the Hipay application. Calls return promises and must be made from inside a supported Hipay MiniApp WebView.

Installation

npm install @hipaymn/miniapp-sdk

Or with Yarn:

yarn add @hipaymn/miniapp-sdk

Quick start

Use named exports:

import {pay, requestPasscode} from "@hipaymn/miniapp-sdk";

const verification = await requestPasscode();

if (verification.pass) {
    await pay("CHECKOUT_ID");
}

The same methods are available on the default export:

import hipay from "@hipaymn/miniapp-sdk";

await hipay.pay("CHECKOUT_ID");

Handler availability and compatibility

Recent versions of the Hipay bridge publish their supported handlers. The SDK automatically loads and caches this list before making a native call. If a method is unavailable, the call is rejected locally with NativeHandlerUnavailableError instead of sending an unsupported message to the native application.

import {
    getAvailableHandlers,
    isNativeHandlerAvailable,
    NativeHandlerUnavailableError,
    readUmoneyCard,
} from "@hipaymn/miniapp-sdk";

const handlers = await getAvailableHandlers();
console.log(handlers);

if (await isNativeHandlerAvailable("readUmoneyCard")) {
    const card = await readUmoneyCard();
    console.log(card.idEp);
}

try {
    await readUmoneyCard();
} catch (error) {
    if (error instanceof NativeHandlerUnavailableError) {
        console.error(`${error.handler} is not supported by this app version`);
    }
}

Call getAvailableHandlers(true) to bypass the cache and refresh the list.

Older bridge versions that do not expose HPSNative.getAvailableHandlers remain supported. In that case, the SDK sends the requested call directly and lets the native bridge handle compatibility.

Payments and transfers

pay(checkoutId)

Starts payment confirmation for a checkout ID.

import {pay} from "@hipaymn/miniapp-sdk";

await pay("123456");

topupMCSD(data)

Starts an MCSD account top-up.

import {topupMCSD} from "@hipaymn/miniapp-sdk";

await topupMCSD({
    biccode: "BANK_CODE",
    acntno: "ACCOUNT_NUMBER",
    acntname: "Account holder",
    comment: "Investment top-up",
    url: window.location.href,
    title: "My MiniApp",
    entityId: "MINI_APP_ENTITY_ID",
});

goToTopUp(data?)

Opens the transfer top-up flow. amount is optional and becomes a fixed transfer amount when provided.

import {goToTopUp} from "@hipaymn/miniapp-sdk";

await goToTopUp({
    amount: 50_000,
    isTransfer: true,
    url: window.location.href,
    title: "My MiniApp",
    entityId: "MINI_APP_ENTITY_ID",
});

Navigation

navigate(screen, params?, options?)

Navigates to a native screen. Set replace to replace the current route. Transfer-related routes may also receive amount and returnScreen.

import {navigate} from "@hipaymn/miniapp-sdk";

await navigate(
    "TargetScreen",
    {source: "miniapp"},
    {
        replace: false,
        amount: 25_000,
        returnScreen: {
            screen: "MiniWebView",
            params: {
                url: window.location.href,
                title: "My MiniApp",
                entityId: "MINI_APP_ENTITY_ID",
            },
        },
    },
);

Native route names are defined by the Hipay application. Only navigate to routes documented for MiniApps.

Other navigation methods

import {back, openMiniApp} from "@hipaymn/miniapp-sdk";

await openMiniApp("ANOTHER_MINI_APP_ENTITY_ID");
await back();

Image selection and modals

launchImageLibrary(imageType, options?)

Opens the device image library and resolves with the selected image.

import {launchImageLibrary} from "@hipaymn/miniapp-sdk";

const image = await launchImageLibrary("profile", {
    title: "Choose a photo",
    mediaType: "photo",
    maxWidth: 1024,
    maxHeight: 1024,
});

console.log(image.uri, image.imageType);

pickImage and imageLibrary are aliases of launchImageLibrary.

openCitizenIdImagePicker(imageType, options?)

Opens the configured citizen-ID gallery picker.

import {openCitizenIdImagePicker} from "@hipaymn/miniapp-sdk";

const image = await openCitizenIdImagePicker("citizenIdFront");
console.log(image.uri);

For other native modals, use the generic API:

import {openModal} from "@hipaymn/miniapp-sdk";

const result = await openModal<MyModalResult>("MY_MODAL", {
    example: true,
});

The modal type must be registered by the native bridge.

Profile settings

changeEmail and changeAddress open their corresponding native settings flows. Return information allows the application to reopen the MiniApp afterward.

import {changeAddress, changeEmail} from "@hipaymn/miniapp-sdk";

const returnToMiniApp = {
    url: window.location.href,
    title: "My MiniApp",
    entityId: "MINI_APP_ENTITY_ID",
};

await changeEmail(returnToMiniApp);
// Or:
await changeAddress(returnToMiniApp);

Passcode verification

import {requestPasscode} from "@hipaymn/miniapp-sdk";

const result = await requestPasscode({biometric: false});

if (result.pass) {
    // Continue with the protected action.
}

The call rejects when a passcode is not configured or native verification fails.

UMoney NFC card

import {readUmoneyCard} from "@hipaymn/miniapp-sdk";

const card = await readUmoneyCard();

console.log({
    cardType: card.cardType,
    cardId: card.idEp,
    issuedAt: card.diss,
    expiresAt: card.dexp,
});

The user must run this method on an NFC-capable device with NFC enabled.

Low-level API

Use callNative for a native handler that does not yet have a high-level SDK wrapper. Known SDK handlers are fully typed.

import {callNative} from "@hipaymn/miniapp-sdk";

const result = await callNative<{value: string}>(
    "customHandler",
    {input: "example"},
    30_000,
);

Arguments are callNative(type, data?, timeout?). The bridge's default timeout is 60 seconds.

Error handling

All SDK operations return promises. Handle errors around native calls, including cancellation, timeout, an unavailable bridge, and unsupported handlers.

import {NativeHandlerUnavailableError, pay} from "@hipaymn/miniapp-sdk";

try {
    await pay("CHECKOUT_ID");
} catch (error) {
    if (error instanceof NativeHandlerUnavailableError) {
        console.error("Please update the Hipay application");
    } else {
        console.error("Native operation failed", error);
    }
}

HPSNative bridge not found means the page is not running inside a compatible Hipay WebView or the bridge has not been injected yet.

Development

yarn install
yarn build

The build produces ESM, CommonJS, and TypeScript declaration files in dist.

License

MIT