metered-usage-best-practices
Metered Usage
Gate access and track consumption with check() and report().
check()
Verify whether a customer can use a feature.
const result = await paykit.check({
customerId: "user_123",
featureId: "messages",
})
if (!result.allowed) {
throw new Error("Usage limit reached")
}
More from getpaykit/skills
subscriptions-best-practices
Manage subscriptions with PayKit's unified subscribe API, handle upgrades, downgrades, cancellations, resumptions, checkout flows, payment URLs, and subscription status transitions. Use when users need to implement subscription flows or understand PayKit's subscribe semantics.
33create-paykit
Scaffold and implement billing in TypeScript apps with PayKit. Detect framework, configure database, set up Stripe provider, mount route handler, create client, define plans and features. Use when users need to add billing to a new or existing project with PayKit.
16paykit-best-practices
Configure PayKit server and client, set up database connections, manage customer identification, handle events, configure logging, and use testing mode. Use when users need to configure or troubleshoot their PayKit setup.
16plans-and-features-best-practices
Define billing plans and features with PayKit's schema DSL, configure plan groups, boolean and metered features, pricing intervals, default plans, and inferred TypeScript types. Use when users need to model their billing structure, add new plans, or modify features with PayKit.
16stripe-best-practices
Configure the Stripe provider for PayKit, set up API keys, webhook endpoints, sync plans with paykitjs push, handle webhooks, and use the Stripe Customer Portal. Use when users need to connect PayKit to Stripe or troubleshoot Stripe integration.
15