From f2118e97f85c83b95b63f0b1dc46ebb50b404052 Mon Sep 17 00:00:00 2001 From: gbuomprisco Date: Fri, 20 Sep 2024 18:38:44 +0200 Subject: [PATCH] Stripe: allow passing custom parameters to the Checkout session --- .../billing/core/src/schema/create-billing-checkout.schema.ts | 1 + packages/billing/stripe/src/services/create-stripe-checkout.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/billing/core/src/schema/create-billing-checkout.schema.ts b/packages/billing/core/src/schema/create-billing-checkout.schema.ts index 3af9724e1..6194beda4 100644 --- a/packages/billing/core/src/schema/create-billing-checkout.schema.ts +++ b/packages/billing/core/src/schema/create-billing-checkout.schema.ts @@ -15,4 +15,5 @@ export const CreateBillingCheckoutSchema = z.object({ quantity: z.number(), }), ), + metadata: z.record(z.string()).optional(), }); diff --git a/packages/billing/stripe/src/services/create-stripe-checkout.ts b/packages/billing/stripe/src/services/create-stripe-checkout.ts index 8442e5175..afb2497c1 100644 --- a/packages/billing/stripe/src/services/create-stripe-checkout.ts +++ b/packages/billing/stripe/src/services/create-stripe-checkout.ts @@ -36,6 +36,7 @@ export async function createStripeCheckout( trial_period_days: params.plan.trialDays, metadata: { accountId: params.accountId, + ...(params.metadata ?? {}), }, } : {};