[RFC] Allow the usage of separated stripe components to generate token#26
Conversation
7ee34e0 to
0d9b084
Compare
|
I can confirm this issue, it looks like it was fixed in #14 at some point but it seems to have been reintroduced in 5e9478b. Can this be merged @andrewfan @joshsmith? |
|
On the same subject of using the same elements object it would also be nice to be able to pass options to it too. |
|
Thanks @sardyy, been trying to get individual elements working and your branch fixed the issue. |
|
Hey folks, sorry for the long delay on this. This looks great. The build is failing but for unrelated reasons, so I'm going to merge here and you can use |
|
By the way @adamlc, I agree that it'd be great to pass options. I don't have much bandwidth at the moment to introduce this, but if you'd like to introduce an RFC and then perhaps a PR, that'd be really fantastic. |
|
@joshsmith no problem, I'm working on something else at the moment, but I'll gladly take a look when I'm back on Stripe stuff 😄 |
|
I just want to thank you for the merge @joshsmith. I'm glad it helped! Keep going with the great stuff! |
|
🎉 This PR is included in version 0.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
|
@joshsmith @sardyy Do I understand correctly, that this is how we should interact with individual components: ? |
Context
I've started using this addon but my use case is a bit different from the example described. We wanted to use each of the stripe components (card number, expiry and CVV) separately and then create a token using one these
stripe elements. Although the Stripe's documentation says thatThe Element pulls data from other Elements you’ve created on the same instance of elements to tokenize, it didn't work because it considered just the element I was passing.But there was an important part of the phrase that made me think,
...you’ve created on the same instance of elements.... After taking a look at the code, I've realized that each component was being created using a new instance of elements by callingget(this, 'stripev3.elements')()and consequently, the Stripe.js wasn't able to pull all the data because each of stripe components belonged to a different group.This fix allows us to inject an
elementsfrom our application to the component so all of the stripe elements are created using the same instance and therefore Stripe.js knows how to pull the card information from all of them.I hope it can help people with the same use case :)