#kevin-checkout-confusion

1 messages · Page 1 of 1 (latest)

rustic fulcrumBOT
rapid juniper
#

Hey @odd axle ! I don't really get what that question could mean I'm sorry

odd axle
#

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?

rapid juniper
#

Do you use a publishable key with the web integration? If not why would you need one on mobile?

odd axle
#

Are you saying any front end can all the backend api?

#

We keep getting status 405

rapid juniper
#

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

odd axle
#

ok, so when people call this create checkout session api, does Stripe checkout who is calling it?

rapid juniper
#

what does "does Stripe checkout who is calling it" mean?

hollow edge
#

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

rapid juniper
#

Not entirely sure how that answer explains the issue, most of it is high level

odd axle
#

ok, when we implement the web front end, sometimes we need to use

const stripePromise = loadStripe(
  process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY
);
rapid juniper
#

why are you doing this if you use Checkout?

odd axle
#

so it is not needed when doing Checkout?

rapid juniper
#

no

#

kevin-checkout-confusion

odd axle
#

Got it, when is this needed, this STRIPE_PUBLISHABLE_KEY

rapid juniper
#

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

odd axle
#

Got it, thanks

rapid juniper
#

does your integration still work if you remove that loadStripe()?

odd axle
#

yes, on the web side

rapid juniper
#

so you should be all set!