From 15e3398afc521046bbc501bc6ed08331c2403bf2 Mon Sep 17 00:00:00 2001 From: Rin Arakaki Date: Thu, 6 Nov 2025 06:54:09 +0900 Subject: [PATCH] docs: update stripe.mdx (#5077) --- docs/content/docs/plugins/stripe.mdx | 30 ++++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/content/docs/plugins/stripe.mdx b/docs/content/docs/plugins/stripe.mdx index eba51a242e..6fc9f1a4ad 100644 --- a/docs/content/docs/plugins/stripe.mdx +++ b/docs/content/docs/plugins/stripe.mdx @@ -137,11 +137,11 @@ You can customize the customer creation process: stripe({ // ... other options createCustomerOnSignUp: true, - onCustomerCreate: async ({ customer, stripeCustomer, user }, request) => { + onCustomerCreate: async ({ stripeCustomer, user }, ctx) => { // Do something with the newly created customer - console.log(`Customer ${customer.id} created for user ${user.id}`); + console.log(`Customer ${stripeCustomer.id} created for user ${user.id}`); }, - getCustomerCreateParams: async ({ user, session }, request) => { + getCustomerCreateParams: async (user, ctx) => { // Customize the Stripe customer creation parameters return { metadata: { @@ -570,11 +570,11 @@ You can configure trial periods for your plans: // Called when a trial starts await sendTrialStartEmail(subscription.referenceId); }, - onTrialEnd: async ({ subscription, user }, request) => { + onTrialEnd: async ({ subscription }, ctx) => { // Called when a trial ends - await sendTrialEndEmail(user.email); + await sendTrialEndEmail(subscription.referenceId); }, - onTrialExpired: async (subscription) => { + onTrialExpired: async (subscription, ctx) => { // Called when a trial expires without conversion await sendTrialExpiredEmail(subscription.referenceId); } @@ -711,9 +711,9 @@ stripe({ **createCustomerOnSignUp**: `boolean` - Whether to automatically create a Stripe customer when a user signs up. Default: `false`. -**onCustomerCreate**: `(data: { customer: Customer, stripeCustomer: Stripe.Customer, user: User }, request?: Request) => Promise` - A function called after a customer is created. +**onCustomerCreate**: `(data: { stripeCustomer: Stripe.Customer, user: User }, ctx: GenericEndpointContext) => Promise` - A function called after a customer is created. -**getCustomerCreateParams**: `(data: { user: User, session: Session }, request?: Request) => Promise<{}>` - A function to customize the Stripe customer creation parameters. +**getCustomerCreateParams**: `(user: User, ctx: GenericEndpointContext) => Promise<{}>` - A function to customize the Stripe customer creation parameters. **onEvent**: `(event: Stripe.Event) => Promise` - A function called for any Stripe webhook event. @@ -725,7 +725,7 @@ stripe({ **requireEmailVerification**: `boolean` - Whether to require email verification before allowing subscription upgrades. Default: `false`. -**authorizeReference**: `(data: { user: User, session: Session, referenceId: string, action: "upgrade-subscription" | "list-subscription" | "cancel-subscription" | "restore-subscription"}, request?: Request) => Promise` - A function to authorize reference IDs. +**authorizeReference**: `(data: { user: User, session: Session, referenceId: string, action: "upgrade-subscription" | "list-subscription" | "cancel-subscription" | "restore-subscription"}, ctx: GenericEndpointContext) => Promise` - A function to authorize reference IDs. ### Plan Configuration @@ -748,8 +748,8 @@ Each plan can have the following properties: **freeTrial**: Object containing trial configuration: - **days**: `number` - Number of trial days. - **onTrialStart**: `(subscription: Subscription) => Promise` - Called when a trial starts. - - **onTrialEnd**: `(data: { subscription: Subscription, user: User }, request?: Request) => Promise` - Called when a trial ends. - - **onTrialExpired**: `(subscription: Subscription) => Promise` - Called when a trial expires without conversion. + - **onTrialEnd**: `(data: { subscription: Subscription }, ctx: GenericEndpointContext) => Promise` - Called when a trial ends. + - **onTrialExpired**: `(subscription: Subscription, ctx: GenericEndpointContext) => Promise` - Called when a trial expires without conversion. ## Advanced Usage @@ -795,7 +795,7 @@ subscription: { You can customize the Stripe Checkout session with additional parameters: ```ts title="auth.ts" -getCheckoutSessionParams: async ({ user, session, plan, subscription }, request) => { +getCheckoutSessionParams: async ({ user, session, plan, subscription }, ctx) => { return { params: { allow_promotion_codes: true, @@ -827,7 +827,7 @@ To collect tax IDs from the customer, set `tax_id_collection` to true: ```ts title="auth.ts" subscription: { // ... other options - getCheckoutSessionParams: async ({ user, session, plan, subscription }, request) => { + getCheckoutSessionParams: async ({ user, session, plan, subscription }, ctx) => { return { params: { tax_id_collection: { @@ -846,7 +846,7 @@ To enable automatic tax calculation using the customer's location, set `automati ```ts title="auth.ts" subscription: { // ... other options - getCheckoutSessionParams: async ({ user, session, plan, subscription }, request) => { + getCheckoutSessionParams: async ({ user, session, plan, subscription }, ctx) => { return { params: { automatic_tax: { @@ -903,4 +903,4 @@ For local development, you can use the Stripe CLI to forward webhooks to your lo stripe listen --forward-to localhost:3000/api/auth/stripe/webhook ``` -This will provide you with a webhook signing secret that you can use in your local environment. \ No newline at end of file +This will provide you with a webhook signing secret that you can use in your local environment.