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

@synko-lab/paymints-react

v0.2.0

Published

React Provider and hooks for Paymints SDK

Readme

@synko-lab/paymints-react

React Provider and hooks for the Paymints SDK. Wraps @synko-lab/paymints with idiomatic React patterns.

Installation

pnpm add @synko-lab/paymints @synko-lab/paymints-react

Peer dependency: @synko-lab/paymints must be installed alongside this package.

Quick Start

1. Wrap your app with the Provider

import { PaymintsProvider } from "@synko-lab/paymints-react";

function App() {
  return (
    <PaymintsProvider apiKey="pmts.your_public_key">
      <YourApp />
    </PaymintsProvider>
  );
}

You can optionally pass baseUrl and edgeUrl to override the default endpoints:

<PaymintsProvider
  apiKey="pmts.your_public_key"
  baseUrl="https://custom-api.example.com"
  edgeUrl="https://custom-edge.example.com"
>

2. Check subscription status

import { useSubscription } from "@synko-lab/paymints-react";

function SubscriptionBanner({ userId }: { userId: string }) {
  const { data, isLoading, error, refetch } = useSubscription(userId);

  if (isLoading) return <p>Loading...</p>;
  if (error) return <p>Error: {error.message}</p>;

  if (data?.hasActiveSubscription) {
    return (
      <div>
        <p>Plan: {data.subscription?.planName}</p>
        <p>Status: {data.subscription?.status}</p>
      </div>
    );
  }

  return <p>No active subscription.</p>;
}

3. Launch checkout

import { useCheckout } from "@synko-lab/paymints-react";

function UpgradeButton({ userId }: { userId: string }) {
  const { checkout, isLoading, error } = useCheckout();

  const handleClick = async () => {
    await checkout({
      customerReference: userId,
      customerEmail: "[email protected]",
      priceId: "price_xxxxx", // optional
      successUrl: "https://myapp.com/success",
      cancelUrl: "https://myapp.com/cancel",
    });
  };

  return (
    <button onClick={handleClick} disabled={isLoading}>
      {isLoading ? "Redirecting..." : "Upgrade"}
    </button>
  );
}

4. Access the client directly

import { usePaymints } from "@synko-lab/paymints-react";

function CustomComponent() {
  const client = usePaymints();
  // client.http and client.edgeHttp available for custom requests
}

API Reference

<PaymintsProvider>

| Prop | Type | Required | Description | |------|------|----------|-------------| | apiKey | string | Yes | Your public API key (starts with pmts.) | | baseUrl | string | No | Override core API URL | | edgeUrl | string | No | Override edge gateway URL | | children | ReactNode | Yes | Child components |

useSubscription(customerReference)

Fetches subscription status on mount and when customerReference changes.

Parameters:

  • customerReference (string | undefined) — Customer identifier. Skips fetch if undefined.

Returns: | Field | Type | Description | |-------|------|-------------| | data | SubscriptionCheckResponse \| null | Subscription data | | isLoading | boolean | Loading state | | error | Error \| null | Error if request failed | | refetch | () => void | Manually re-fetch |

useCheckout()

Returns a function to launch a checkout session.

Returns: | Field | Type | Description | |-------|------|-------------| | checkout | (params: CreateCheckoutParams) => Promise<void> | Launches checkout and redirects | | isLoading | boolean | Loading state | | error | Error \| null | Error if request failed |

usePaymints()

Returns the underlying PaymintsClient instance for custom usage.

License

MIT