#nab_abs
1 messages · Page 1 of 1 (latest)
Are you following a guide for this? If not, I'd recommend going through
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
As it covers everything in detail
I am following the doc
but I do not know where to put this: (async () => { const response = await fetch('/secret'); const {client_secret: clientSecret} = await response.json(); // Render the form using the clientSecret })();
I do not understand the link with CLIENT_SECRET
Still do not understand what I have to do this with: (async () => {
const response = await fetch('/secret');
const {client_secret: clientSecret} = await response.json();
// Render the form using the clientSecret
})();
I did understand is to retrieve the client_secret but shall I store the answer into a variable and use the variable instead of CLIENT_SECRET?
shall I store the answer into a variable and use the variable instead of CLIENT_SECRET?
yes correct
I think it would be better to add this implementation within the example that you provide: ```import React from 'react';
import ReactDOM from 'react-dom';
import {Elements} from '@stripe/react-stripe-js';
import {loadStripe} from '@stripe/stripe-js';
import CheckoutForm from './CheckoutForm';
// Make sure to call loadStripe outside of a component’s render to avoid
// recreating the Stripe object on every render.
const stripePromise = loadStripe('pk_test_oKhSR5nslBRnBZpjO6KuzZeX'
);
function App() {
const options = {
// passing the client secret obtained in step 3
clientSecret: '{{CLIENT_SECRET}}',
// Fully customizable with appearance API.
appearance: {/.../},
};
return (
<Elements stripe={stripePromise} options={options}>
<CheckoutForm />
</Elements>
);
};
ReactDOM.render(<App />, document.getElementById('root'));```
Hi there 👋 taking over, as my colleague needs to step away
Thanks for that feedback. Are there any outstanding questions in this thread?