This repository has been archived by the owner on Mar 27, 2021. It is now read-only.
v6.0.0
New Features
injectStripe
now injects a reference to the Elements instance created by
<Elements>
as the propelements
.
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(/* ... */);
Breaking Changes
- We have removed the
getElement
method on RSE components that we introduced
in v5.1.0 in favor of the above change. Sorry for the churn.