PayKitv0.1 beta

Payment Providers

How PayKit abstracts provider integration and keeps provider-native IDs internal.

PayKit uses a provider abstraction to communicate with payment processors. Your app works with plans, customers, and subscriptions. PayKit translates those into provider-native operations behind the scenes.

How it works

You install a provider adapter package and pass it to createPayKit({ provider }). The adapter handles all provider-specific API calls, webhook normalization, and product syncing. Your app code doesn't change if you swap providers.

paykit.ts
import { stripe } from "@paykitjs/stripe";

export const paykit = createPayKit({
  // ...
  provider: stripe({
    secretKey: process.env.STRIPE_SECRET_KEY!,
    webhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
  }),
});

Stripe

Stripe is currently the primary supported provider. It covers subscriptions, usage-based billing, webhooks, and product syncing out of the box.

See the Stripe provider page for full setup instructions, webhook configuration, and available options.

Provider-native IDs stay internal

Your app identifies customers and plans with its own IDs. PayKit maps them to Stripe customer IDs, product IDs, and price IDs internally. You never store or reference Stripe IDs in your app code.

// Your app always uses its own IDs
await paykit.subscribe({ customerId: "user_123", planId: "pro" });

// PayKit resolves the Stripe customer and price internally

This mapping means you can migrate to a different provider without changing any of your application code.

Future providers

Support for additional providers including PayPal and regional PSPs is planned. The adapter interface is stable, so community-built providers will work with the same API.

On this page