Moved to stripe/react-stripe-js.
Added the auBankAccount
and fpxBank
elements. These elements will not have automatic Element detection/insertion. To use them you will need to use elements.getElement
and pass them directly to other Stripe.js methods (e.g. stripe.confirmFpxPayment
):
const FpxForm = injectStripe(({stripe, elements}) => {
const handleSubmit = async (event) => {
event.preventDefault();
const {error} = await stripe.confirmFpxPayment('{{CLIENT_SECRET}}', {
payment_method: {
fpx: elements.getElement('fpxBank'),
},
});
}
return (
<form onSubmit={handleSubmit}>
<FpxBankElement accountHolderType="individual" />
<button>Pay</button>
</form>
);
});
Version bump that fixes some typos, no changes.
injectStripe
now injects a reference to the Elements instance created by
<Elements>
as the prop elements
.The primary reason you would want an Elements instance is to use elements.getElement()
, which provides an easy way to get a reference to an Element. You will need to get a reference to an Element to use confirmCardPayment
, confirmCardSetup()
, or createPaymentMethod()
.
Note that the old API for createPaymentMethod
will continue to work and
provide automatic element injection, but we are updating documentation and
examples to use the new argument shape:
// old shape with automatic element detection - still works
this.props.stripe.createPaymentMethod('card').then(/* ... */);
// new shape without automatic element detection - recommended and
// will work with new non-card PaymentMethods
this.props.stripe
.createPaymentMethod({
type: 'card',
card: this.props.elements.getElement('card'),
})
.then(/* ... */);
getElement
method on RSE components that we introduced
in v5.1.0 in favor of the above change. Sorry for the churn.