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

@paybridge-np/mobile-sdk

v0.1.1

Published

Official React Native SDK for PayBridgeNP — accept eSewa and Khalti payments natively in your mobile app

Readme

@paybridge-np/mobile-sdk

Official React Native SDK for PayBridgeNP — accept eSewa and Khalti payments natively in your mobile app.

Requirements

  • React Native >= 0.73 (or Expo SDK >= 50)
  • react-native-webview >= 13
  • react-native-safe-area-context >= 4

Installation

npm install @paybridge-np/mobile-sdk react-native-webview react-native-safe-area-context
# Expo
npx expo install @paybridge-np/mobile-sdk react-native-webview react-native-safe-area-context

Expo Go compatible - no custom dev build or config plugin required.


How it works

Your backend creates a checkout session using your secret API key. The session is passed to the mobile SDK - your API key never touches the device.

Your backend  →  POST /v1/mobile/session (API key)  →  { session_id, native_params, ... }
Mobile app    →  ProviderSheet / usePayBridge        →  onSuccess(result)

Backend: create a session

Call POST /v1/mobile/session from your server with your PayBridge API key:

curl -X POST https://api.paybridgenp.com/v1/mobile/session \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "amount": 5000,
    "provider": "khalti",
    "currency": "NPR",
    "customer": { "name": "Ram Bahadur", "phone": "98XXXXXXXX" }
  }'

Response:

{
  "session_id": "cs_XXXX",
  "expires_at": "2026-04-14T12:00:00Z",
  "provider": "khalti",
  "amount": 5000,
  "native_params": { ... }
}
  • amount is in paisa (1 NPR = 100 paisa)
  • provider must be "esewa" or "khalti"
  • Sessions expire in 15 minutes
  • Use sk_test_... keys for sandbox, sk_live_... for production

Usage

Option A - usePayBridge hook (recommended)

Lazy mode: show both providers, create the session only after the user picks one.

import { usePayBridge, ProviderSheet } from "@paybridge-np/mobile-sdk";

export default function CheckoutScreen() {
  const { present, sheetProps } = usePayBridge({
    createSession: async (provider) => {
      const res = await fetch("https://your-backend.com/api/mobile-session", {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify({ provider, amount: 5000 }),
      });
      return res.json();
    },
    amount: 5000, // paisa - shown in the sheet before session is created
    onSuccess: (result) => console.log("paid", result.payment_id),
    onFailure: (result) => console.log("failed", result.error),
    onCancel: () => console.log("cancelled"),
  });

  return (
    <>
      <Button title="Pay NPR 50" onPress={present} />
      <ProviderSheet {...sheetProps} />
    </>
  );
}

Option B - pre-built session

Use this when your backend picks the provider before showing the sheet.

import { useState, useEffect } from "react";
import { usePayBridge, ProviderSheet } from "@paybridge-np/mobile-sdk";
import type { MobileSession } from "@paybridge-np/mobile-sdk";

export default function CheckoutScreen() {
  const [session, setSession] = useState<MobileSession | null>(null);

  useEffect(() => {
    fetch("https://your-backend.com/api/mobile-session", {
      method: "POST",
      headers: { "Content-Type": "application/json" },
      body: JSON.stringify({ provider: "khalti", amount: 5000 }),
    })
      .then((r) => r.json())
      .then(setSession);
  }, []);

  const { present, sheetProps } = usePayBridge({
    session,
    onSuccess: (result) => console.log("paid", result.payment_id),
    onFailure: (result) => console.log("failed", result.error),
    onCancel: () => console.log("cancelled"),
  });

  return (
    <>
      <Button title="Pay" onPress={present} disabled={!session} />
      <ProviderSheet {...sheetProps} />
    </>
  );
}

Option C - ProviderSheet directly

import { ProviderSheet } from "@paybridge-np/mobile-sdk";

<ProviderSheet
  visible={sheetVisible}
  createSession={handleCreateSession}
  amount={5000}
  onSuccess={handleSuccess}
  onFailure={handleFailure}
  onCancel={handleCancel}
/>

API reference

usePayBridge(options)

| Option | Type | Description | |---|---|---| | session | MobileSession \| null | Pre-built session from your backend | | createSession | (provider) => Promise<MobileSession> | Lazy factory - called when user picks a provider | | amount | number | Amount in paisa - shown before session is created (lazy mode) | | config | PayBridgeMobileConfig | Optional config (see below) | | onSuccess | (result: CheckoutResult) => void | Called on successful payment | | onFailure | (result: CheckoutResult) => void | Called on failed payment | | onCancel | () => void | Called when user cancels |

Returns { present, dismiss, isVisible, sheetProps }.

ProviderSheet props

Same options as usePayBridge, plus visible: boolean.

PayBridgeMobileConfig

| Field | Default | Description | |---|---|---| | baseUrl | https://api.paybridgenp.com | PayBridge API base URL | | timeout | 30000 | Request timeout in ms |

CheckoutResult

type CheckoutResult = {
  status: "success" | "failed" | "cancelled";
  payment_id?: string;
  amount?: number;        // paisa
  provider?: "esewa" | "khalti";
  provider_ref?: string;
  error?: string;
};

Sandbox testing

Use sk_test_... keys on your backend.

eSewa sandbox test credentials

  • eSewa ID: 9806800001 (or 02/03/04/05)
  • Password: Nepal@123
  • Token: 123456

Khalti sandbox - handled automatically via your sk_test_... PayBridge key.


License

MIT