develodesign / vsf-payment-stripe

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

Back-end Platform Compatibility #20

Closed rain2o closed 5 years ago

rain2o commented 5 years ago

I understand that this module handles the payment side directly with Stripe and simply passes the token to the back-end platform of Vue Storefront on place order. But I'm curious what platforms this module currently supports? In order for it to support a back-end platform it would need to send the payment method code and data according to the platform's requirements.

I notice that the payment method "Stripe" (code stripe) is hard-coded to be injected as a payment method with this module. Shouldn't this be coming from the back-end platform's allowed payment methods? There are a few concerns with this approach.

  1. Stripe might not always be available. For example we have restrictions of payment methods based on the storeview and the billing/shipping address. This logic for us is handled in Magento 2 (our VSF back-end platform) and the available payment methods returned from the API is updated accordingly.
  2. The code used stripe isn't what Stripe's official Magento 2 module uses as the payment method code. They use stripe_payments for the Credit Card method, and they have a series of other methods available as well.
  3. Duplicate Stripe payment methods - If our backend platform has Stripe Credit Card payment method enabled then it's going to add it to the list of payment methods returned when calling the API. In this situation we have two Stripe payment methods - the one from back-end and the one hard-coded in this module.

This does add some level of complexity to this if the methods are to be handled dynamically. For starters, the method code might be different for Magento 2 Stripe module vs some other e-commerce platform with Stripe support. I'm not sure if they make this consistent across all platforms or not. Additionally this means the module would need to have some way of ensuring only supported methods via Stripe are utilized. This could be as simple as a disclaimer in the README I suppose, stating which methods are currently supported. But then the logic in the module would need to check the method codes and know what to expect for each one that is supported based on what the platform uses.


I don't have a clear question in this issue (other than what back-end platforms are currently supported if any), and there is no clear answer to all my rambling. But I think this is a good start to a conversation and potential roadmap for this module.

collymore commented 5 years ago

Ok thanks for looking into this. I suggest we include the method code in the modules vsf config, that way it can be updated as required.

To enable it per store based on the Backend enabled payment methods we can implement some logic for checking if it should be included inside of the component here https://github.com/develodesign/vsf-payment-stripe/blob/master/index.ts

We'll be working on this over the next 4 weeks for another project, please let us know if you can look at it or need any advice on anything.

dimasch commented 5 years ago

I will push updates.

dimasch commented 5 years ago

@rain2o Ready, you can check on v2.5.0 tag.

dimasch commented 5 years ago

Now we use https://stripe.com/docs/plugins/magento/install#download as base backend.