Giter Site home page Giter Site logo

vsf-payment-stripe's Introduction

Stripe Payment module for Vue Storefront

Stripe Payment extension for vue-storefront, by Develo Design.

Imgur

Installation

By hand (preferred):

git clone https://github.com/develodesign/vsf-payment-stripe.git ./vue-storefront/src/modules/payment-stripe

By yarn:

cd storefront/src/themes/default
yarn add https://github.com/develodesign/payment-stripe

Add the following Publishable API key also to your config/local.json and configure the stripe.apiKey to point to your Stripe details.

"stripe": {
    "apiKey": "my_publishable_api_key"
}

Registering the Stripe module

Add script import to ./src/modules/client.ts

import { PaymentStripeModule } from './payment-stripe'

export function registerClientModules () {
  ...
  registerModule(PaymentStripeModule)
}

Integrating the Stripe component with your theme

Go to storefront/src/themes/defalt/components/core/blocks/Checkout/Payment.vue

import { mapGetters } from 'vuex'
import PaymentStripe from 'src/modules/payment-stripe/components/PaymentStripe'

export default {
  components: {
    ...,
    PaymentStripe
  },
  computed: {
    ...mapGetters({
      paymentDetails: 'checkout/getPaymentDetails'
    })
  },

Then need add the component instance <payment-stripe/> to template section with check on payment method v-if="paymentDetails.paymentMethod === 'stripe_payments'":

...
<div class="row fs16 mb35">
    <div class="col-xs-12 h4">
        ...
        <div class="col-xs-12">
            <h4>{{ $t('Payment method') }}</h4>
        </div>
        <div class="col-md-6 mb15">
            <label class="radioStyled"> {{ getPaymentMethod().title }}
            <input type="radio" value="" checked disabled name="chosen-payment-method">
            <span class="checkmark" />
            </label>
        </div>
        </div>
    </div>
    ...
    <!-- The stripe method integration -->
    <div class="row mb35 stripe-container" v-if="paymentDetails.paymentMethod === 'stripe_payments'">
        <div class="col-xs-12">
            <payment-stripe/>
        </div>
    </div>
</div>

Customization

You can also customize the appearance of Stripe elements using the style key using any of the official stripe style properties found here.

"stripe": {
    "apiKey": "my_example_api_key",
    "style": {
        "base": {
            "fontSize": "16px",
            "color": "#32325d"
        },
        "invalid": {
            "color": "#fa755a"
        }
    }
}

You can specifiy the card initialisation options with the options key. You can pass any the properites found here

"stripe": {
    "apiKey": "my_example_api_key",
    "style": {
        "base": {
            "fontSize": "16px",
            "color": "#32325d"
        },
        "invalid": {
            "color": "#fa755a"
        }
    },
    "options": {
        "hidePostalCode": true
    }
}

Backend Platform Support

Each back-end platform handles Stripe payment method processing in its own way. Due to this, it is difficult to support all platforms until each one has been specifically tested and accounted for. The following back-end platforms are supported.

We fully support the official Stripe module for Magento2, use the stripe_payments as method code.

To specify your backend platform for this module to handle it, if it is supported, add the backend_platform attribute in config/local.json. For example:

"stripe": {
    "apiKey": "my_example_api_key",
    "backendPlatform": "magento2",
    "paymentMethodCode": "stripe_payments"
}

vsf-payment-stripe's People

Contributors

collymore avatar dimasch avatar ianrushton88 avatar nkmnz avatar paulpartington-cti avatar pkarw avatar rain2o avatar vineethcubet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

vsf-payment-stripe's Issues

Outdated beforeRegistration signature

See in console:

You are using outdated signature for beforeRegistration hook that soon will be deprecated and module will stop working properly. Please update to the new signature that can be found in our docs: https://docs.vuestorefront.io/guide/modules/introduction.html#beforeregistration stripe

Error Rendering

Hello after inplentation I got this error
Vuestorefront: latest

Error during render : /error
TypeError: Cannot read property 'paymentMethodCode' of undefined
    at PaymentStripeModule (src/modules/payment-stripe/index.ts:6:44)
    at registerModule (core/lib/modules.ts:28:4)
    at registerClientModules (src/modules/client.ts:39:17)
    at server-bundle.js:267:102
    at step (node_modules/tslib/tslib.es6.js:100:0)
    at Object.next (node_modules/tslib/tslib.es6.js:81:44)
    at fulfilled (node_modules/tslib/tslib.es6.js:71:41)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)```

Iusse while building app

I tried integrating the Stripe payment gateway by going through your given docs. Stripe should work on the local server or not. But when pushed on the server getting some error. I have attached the error image screenshot given below.

Screenshot 2023-12-16 214439

Payment Intents support

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.

Magento Error Array To String Conversion

Hey, when I want to pay with stripe Account, I got the following error in my Magento 2 log:
main.CRITICAL: Report ID: webapi-5cd423334fe8e; Message: Notice: Array to string conversion in /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Reflection/TypeProcessor.php on line 473 {"exception":"[object] (Exception(code: 0): Report ID: webapi-5cd423334fe8e; Message: Notice: Array to string conversion in /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Reflection/TypeProcessor.php on line 473 at /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Webapi/ErrorProcessor.php:206, Exception(code: 0): Notice: Array to string conversion in /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/Reflection/TypeProcessor.php on line 473 at /opt/bitnami/apps/magento/htdocs/vendor/magento/framework/App/ErrorHandler.php:61)"} []

In vuestorefront , After stripe-payment payment integration " order not placing issue "

I trying stripe-payment integration with vuestorefront
i complete integration follow through this link:" https://github.com/develodesign/vsf-payment-stripe "
After integration, I try to check payment process so i use test-card for payment.
But payment is show two notification error:
1,Error: Error placing an order
2,The order can not be transfered because of server error. Order has been queued
Do you know anything about this issue?

Stripe 'Pay' button is hidden inside iframe

I have done everything according to the instructions. And when I run the app, I can see the field to input card number, expire date, cvv, postal code.

But the button is hidden. Please help me to make the button visible. I`m stuck on this last step.
stripe-pay-button

while placing order via stripe payment, getting some error.

I followed all steps which you have given and applied one by one correctly but now after selection of stripe payment way, on order placing getting this Error1: "Error placing an order. Cannot place order because a payment method was not provided."
Error2: "The order can not be transferred because of server error. Order has been queued". I have attached Error screenshot.

image (3)

Back-end Platform Compatibility

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.