Skip to content

Commit 9ab8170

Browse files
chetboxdackers86
authored andcommitted
feat: Support flow_data parameter in createPortalLink function
1 parent 412c6f8 commit 9ab8170

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
@@ -361,7 +361,13 @@ export const createPortalLink = functions.https.onCall(
361361
);
362362
}
363363
try {
364-
const { returnUrl: return_url, locale = 'auto', configuration } = data;
364+
const {
365+
returnUrl: return_url,
366+
locale = 'auto',
367+
configuration,
368+
flow_data,
369+
} = data;
370+
365371
// Get stripe customer id
366372
let customerRecord = (await admin
367373
.firestore()
@@ -391,6 +397,12 @@ export const createPortalLink = functions.https.onCall(
391397
if (configuration) {
392398
params.configuration = configuration;
393399
}
400+
if (flow_data) {
401+
// Ignore type-checking because `flow_data` was added to
402+
// `Stripe.BillingPortal.SessionCreateParams` in
403+
// [email protected] (API version 2022-12-06)
404+
(params as any).flow_data = flow_data;
405+
}
394406
const session = await stripe.billingPortal.sessions.create(params);
395407
logs.createdBillingPortalLink(uid);
396408
return session;

0 commit comments

Comments
 (0)