Package Exports
- @gates-x402/subscriptions
- @gates-x402/subscriptions/widget/subscriptions.js
Readme
@gates-x402/subscriptions
One-package install for standalone Solana USDC subscription billing.
pnpm add @gates-x402/subscriptionsThis package includes:
- framework-neutral billing core
- storage interfaces and Prisma adapter
- Express router and middleware
- Next.js route handlers and guards
- vanilla widget asset at
@gates-x402/subscriptions/widget/subscriptions.js
It is standalone: it does not call the Gates API, import the Gates app, or depend on the Gates database package.
Basic Usage
import {
createSubscriptionBilling,
createPrismaSubscriptionStore,
} from '@gates-x402/subscriptions';
export const billing = createSubscriptionBilling({
network: 'devnet',
rpcUrl: process.env.SOLANA_RPC_URL,
treasuryWallet: process.env.SUBSCRIPTION_TREASURY_WALLET!,
store: createPrismaSubscriptionStore(prisma),
plans: [
{
id: 'pro',
name: 'Pro',
priceUsdc: 29_990_000n,
interval: 'month',
features: ['api', 'exports'],
},
],
});See docs/subscriptions in the Gates x402 repository for full setup guides.