#nab_abs

1 messages · Page 1 of 1 (latest)

austere idolBOT
boreal swan
placid vessel
#

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

placid vessel
#

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?

boreal swan
#

shall I store the answer into a variable and use the variable instead of CLIENT_SECRET?
yes correct

placid vessel
#

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'));```

austere idolBOT
minor trellis
#

Hi there 👋 taking over, as my colleague needs to step away

Thanks for that feedback. Are there any outstanding questions in this thread?