从 stripe 文档中,我已将 stripe 集成到基于反应打字稿的项目中。但我收到客户端秘密 ID 错误。下面是我的代码:
placeOrder.tsx:
import {Elements} from '@stripe/react-stripe-js';
import {loadStripe} from '@stripe/stripe-js';
import CheckoutForm from './Checkout';
// 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_..Pdx'); // public key from stripe dashboard
export default function PlaceORder() {
const options = {
// passing the client secret obtained from the server
clientSecret: 'sk_test_.....YKGWngQO', // client secret from stipe dashboard
theme: 'stripe',
};
return (
<Elements stripe={stripePromise} options={options}>
<CheckoutForm />
</Elements>
);
};
checkout.tsx:
import {PaymentElement} from '@stripe/react-stripe-js';
const CheckoutForm = () => {
return (
<form>
<PaymentElement />
<button>Submit</button>
</form>
);
};
export default CheckoutForm;
请帮我解决这个问题!
你能告诉我你遇到的错误吗?