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

@digipay-sdk/inline-js

v0.0.1

Published

DigiPay JavaScript SDK for Pi Network payments

Downloads

6

Readme

@digipay-sdk/inline-js

Official JavaScript SDK for DigiPay - Accept Pi Network payments in your application.

Installation

npm install @digipay-sdk/inline-js

or

yarn add @digipay-sdk/inline-js

or

pnpm add @digipay-sdk/inline-js

Prerequisites

Make sure to include the Pi Network SDK in your HTML:

<script src="https://sdk.minepi.com/pi-sdk.js"></script>
<script>
  Pi.init({ version: "2.0", sandbox: true }); // Use sandbox: false in production
</script>

Usage

Basic Example

import { DigiPay } from '@digipay-sdk/inline-js';

const digiPay = new DigiPay({
  publicKey: 'pk_live_xxxxxxxxx',
  description: 'Premium Package Subscription',
  amount: '49.99',
  currency: 'PI',
  metadata: {
    orderId: '1234567890',
    userId: 'user_abc123'
  },
  customer: {
    email: '[email protected]',
    name: 'John Doe'
  },
  onSuccess: (transaction) => {
    console.log('Payment successful!', transaction);
  },
  onCancel: () => {
    console.log('Payment cancelled');
  },
  onError: (error) => {
    console.error('Payment failed:', error);
  }
});

digiPay.open();

React Example

import { DigiPay } from '@digipay-sdk/inline-js';

function PaymentButton() {
  const handlePayment = () => {
    const digiPay = new DigiPay({
      publicKey: process.env.NEXT_PUBLIC_DIGIPAY_PUBLIC_KEY,
      amount: '49.99',
      description: 'Premium Package',
      customer: {
        email: '[email protected]',
        name: 'John Doe'
      },
      metadata: {
        orderId: 'xxxxxxxx'
      },
      onSuccess: (transaction) => {
        alert('Payment successful! Ref: ' + transaction.transactionref);
      },
      onError: (error) => {
        alert('Payment failed: ' + error);
      }
    });

    digiPay.open();
  };

  return (
    <button onClick={handlePayment}>
      Pay with Pi
    </button>
  );
}

Next.js Example

'use client';

import { useState } from 'react';
import Script from 'next/script';
import { DigiPay } from '@digipay-sdk/inline-js';

export default function CheckoutPage() {
  const [piLoaded, setPiLoaded] = useState(false);

  const handlePayment = () => {
    const digiPay = new DigiPay({
      publicKey: process.env.NEXT_PUBLIC_DIGIPAY_PUBLIC_KEY!,
      amount: '49.99',
      description: 'Premium Package',
      customer: {
        email: '[email protected]',
        name: 'John Doe'
      },
      onSuccess: (transaction) => {
        console.log('Payment successful!', transaction);
      }
    });

    digiPay.open();
  };

  return (
    <>
      <Script
        src="https://sdk.minepi.com/pi-sdk.js"
        onLoad={() => {
          if (window.Pi) {
            window.Pi.init({ version: '2.0', sandbox: true });
            setPiLoaded(true);
          }
        }}
      />

      <button onClick={handlePayment} disabled={!piLoaded}>
        Pay with Pi
      </button>
    </>
  );
}

API Reference

Configuration Options

interface DigiPayConfig {
  publicKey: string;            // Your DigiPay public key (required)
  description?: string;         // Payment description
  amount: string;               // Payment amount
  currency?: string;            // Currency code (default: 'PI')
  currencies?: string[];        // Available currencies (default: ['PI', 'USD', 'EUR', 'GBP'])
  metadata?: Record<string, any>; // Custom metadata
  customer?: {
    email?: string;
    name?: string;
  };
  onSuccess?: (transaction: any) => void;
  onCancel?: () => void;
  onError?: (error: string) => void;
}

Methods

open(): Promise<void>

Opens the payment modal and handles the entire payment flow:

  • Fetches merchant metadata and validates the public key
  • Displays payment modal with order summary and currency selector
  • Shows "Login with Pi" button for user authentication (optional)
  • Allows user to enter wallet address or use authenticated Pi UID
  • Creates payment intent when user proceeds
  • Initiates Pi payment flow when user confirms

Note: Authentication with Pi Network happens when the user clicks the "Login with Pi" button in the modal, not automatically on open.

close(): void

Closes the payment modal and resets the state.

Environment Variables

For Next.js/React apps, add to your .env.local:

NEXT_PUBLIC_DIGIPAY_PUBLIC_KEY=pk_live_xxxxxxxxx

Testing

Use sandbox mode for testing:

Pi.init({ version: "2.0", sandbox: true });

Support

  • Documentation: https://docs.digipay.com
  • Issues: https://github.com/digipay-sdk/inline-js/issues
  • Email: [email protected]

License

MIT