-
Notifications
You must be signed in to change notification settings - Fork 799
Closed
Labels
Description
Describe the bug
TS complains about missing property 'subscription_update' on interface FlowData
To Reproduce
I want customers to be able to upgrade their subscriptions, so I followed the docs to create a portal session: https://docs.stripe.com/api/customer_portal/sessions/create
I try to call the function like this:
Stripe.billingPortal.sessions.create({
customer: req.session.user.customerId,
return_url: `${domain}account/${req.session.user.id}`,
flow_data: {
type: 'subscription_update' as stripe.BillingPortal.SessionCreateParams.FlowData.Type,
subscription_update: {
subscription: stripeSubscriptionId,
}
}
}).then((stripeSession) => {
res.redirect(303, stripeSession.url);
});
And in the FlowData interface I can see there is no property 'subscription_update':
I can get around the error by declaring the flow data object separately, but it's messier than passing the object in directly:
const flow_data = {
type: 'subscription_update' as stripe.BillingPortal.SessionCreateParams.FlowData.Type,
subscription_update: {
subscription: stripeSubscriptionId,
}
};
Stripe.billingPortal.sessions.create({
customer: req.session.user.customerId,
return_url: `${domain}account/${req.session.user.id}`,
flow_data
}).then((stripeSession) => {
res.redirect(303, stripeSession.url);
});
Expected behavior
Property 'subscription_update' should exist on interface FlowData.
Code snippets
No response
OS
Windows 11
Node version
v20.11.0
Library version
1.21.6
API version
2024-09-30.acacia
Additional context
No response