#J-e-s-u-s-keys

1 messages · Page 1 of 1 (latest)

hollow kraken
#

compulsory to use publishable key at frontend when you are making payment
Yes, do not use your sk_xxx key in your front-end application!

pale robin
#

req_RQ8BlvWOKNbR2g

#

I am using my secret key at backend,
and not using publishable key on frontend.
Is it necessary to use publishable key at front?

rocky heath
#

Hi! I'm taking over this thread.

#

If you are using Checkout Session, then you don't have to use the publishable key on the frontend.

pale robin
#

Can you please help me figure it out why i am getting 403

rocky heath
#

Where are you getting a 403? The request you shared (req_RQ8BlvWOKNbR2g) was successful.

pale robin
rocky heath
#

Can you share your code to redirect users to your Checkout Session URL?

pale robin
rocky heath
#

And you are making a POST request to that function from your frontend?

#

If you are making a POST request, then your backend needs to return a JSON reponse, something like { url: checjout_session.url }, and then on the frontend you redirect users to that page, for example with location.href = url.

pale robin
#

Yes i am making a POST request,

rocky heath
#

You cannot do a redirect while doing a POST request, that's why it fails.

#

Either you do a POST request to retreive the URL in JSON format
Or you don't do a POST request, instead directly use a link, and in that case your backend can do a redirect.

uncut compass
#

@pale robin I have unarchived this thread, catching up in it and will be able to help you in a bit

pale robin
#

@uncut compass i am getting this in my postman, when i try to retrieve url

#

instead of redirect

uncut compass
#

Hey, just catching up. Is that an error message that your server is passing back or is that a general POSTMAN error?

pale robin
#

this error message is from server

elfin coral
#

Hi 👋 jumping in as my teammate needs to step away. I just want to make sure I'm understanding what you're currently trying to do correctly. You're making a request to your API via Postman, but your endpoint is returning an error?

pale robin
#

YEs

#

I am trying to retrieve URL from API

#

as I am unable to redirect

elfin coral
#

Is the request being made to Stripe completing successfully?

pale robin
#

Yes, the request is completing successfully, but i am unable to redirect so can't make any payments

elfin coral
#

Okay, so the Stripe portion seems to be working as expected, but you're having problem returning the created URL from your backend to your frontend.

#

Looking at your endpoint code, you seem to be returning a string instead of returning an HttpResponse. I would recommend reviewing how to build an endpoint with that framework and how to respond to those requests.