#Surya-Mani
1 messages ยท Page 1 of 1 (latest)
๐ How can I help?
Im using integrate customer portal ,How it works
You may refer to the doc about how Customer Portal works here: https://stripe.com/docs/customer-management
I already use that API in my code I shows some url How my customers will redirect to update plan page?
After you create the Customer Portal link, you will redirect the customer URL and he/she will click update plan button to go update plan page
How should i do that by get that url and click by customer ?
Which API do you use? Is /v1/billing_portal/sessions used to create the Customer Portal?
this one
The URL will be in session.Url which you can use to redirect the customer to
yes i will store that url in string
How will i redirect manually or it redirect automatically?
You should use your code to redirect the URL automatically
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
My code means i dont understand
basically you have 2 approaches, when your customer clicks on your button in the frontend your code calls the API /create-customer-portal-session
Approach 1: use backend Redirect function, which automatically redirects the customer to the right page (basically sending a 3xx HTTP response)
Approach 2: send the session.Url to the frontend and use window.location = sessionUrl to redirect in the frontend
both approaches achieve the same thing
the code you shared uses the 1st approach
Where should i use window.location = sessionUrl ,In frontend or backend?
you don't need to if you use the 1st Approach, which is the one used in the code you shared
I need to use 2nd
in the front-end
just a fair question why do you need to use the 2nd approach? what are your constraints?
these two codes right
1st one is for frontend and second one is for backend a i right?
yes
sure
in this page after clicking confirm button where the customers will be redirect?
is this in the Customer Portal?
yes
they will be redirected to the Return URL once they're done from the portal
Hello
If i paste that url in browser i will get update plan page
yes
After select the plan it asking for confirm
and after click confirm where i shoul i redirect
Im using angular for frontend
this is not your page, this is Stripe Customer Billing Portal as you can see from the URL billing.stripe.com
i will get this url from here
You already said for approach 1 just copy/paste the code
but i click the button i didn't get any response
Hi! I'm taking over this thread.
I'm not sure I understand the question. Once users are on te customer portal, they stay on the customer portal unless they click on the "return" link in the left of the page.
Did you see that code i have sent
Yes
The highlighted line is the session URL, that's where you should send your users to update their subscriptons.
If you have issues with the redirect between your website and the customer portal, we explain this here: https://stripe.com/docs/customer-management/integrate-customer-portal#redirect
i will use this but no response
I'm using angular for frontend ,is this code is works on angular
This is just HTML so yes it should work.
What's the issue exactly? Do you see an error message in your browser or in your backend?
No i click that button but nothing happens
I need more information to help. Something must happen: an error message in your browser, console, or backend code.
Anycode should need to add in typescript file
I cannot help without more information about the error you see.
Only this html code is enough for frontend?
Yes, it's just a form, so no JavaScript is needed here. However you need to make sure your backend is running and has a /create-customer-portal-session route that is working with no errors
I got this when i run my backend code
Next step is to check your backend log for the exact error, and fix that errir.
is this is an problem
What do you mean?
Are you a software developer?
I'm fresher
I'm sorry I don't understand, what does that mean?
I want to help you, but you are not answering my questions:
- Are you a software developer?
- What exact errors do you see in your backend logs? The screenshot you shared doesn't help much.
- Also can you share your backend code that is throwing the error?
- I'm junior developer trainee
I'm asking you this is error or not in that screenshot
var options = new Stripe.BillingPortal.SessionCreateOptions
{
Customer = "cus_OI7ZQG2pgkiUG8", ///cus_O5lEsCPkUsTi2M
ReturnUrl = "https://reinvent-learning.us/",
};
var service = new Stripe.BillingPortal.SessionService();
// var service = new SessionService();
var session = service.Create(options);
string Url = session.Url;
return Redirect(session.Url);
this is my backend code
Thanks, having a look.
ok
Looks like there is some CORS configuration issue with your backend. You are using dotNET?
Hey! Taking over for my colleague. Let me catch up.
According to this screenshot, you are trying to run a redirection via swagger UI
Did you try to run it from a frontend framework ?
could you please share a screenshot for the error using angular ?
I will click the button but nothing will happens
Share a video screen recording with the devtool console opened
for both network and javascript
ok
This is the code i'm using in my frontend
In frontend no error will show in browser nad console
this is my backend code
after run my backend code it shows this
Did you have any samples for how webhooks works?
this is our CORS policy
It seems your cors policy isn't enabling those connection. You need to search in community how you need to solve your backend cors error, this has no link with Stripe APIs.
I don't know you need to google for it and how you can set/implement CORS policies with the framework you are using actually in your backend (.NET ?)
Your backend is blocking your frontend from making requests, that has no link with Stripe APIs. You need to debug/update your integration in order to update you CORS policies.
Yes, check this one:
https://stripe.com/docs/webhooks/quickstart?lang=dotnet