#Giriraj

1 messages · Page 1 of 1 (latest)

twilit dewBOT
hushed zinc
crystal pasture
hushed zinc
#

Oh wait, it's not an error from your API request. What's the bps_xxx ID?

crystal pasture
#

checking

#

bps_1O6tjhGas8wwyOqgmo2S0Vd3

#

hello are you there?

hushed zinc
#

I am, please be patient

crystal pasture
#

ok no problem

glacial crow
#

👋 taking over for my colleague. Let me catch up.

crystal pasture
#

hi

#

ok plz look above my issue

#

here is my code which is i have followed by above link

glacial crow
#

yes please give me a couple of minutes to be able to look into your issue

crystal pasture
#

ok no issue

glacial crow
#

so first things first

crystal pasture
#

ok ok

glacial crow
#

why are you using POST?

crystal pasture
#

so, which method should i need to use?

glacial crow
#

so basically what you're doing is instead of redirecting to the session URL you're posting to it

#

try it with GET

#

or window.location.href = session.url

crystal pasture
#

ok let me try 1 min

glacial crow
#

as a button click event rather than a form submit

crystal pasture
#

ok

#

checking 2 min

glacial crow
#

take your time

crystal pasture
glacial crow
#

in the link you sent the action is /create-customer-portal-session

#

it seems in your code that you are generating the session first

#

then submitting it with this form

crystal pasture
#

oh nice working fine now

glacial crow
#

yes one of the ways to do it

crystal pasture
glacial crow
#

you don't really need the form to be honest

#

you can remove it

crystal pasture
#

ok sure will remove

glacial crow
#

but how are you creating the session?

crystal pasture
#

thanks for guide

glacial crow
#

would you mind sharing the code?

crystal pasture
#

yes sure

#

wait

glacial crow
#

why are you creating the portal on the component load?

crystal pasture
#

oh you mean when someone click on manage billing button that time i need to load above right?

glacial crow
#

yes

crystal pasture
#

oh nice yes will follow same

glacial crow
#

and one last thing

#

you can do a redirection from your backend code

#

if you don't want to open a new tab on the front end

crystal pasture
#

ok will remove it. for now not needed

glacial crow
#

something like this

#

but instead of checkout session

#

you're creating a billing portal session

crystal pasture
#

like this right?

#

i mean i m follow checkout flow like above function

glacial crow
#

no I meant on the back end

#

res.redirect(303, session.url);

crystal pasture
#

got it

glacial crow
#

let me know if you need any more help