#kevin-checkout-confusion
1 messages · Page 1 of 1 (latest)
Hey @odd axle ! I don't really get what that question could mean I'm sorry
Hey @rapid juniper , we have a web backend api that handles Stripe Checkout, it works well
Now, we are trying to use the same backend api for our mobile apps, the question is if we need to add any Stripe publishable key to the mobile front end to call the same backend api?
Do you use a publishable key with the web integration? If not why would you need one on mobile?
I'm really sorry but none of this makes any sense right now. What is a "status 405". There's no details or code, no context about the integration, about what is failing, about what's different on mobile versus on the web, etc.
I recommend that you take a step back from the error and explain what you are doing first. If you use Checkout, all you do is call the Create Checkout Session API https://stripe.com/docs/api/checkout/sessions/create on the server and then redirect to Checkout using the url returned. There's no need for a Publishable API key anywhere
ok, so when people call this create checkout session api, does Stripe checkout who is calling it?
what does "does Stripe checkout who is calling it" mean?
Hey Kevin, i reckon you might be a tad confused! Stripe handles the payment taking, you need to create a payment intent or checkout session on your server, (and authorise that by your own means), then return that to the frontend where you can redirect to stripe, (or show stripe payment elements). then stripe will handle taking that payment and authorizing that ect. you should never put Private keys on any form of frontend (mobile or web). Heres an awesome tutorial from stripe https://stripe.com/docs/payments/accept-a-payment
Thanks @hollow edge
Not entirely sure how that answer explains the issue, most of it is high level
ok, when we implement the web front end, sometimes we need to use
const stripePromise = loadStripe(
process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
);
why are you doing this if you use Checkout?
so it is not needed when doing Checkout?
Got it, when is this needed, this STRIPE_PUBLISHABLE_KEY
there are dozens of ways to use and integrate our numerous products. It's needed when you use Elements for example to collect card details yourself
Got it, thanks
does your integration still work if you remove that loadStripe()?
yes, on the web side
so you should be all set!