相关疑难解决方法(0)

如何在 Stripe Reactjs 中获取客户端密钥?为什么没有它就无法呈现付款表单?

我遵循了基本的 React stripe 文档:\n https://stripe.com/docs/stripe-js/react

\n

所以这是我有问题的代码:

\n

索引.js

\n
import React from \'react\';\nimport ReactDOM from \'react-dom\';\nimport App from \'./App\';\nimport {Elements} from \'@stripe/react-stripe-js\';\nimport {loadStripe} from \'@stripe/stripe-js\';\n\n// Make sure to call `loadStripe` outside of a component\xe2\x80\x99s render to avoid\n// recreating the `Stripe` object on every render.\nconst stripePromise = loadStripe(\'process.env.REACT_APP_STRIPE_PUBLIC_KEY\');\n\nfunction Index() {\n/*     const options = {\n        // passing the client secret obtained from the server\n        clientSecret: \'{{CLIENT_SECRET}}\',\n      }; */\n  return (\n    <Elements stripe={stripePromise} /* options={options} */>\n      <App/>\n      \n    </Elements>\n  );\n};\nReactDOM.render(<Index />, document.getElementById(\'root\'));\n …
Run Code Online (Sandbox Code Playgroud)

checkout stripe-payments reactjs

11
推荐指数
2
解决办法
5066
查看次数

标签 统计

checkout ×1

reactjs ×1

stripe-payments ×1