Stripe Payment 完全正常,但我在控制台上收到警告消息,“元素上不支持的道具更改:stripe设置后无法更改道具。”
这是我的代码。我不知道为什么会显示警告消息,我错过了什么?
const Parent =() => {
const stripePromise = loadStripe(PUBLISHABLE_KEY);
<Elements stripe ={stripePromise}>
<Child_component/>
</Elements>
}
export default Parent;
import {CardNumberElement, CardExpiryElement, CardCvcElement} from '@stripe/react-stripe-js';
const Child_component =() => {
const handleChange = (event) => {
//get the brand type
};
const handleFormSubmit = async ev =>{
const cardElement = elements.getElement(CardNumberElement);
const paymentMethodReq = await stripe.createPaymentMethod({
type: 'card',
card: cardElement
});
/// and send paymentMethodReq to the backend.
}
render(
<Form className="" onSubmit={handleFormSubmit}>
<div …Run Code Online (Sandbox Code Playgroud)