#gpatra
1 messages · Page 1 of 1 (latest)
Not sure I understand the question. Can you elaborate?
I want to auto redirect after a customer update/cancel any plan in billing portal , i am using stripe api
If you specify redirect as the after_completion type: https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-flow_data-after_completion-type then you can also specify a return url to redirect to here: https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-flow_data-after_completion-redirect-return_url
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Can you send me pseudo code for this schenario?
What language are you using?
What have you tried? The docs there show how to pass the param
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
showing flow data parameter missing
Can you send the code snippet you're using? And the request id?
const portalSession = await stripe.billingPortal.sessions.create({
customer: customer,
return_url: redirect_uri,
flow_data: {
after_completion: {
type: "redirect",
redirect: {
return_url: redirect_uri,
},
},
},
});
Ok can you share the request id so I can look at what the error is? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
req_CTiMK0KlabKIqi
The error message tells you what you need:
Missing required param: flow_data[type].
You didn't pass this required param: https://stripe.com/docs/api/customer_portal/sessions/create#create_portal_session-flow_data-type
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I understood the type paramter , in my case i want to redirect both for subscription cancel/update , what can i do ?
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
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
flow_data is for redirecting your customer to the portal to complete a specific action