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

@paygate/expo

v0.1.0

Published

PayGate Expo SDK - Accept Mobile Money payments in Ghana (WebView + expo-web-browser)

Readme

@paygate/expo

Official PayGate Expo SDK for accepting Mobile Money payments in Ghana.

Features

  • WebView Mode: Embedded checkout in a modal (default)
  • Browser Mode: Open checkout in system browser (optional, using expo-web-browser)
  • Deep Linking: Return to app after browser checkout

Installation

npx expo install @paygate/expo react-native-webview

# Optional: For browser mode
npx expo install expo-web-browser expo-linking

Quick Start

1. Wrap your app with PayGateProvider

import { PayGateProvider, PayGateAutoModal } from '@paygate/expo';

export default function App() {
  return (
    <PayGateProvider
      publicKey="pk_test_your_public_key"
      baseUrl="https://paygate.com"
      urlScheme="myapp" // For browser mode deep linking
    >
      <NavigationContainer>
        <AppNavigator />
      </NavigationContainer>
      <PayGateAutoModal />
    </PayGateProvider>
  );
}

2. Configure deep linking (for browser mode)

In your app.json:

{
  "expo": {
    "scheme": "myapp"
  }
}

3. Create a checkout session on your server

// Server-side
import PayGate from 'paygate';

const paygate = new PayGate('sk_test_your_secret_key');

const session = await paygate.checkoutSessions.create({
  amount: 100.00,
  currency: 'GHS',
  success_url: 'https://yoursite.com/success',
  cancel_url: 'https://yoursite.com/cancel',
});

// Return session.id to your app

4. Trigger payments

import { usePayGate } from '@paygate/expo';
import { Button, Alert, View } from 'react-native';

function CheckoutScreen() {
  const { checkout, openCheckoutInBrowser, browserAvailable, isVisible } = usePayGate();

  const handlePayWithWebView = async () => {
    const { sessionId } = await api.createCheckoutSession();

    checkout({
      sessionId,
      onSuccess: (data) => {
        console.log('Payment successful!', data);
        Alert.alert('Success', 'Payment completed!');
      },
      onCancel: () => {
        console.log('Payment cancelled');
      },
      onError: (error) => {
        Alert.alert('Error', error.message);
      },
    });
  };

  const handlePayWithBrowser = async () => {
    const { sessionId } = await api.createCheckoutSession();

    await openCheckoutInBrowser({
      sessionId,
      onSuccess: (data) => {
        Alert.alert('Success', 'Payment completed!');
      },
      onCancel: () => {
        console.log('Cancelled');
      },
    });
  };

  return (
    <View>
      <Button
        title="Pay with WebView"
        onPress={handlePayWithWebView}
        disabled={isVisible}
      />
      {browserAvailable && (
        <Button
          title="Pay with Browser"
          onPress={handlePayWithBrowser}
        />
      )}
    </View>
  );
}

Components

PayGateProvider

<PayGateProvider
  publicKey="pk_test_xxx"      // Required
  baseUrl="https://paygate.com" // Optional
  urlScheme="myapp"             // Required for browser mode
  defaultMode="webview"         // 'webview' | 'browser'
>
  {children}
</PayGateProvider>

PayGateAutoModal

Auto-managed modal that responds to checkout() and payWithLink() calls.

<PayGateAutoModal />

PayGateModal

Manually controlled modal.

<PayGateModal
  visible={visible}
  sessionId="cs_xxx"
  onSuccess={(data) => {}}
  onCancel={() => {}}
  onClose={() => setVisible(false)}
/>

PayGate

Low-level WebView component.

<PayGate
  sessionId="cs_xxx"
  onSuccess={(data) => {}}
  onCancel={() => {}}
  onError={(error) => {}}
  style={{ flex: 1 }}
/>

Hooks

usePayGate

const {
  // WebView mode
  checkout,                  // (params) => void
  payWithLink,               // (params) => void

  // Browser mode
  openCheckoutInBrowser,     // (params) => Promise<void>
  openPaymentLinkInBrowser,  // (params) => Promise<void>

  // State
  close,                     // () => void
  isVisible,                 // boolean
  mode,                      // 'webview' | 'browser'
  setMode,                   // (mode) => void
  browserAvailable,          // boolean
  publicKey,                 // string
  baseUrl,                   // string
} = usePayGate();

Payment Links

const { payWithLink, openPaymentLinkInBrowser } = usePayGate();

// WebView mode
payWithLink({
  linkId: 'pl_xxx',
  amount: 50.00,  // For dynamic amount
  email: '[email protected]',
  onSuccess: (data) => console.log('Paid!', data),
});

// Browser mode
await openPaymentLinkInBrowser({
  linkId: 'pl_xxx',
  amount: 50.00,
  onSuccess: (data) => console.log('Paid!', data),
});

WebView vs Browser Mode

| Feature | WebView Mode | Browser Mode | |---------|-------------|--------------| | User Experience | In-app modal | System browser | | Setup | Simpler | Requires deep linking | | Dependencies | react-native-webview | + expo-web-browser, expo-linking | | Best for | Most apps | Apps needing browser features |

TypeScript

import type {
  PayGateConfig,
  CheckoutParams,
  PaymentLinkParams,
  PaymentResult,
  PayGateError,
  PaymentMode,
} from '@paygate/expo';

Test Mode

Use test keys (pk_test_xxx) during development to simulate payments without processing real transactions.

Troubleshooting

WebView not loading

npx expo install react-native-webview

Browser mode not working

  1. Install dependencies:
npx expo install expo-web-browser expo-linking
  1. Configure URL scheme in app.json:
{
  "expo": {
    "scheme": "myapp"
  }
}
  1. Pass urlScheme to provider:
<PayGateProvider publicKey="..." urlScheme="myapp">

Deep link not returning to app

Make sure your URL scheme matches in:

  • app.jsonexpo.scheme
  • PayGateProviderurlScheme prop

License

MIT