Skip to content

Commit 2e63228

Browse files
authored
feat: Support flow_data parameter in createPortalLink function
1 parent 1070319 commit 2e63228

File tree

1 file changed

+13
-1
lines changed
  • firestore-stripe-payments/functions/src

1 file changed

+13
-1
lines changed

firestore-stripe-payments/functions/src/index.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,13 @@ export const createPortalLink = functions.https.onCall(
338338
);
339339
}
340340
try {
341-
const { returnUrl: return_url, locale = 'auto', configuration } = data;
341+
const {
342+
returnUrl: return_url,
343+
locale = 'auto',
344+
configuration,
345+
flow_data,
346+
} = data;
347+
342348
// Get stripe customer id
343349
const customer = (
344350
await admin
@@ -355,6 +361,12 @@ export const createPortalLink = functions.https.onCall(
355361
if (configuration) {
356362
params.configuration = configuration;
357363
}
364+
if (flow_data) {
365+
// Ignore type-checking because `flow_data` was added to
366+
// `Stripe.BillingPortal.SessionCreateParams` in
367+
// [email protected] (API version 2022-12-06)
368+
(params as any).flow_data = flow_data;
369+
}
358370
const session = await stripe.billingPortal.sessions.create(params);
359371
logs.createdBillingPortalLink(uid);
360372
return session;

0 commit comments

Comments
 (0)