develodesign / vsf-payment-stripe

Stripe payment module for Vue Storefront
MIT License
25 stars 17 forks source link

Payment Intents support #21

Closed rain2o closed 5 years ago

rain2o commented 5 years ago

The notification at the top of Stripe's documentation for Elements indicates that Payment Intents should be used starting September 2019 for all business in Europe https://stripe.com/docs/stripe-js/elements/quickstart.

Additional information on using Payment Intents can be found here https://stripe.com/docs/payments/payment-intents/quickstart.

It looks like all integrations with Stripe should migrate to using this process as soon as possible. I did a quick look on Magento's module and it looks like they are already using Payment Intents. This should make things easier if anything changes with how back-end expects data.

rain2o commented 5 years ago

After further testing I'm realizing this is more critical than I initially thought. Since the Magento 2 Stripe module already uses Payment Intent, placing an order with Stripe without using Payment Intent won't work, at least when working with Magento 2 backend.

Unfortunately I don't see an API endpoint in Stripe's module for creating this token, but there is one for resetting the token. I don't think it will work though because it uses the checkout session to get the cart, and I don't think that's dependable via API. So it looks like a new endpoint will be needed for generating the Payment Intent and returning the secret, and then a VSF API will need to be created to middle-man this.

Maybe there's a better solution, but this is what I've found so far.

rain2o commented 5 years ago

I spent the past day trying to get this module working with Stripe's Payment Intent with Magento 2, and unfortunately the conclusion that I have come to is that it requires Stripe's official M2 module to either be updated to make it work via API, or you need to extend their module for these updates.

The modifications in this module were pretty straight forward. Mostly involved changing the this.stripe.instance.createToken() call to this.stripe.instance.createPaymentMethod() and then formatting the response in the way their M2 module expects (discussed in issue #17 ). However, these modifications don't do any good until the backend platform (Magento in this case) can process it properly. The method I used is for the "manual" confirmation process because that is what the Magento 2 module uses. There is another way to do "automatic" confirmation process if you want to provide that as an option.

So it seems this issue is either pending Stripe's module to be updated, or requires a Magento 2 module to extend theirs. Alternatively this module could be updated accordingly and have the disclaimer that this module only provides the front-end functionality necessary and in order to use it users will need to have back-end support according to their platform.