swell-js
swell-js copied to clipboard
fix: bind stripe element instance to their events
This allows us to have the element in stripe events:
swell.payment.createElements({
card: {
onReady: function() { // context requires function (not arrow functions)
console.log('card element ready')
this.focus() // this is the element instance
}
}
})
Also work with separateElements: true
swell.payment.createElements({
card: {
separateElements: true,
cardNumber: {
onReady: function() { // context requires function (not arrow functions)
console.log('card number element ready')
this.focus() // this is the element instance
}
},
cardExpiry: {
onReady: function() { // context requires function (not arrow functions)
console.log('card expiry element ready')
// this is the element instance
this.on('networkschange', () => { })
}
},
}
})