#joseph01

1 messages · Page 1 of 1 (latest)

nimble skyBOT
fierce cliff
#

HI 👋

Can you tell me more about what action you took that caused this error to be begin being surfaced?

unborn hollow
#

Hello,
Yes sure.

const stripe = require('stripe')('STRIPE-SECRET-KEY');

#

This I used that was mentioned on docs. After installing with npm install stripe --save

fierce cliff
#

Hm, and what version of our Node library are you using?

Did the suggestion in the error message of adding a polyfill help resolve the behavior that you're encountering?

unborn hollow
#

Node is 18. And no it didn't help. Why is this issue coming any way. It was just stripe to be installed right.

fierce cliff
#

Sorry for not thinking of this sooner, but our Node library is meant to be a server-side library, can you help me understand why you need to include it in your client-side React app?

unborn hollow
#

To connect with the frontend payment.

fierce cliff
#

That's done by your frontend making requests to your backend service.

unborn hollow
#

Couldn't understand. Can you explain a bit more

fierce cliff
#

The React app portion of your flow is your client-side frontend. It should have minimal communication with Stripe, and most of the interaction with the Stripe API should be performed a separate back-end service that you have.

If you look through this guide that walks through the steps needed to accept a payment, you'll notice that the steps are broken up between server-side steps and client-side steps. Creating Payment Intents, creating Customers, things of this nature should be done by your backend-server (sounds like you're planning to use Node for this).
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements&client=react

Securely accept payments online.

unborn hollow
#

I have a headless cms as a backend. Will that work ?

fierce cliff
#

I'm not entirely certain and assume that depends on the details of the CMS. The core requirements are that your server is able to communicate with the Stripe API, and that it is able to communicate with your frontend.

unborn hollow
#

Okaay. Thank you. I check this out.