@convex-dev/stripe component for checkout, subscriptions, and webhook sync inside Convex, and @repo/payments for direct Stripe SDK access and AI agent tooling.
Convex Stripe component
The@convex-dev/stripe component handles checkout sessions, subscription management, customer creation, and webhook sync. Stripe data auto-syncs to your Convex database, so queries and subscriptions update in real time.
Setup
Register the component inconvex/convex.config.ts and configure webhook routes in convex/http.ts:
packages/backend/convex/convex.config.ts
packages/backend/convex/http.ts
Create a checkout
packages/backend/convex/stripe/index.ts
mode: "payment" for one-time purchases instead of subscriptions.
Query subscriptions and payments
Because Stripe data syncs to Convex via webhooks, you query it like any other Convex data:packages/backend/convex/stripe/index.ts
Cancel and reactivate
packages/backend/convex/stripe/index.ts
Customer portal
packages/backend/convex/stripe/index.ts
Seat-based pricing
Update subscription quantity for team billing:packages/backend/convex/stripe/index.ts
Configure the webhook in Stripe
- Go to Developers > Webhooks in the Stripe dashboard and click Add endpoint.
- Set the endpoint URL to
https://<your-deployment>.convex.site/stripe/webhook. - Select these events:
checkout.session.completed,customer.created,customer.updated,customer.subscription.created,customer.subscription.updated,customer.subscription.deleted,payment_intent.succeeded,payment_intent.payment_failed,invoice.created,invoice.finalized,invoice.paid,invoice.payment_failed. - Copy the Signing secret (starts with
whsec_) and set it asSTRIPE_WEBHOOK_SECRETin your Convex dashboard environment variables.
Stripe SDK
@repo/payments exports the raw Stripe SDK for cases where you need direct API access outside of Convex, such as Next.js API routes or server actions:
apps/app/actions/billing.ts
packages/backend/convex/agents/billing.ts