Course lesson 53 · Payments with Stripe
Better Auth Stripe Integration
The Better Auth Stripe plugin is added to the shared authentication configuration, first to create Stripe customers and then to support subscriptions. Each configuration change is used to regenerate the authentication schema and produce the corresponding database alteration. The lesson also separates generation-time Stripe setup from runtime configuration so the deployed application can receive its own key and webhook settings.
Primary source: course video 53 · Supplied English subtitles · 00:15:57.
Understand the idea
- A Stripe customer is a Stripe-side identifier mapped to an application user; an email address alone is not that mapping.
- Customer creation at signup can happen before the user purchases anything.
- The plugin supplies server subscription behavior, client APIs, and much of the webhook synchronization logic.
- Enabling plugin features changes schema requirements: a customer ID field is added to users and a subscription table is introduced.
- Schema metadata lets Drizzle distinguish an incremental alteration from recreating all tables.
What the course does
- Install Stripe and the Better Auth Stripe plugin alongside the matching Better Auth version used by the lesson.
- Extend the shared authentication factory to accept Stripe configuration and enable customer creation at signup.
- Create a Stripe sandbox and provide the key required by this generation setup.
- Regenerate the schema and apply the user customer-ID column alteration to stage and production D1.
- Enable subscriptions, regenerate again, and create the subscription table in both databases.
- Rebuild the shared package and allow runtime Stripe configuration to be supplied by the consuming application.
Watch for
- Versions 1.3.4 are pinned in the recording to address compatibility; these are historical course versions, not a recommendation for a new project today.
- Deleting Drizzle metadata loses incremental-change knowledge, so generated SQL must be reviewed against the actual database.
- The instructor explicitly limits this section to basic subscriptions, not advanced usage-based or multi-product billing.
Recall before revealing
Why does adding the Stripe plugin require database work?
Reveal the explanation
The plugin needs persistent customer and subscription state, so its configuration introduces columns and tables the database must actually contain.
Try it
Compare the schema changes caused by enabling customer creation and by enabling subscriptions.
Check your result
You identify the user’s Stripe customer-ID field for the first and the subscription table for the second.
Practice prompts and answer checks are added teaching material. Answer from memory first, then compare and explain any difference.
Rewatch only what you need
Open this lesson in your original course library and seek to the times below. Videos are not hosted on this site.
- 00:01:31 — Customer mapping and plugin benefits
- 00:05:08 — Pin matching plugin versions
- 00:10:14 — Generate the Stripe customer-ID schema change
- 00:12:17 — Enable and generate subscriptions
Companion primary documentation: Better Auth Stripe plugin. For recorded API names, commands, limits, and prices, check the version you use.