#gpatra

1 messages · Page 1 of 1 (latest)

thorny parcelBOT
spice tusk
#

Not sure I understand the question. Can you elaborate?

dapper notch
#

I want to auto redirect after a customer update/cancel any plan in billing portal , i am using stripe api

spice tusk
#
dapper notch
#

Can you send me pseudo code for this schenario?

spice tusk
#

What language are you using?

#

What have you tried? The docs there show how to pass the param

dapper notch
#

Node js

#

using stripe library

spice tusk
#

What have you tried? I can't write your code for you. The docs above show how to pass it

#

If you try something and it's not working, I can help debug

dapper notch
#

showing flow data parameter missing

spice tusk
#

Can you send the code snippet you're using? And the request id?

dapper notch
#

const portalSession = await stripe.billingPortal.sessions.create({
customer: customer,
return_url: redirect_uri,
flow_data: {
after_completion: {
type: "redirect",
redirect: {
return_url: redirect_uri,
},
},
},
});

spice tusk
dapper notch
#

req_CTiMK0KlabKIqi

spice tusk
#

The error message tells you what you need:
Missing required param: flow_data[type].

dapper notch
#

I understood the type paramter , in my case i want to redirect both for subscription cancel/update , what can i do ?

spice tusk
#

Oh if you want a regular portal session, not a deep link to a specific flow: https://stripe.com/docs/customer-management/portal-deep-links, then don't pass flow_data at all. The regular return_url should be all you need: https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-return_url

#

flow_data is for redirecting your customer to the portal to complete a specific action