subscriptions-best-practices
Subscriptions
PayKit uses a single subscribe() method for all subscription transitions.
subscribe()
const result = await paykit.subscribe({
customerId: "user_123",
planId: "pro",
successUrl: "https://example.com/billing?success=true",
cancelUrl: "https://example.com/billing",
})
Parameters
More from getpaykit/skills
create-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.
15metered-usage-best-practices
Implement usage-based billing with PayKit's check and report methods, gate features by entitlements, track and decrement usage, handle balance resets, and build metered billing flows. Use when users need to add usage limits, API rate limiting, or consumption-based billing with PayKit.
15