Inchoo / magento2-Inchoo_Stripe

Stripe payment gateway Magento2 extension
56 stars 36 forks source link

Stripe.js compatibility #2

Open ivanweiler opened 10 years ago

ivanweiler commented 10 years ago

Logic: Instead of posting cc, cvv, etc, grab them with js, call stripe.js, get token, inject token, post token

Problem: Hook on what, Magento isn't submiting forms on checkout, he's "collecting" payment info with js and sends it with ajax on both payment continue and place order. Sending payment info through ajax 2 times + validate() in pgw 2 times. So we can't use onsubmit or similar.

_ajax( something + payment.form.serialize() )

Integration: It seems the only way to achieve this is to mess with Magento checkout javascript (rewrite core widgets, block on continue click or similar) which is slightly aggressive. Also, I assume things are different in onepage vs multishipping vs order from admin, not to mention future onestep checkouts. I also can't find custom "fire" events in js which exists in Mage1. Most likely they didn't need them yet for Mage2 EE :)

It's interesting that similar rewrites are seen in \app\code\Magento\Authorizenet\view\frontend\web\js\direct-post.js ( placeOrder.off('click').on('click', new_logic) )

One more thing, I didn't test, but it's mentioned at one place that "stripe tokens can only be used once". Since multishipping is creating multiple orders in a loop, multiple payment calls are executed, so token approach can't work here ?!?

Conclusion: Funny thing is, if we implement usual backend cc non-token way, we're compatible with everything at the same time.

Go with backend cc approach, branch stripe.js approach and make it work on onepage as Mage2 practice for start? Suggestions?

udovicic commented 10 years ago

Since implementation as usual backend cc wouldn't require almost any changes compared to Mage1 version, I would suggest to branch stripe.js and proceed with tokens.. Of course, this implies that multishipping will not be available with this method.

ivanweiler commented 9 years ago

We'll go with NEW stripejs branch one of these days, I think clean implementation of stripe.js is possible with new checkout in M2 1.0.0-beta.

ivanweiler commented 8 years ago

Proof of concept stripe.js implementation can be seen at feature/stripejs branch: https://github.com/Inchoo/magento2-Inchoo_Stripe/tree/feature/stripejs