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

@varshylinc/mobile-payments

v0.1.4

Published

Seat-aware in-app subscriptions for Capacitor apps via RevenueCat: Apple IAP + Google Play Billing, free trials, paywall UI, and read-only enforcement on lapse.

Readme

@varshylinc/mobile-payments

Seat-aware in-app subscriptions for Capacitor apps via RevenueCat: Apple IAP + Google Play Billing, free trials, paywall UI, and read-only enforcement on lapse.

npm license

Part of the Varshyl Toolkit — a set of independent, composable packages for building Capacitor + web SaaS apps.

Screenshots

In-app paywall with pricing, free trial, subscribe, and restore — ready for RevenueCat on iOS and Android.

Subscription paywall showing monthly price, 90-day free trial, and Subscribe / Restore buttons

What it does

Manages org-keyed subscription state for Capacitor mobile apps. Syncs purchase events from RevenueCat webhooks, tracks seat assignments, and exposes server-side write guards plus client paywall/gate components. When a subscription lapses, users retain read access but lose write permission — enforced on the server, not just in the UI.

Install

npm install @varshylinc/mobile-payments

Peer dependencies: pg (server), react (client).

For real StoreKit / Play Billing on device, also install @revenuecat/purchases-capacitor and use @varshylinc/mobile-payments/client/revenuecat. CI and local dev can use createMockSubscriptionService() — no RevenueCat SDK required.

Quick start

Server — migrate, create store, enforce writes, mount webhook:

import { Pool } from 'pg';
import express from 'express';
import {
  createSubscriptionStore,
  runMigrations,
  assertCanWrite,
  createRevenueCatWebhookHandler,
} from '@varshylinc/mobile-payments';

const pool = new Pool({ connectionString: process.env.DATABASE_URL });
await runMigrations(pool);

const store = createSubscriptionStore(pool, {
  product: {
    productSlug: 'myapp',
    entitlementId: 'premium',
    monthlyProductId: 'myapp_premium_monthly',
  },
  revenueCatWebhookSecret: process.env.REVENUECAT_WEBHOOK_SECRET,
});

app.post('/api/payments/webhooks/revenuecat', createRevenueCatWebhookHandler(store, config));

app.post('/api/items', async (req, res) => {
  if (!(await assertCanWrite(store, orgId, userId))) {
    return res.status(403).json({ error: 'Subscription required' });
  }
  // … create item
});

Client — configure with mock or RevenueCat service:

import {
  configureSubscriptions,
  PaywallScreen,
  FeatureGate,
  useSubscription,
  createMockSubscriptionService,
} from '@varshylinc/mobile-payments/client';

configureSubscriptions({
  config: { orgId: 'org-123', userId: 'user-456' },
  service: createMockSubscriptionService(),
  theme: { accent: '#059669' },
});

function App() {
  const { accessMode } = useSubscription();
  return (
    <FeatureGate accessMode={accessMode}>
      <CreateButton />
    </FeatureGate>
  );
}

Entry points

| Import path | Exports | |---|---| | @varshylinc/mobile-payments | createSubscriptionStore, runMigrations, assertCanWrite, getAccessModeForUser, createRevenueCatWebhookHandler, createMockSubscriptionStore, assignBuyerSeat, types | | @varshylinc/mobile-payments/client | configureSubscriptions, useSubscription, PaywallScreen, FeatureGate, ReadOnlyBanner, RestoreButton, subscriptionActions, createMockSubscriptionService, … | | @varshylinc/mobile-payments/client/revenuecat | createRevenueCatSubscriptionService — requires optional peer @revenuecat/purchases-capacitor |

Database

Bring your own Postgres. Call runMigrations(pool) on boot. Tables use the mp_ prefix (mp_subscriptions, mp_subscription_events, mp_seat_assignments).

Theming

Themeable via configureSubscriptions({ theme }). Ships a neutral default (DEFAULT_PAYMENTS_THEME).

See also

License

Apache-2.0 © Vagish Kapila / Varshyl Inc.