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

@mongolian-payment/storepay

v1.0.0

Published

StorePay payment SDK for Node.js - Create loans, check loan status, query user possible amounts

Readme

@mongolian-payment/storepay

TypeScript SDK for the StorePay payment provider. Zero dependencies, dual ESM/CJS builds, automatic OAuth2 token management.

Installation

npm install @mongolian-payment/storepay

Requires Node.js >= 18.0.0 (uses native fetch and btoa).

Quick Start

import { StorePayClient } from "@mongolian-payment/storepay";

const client = new StorePayClient({
  appUsername: "your-app-username",
  appPassword: "your-app-password",
  username: "your-basic-auth-username",
  password: "your-basic-auth-password",
  authUrl: "https://auth.storepay.mn",
  baseUrl: "https://api.storepay.mn",
  storeId: "your-store-id",
  callbackUrl: "https://your-site.com/callback",
});

// Create a loan
const loanId = await client.loan({
  description: "Order #1234",
  mobileNumber: "99001122",
  amount: 50000,
});

// Check loan status
const confirmed = await client.loanCheck(String(loanId));

// Get user's possible loan amount
const possibleAmount = await client.userPossibleAmount("99001122");

// Clear cached tokens when done
client.close();

Configuration from Environment

import { StorePayClient, loadConfigFromEnv } from "@mongolian-payment/storepay";

const client = new StorePayClient(loadConfigFromEnv());

Required environment variables:

| Variable | Description | |---|---| | STOREPAY_APP_USERNAME | OAuth app username | | STOREPAY_APP_PASSWORD | OAuth app password | | STOREPAY_USERNAME | Basic Auth username | | STOREPAY_PASSWORD | Basic Auth password | | STOREPAY_AUTH_URL | Auth server URL | | STOREPAY_BASE_URL | API base URL | | STOREPAY_STORE_ID | Merchant store ID | | STOREPAY_CALLBACK_URL | Callback URL for notifications |

API Reference

new StorePayClient(config)

Creates a new StorePay client. Authentication is handled automatically on the first API call.

client.loan(input): Promise<number>

Create a loan request. Returns the loan ID.

  • input.description - Description of the loan
  • input.mobileNumber - Customer mobile number
  • input.amount - Loan amount (number)

client.loanCheck(id): Promise<boolean>

Check the status of a loan. Returns true if confirmed.

  • id - The loan ID (string)

client.userPossibleAmount(mobileNumber): Promise<number>

Get the maximum possible loan amount for a user.

  • mobileNumber - The user's mobile number

client.close(): void

Clear cached authentication tokens. Call this when the client is no longer needed.

Error Handling

All API errors are thrown as StorePayError instances:

import { StorePayClient, StorePayError } from "@mongolian-payment/storepay";

try {
  const loanId = await client.loan({ ... });
} catch (err) {
  if (err instanceof StorePayError) {
    console.error(err.message);     // Human-readable message
    console.error(err.statusCode);  // HTTP status code (if available)
    console.error(err.response);    // Raw API response (if available)
  }
}

License

MIT