├── CHANGELOG.md ├── LICENSE ├── README.md ├── components └── PaymentStripe.vue ├── index.ts └── package.json /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) 5 | and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 | 7 | ## [2.6.2] - 6.05.2020 8 | - Added options for stripe customization - @paulpartington-cti 9 | - Fixed readme - @ianrushton88 10 | - Added support translation for title of payment method - @dimasch 11 | 12 | ## [2.6.1] - 13.04.2020 13 | 14 | - Fixed placing order (event bus registration) 15 | 16 | ## [2.6.0] - 12.04.2020 17 | 18 | - Compatibility with VSF 1.11.x, updated documentation. - @dimasch (#43) 19 | 20 | ## [2.5.3] - 09.12.2019 21 | 22 | - Hide loader if we have card input validation errors. - @dimasch (#37) 23 | 24 | ## [2.5.2] - 08.12.2019 25 | 26 | - Fixed after clicking on the "Place the order" button, the page loading icon appears and immediately disappears - @dimasch (#35) 27 | 28 | ## [2.5.1] - 01.12.2019 29 | 30 | - Load the stripe dependencies on component mount level - prevent load on home page and etc. - @dimasch (#33) 31 | 32 | ## [2.5.0] - 12.11.2019 33 | 34 | ### New feature 35 | - Compatibility with the official Stripe magento2 module - @dimasch (#20) 36 | 37 | ## [2.4.1] - 10.11.2019 38 | 39 | ### Fixed 40 | - Added support the custom payment method code - @dimasch (#30) 41 | 42 | ## [2.4.0] - 5.11.2019 43 | 44 | ### Fixed 45 | - Added VSF module signature for beforeRegistration hook - @dimasch (#28) -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Develo Design. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Stripe Payment module for Vue Storefront 2 | 3 | Stripe Payment extension for [vue-storefront](https://github.com/DivanteLtd/vue-storefront), by [Develo Design](https://develodesign.co.uk). 4 | 5 | ![Imgur](https://i.imgur.com/nLbTi6N.png) 6 | 7 | ## Installation 8 | 9 | By hand (preferred): 10 | ```shell 11 | git clone https://github.com/develodesign/vsf-payment-stripe.git ./vue-storefront/src/modules/payment-stripe 12 | ``` 13 | 14 | By yarn: 15 | ```shell 16 | cd storefront/src/themes/default 17 | yarn add https://github.com/develodesign/payment-stripe 18 | ``` 19 | 20 | Add the following **Publishable** API key also to your `config/local.json` and configure the `stripe.apiKey` to point to your Stripe details. 21 | 22 | ```json 23 | "stripe": { 24 | "apiKey": "my_publishable_api_key" 25 | } 26 | ``` 27 | 28 | ## Registering the Stripe module 29 | 30 | Add script import to `./src/modules/client.ts` 31 | 32 | ```js 33 | import { PaymentStripeModule } from './payment-stripe' 34 | 35 | export function registerClientModules () { 36 | ... 37 | registerModule(PaymentStripeModule) 38 | } 39 | ``` 40 | 41 | ## Integrating the Stripe component with your theme 42 | 43 | Go to `storefront/src/themes/defalt/components/core/blocks/Checkout/Payment.vue` 44 | 45 | ```js 46 | import { mapGetters } from 'vuex' 47 | import PaymentStripe from 'src/modules/payment-stripe/components/PaymentStripe' 48 | 49 | export default { 50 | components: { 51 | ..., 52 | PaymentStripe 53 | }, 54 | computed: { 55 | ...mapGetters({ 56 | paymentDetails: 'checkout/getPaymentDetails' 57 | }) 58 | }, 59 | ``` 60 | 61 | Then need add the component instance `` to template section with check on payment method `v-if="paymentDetails.paymentMethod === 'stripe_payments'"`: 62 | 63 | ```html 64 | ... 65 |
66 |
67 | ... 68 |
69 |

{{ $t('Payment method') }}

70 |
71 |
72 | 76 |
77 |
78 |
79 | ... 80 | 81 |
82 |
83 | 84 |
85 |
86 | 87 | ``` 88 | 89 | ## Customization 90 | 91 | You can also customize the appearance of Stripe elements using the `style` key using any of the official stripe style properties found [here](https://stripe.com/docs/stripe-js/reference#stripe-elements). 92 | ```json 93 | "stripe": { 94 | "apiKey": "my_example_api_key", 95 | "style": { 96 | "base": { 97 | "fontSize": "16px", 98 | "color": "#32325d" 99 | }, 100 | "invalid": { 101 | "color": "#fa755a" 102 | } 103 | } 104 | } 105 | ``` 106 | 107 | You can specifiy the card initialisation options with the `options` key. You can pass any the properites found [here](https://stripe.com/docs/js/elements_object/create_element?type=card) 108 | ```json 109 | "stripe": { 110 | "apiKey": "my_example_api_key", 111 | "style": { 112 | "base": { 113 | "fontSize": "16px", 114 | "color": "#32325d" 115 | }, 116 | "invalid": { 117 | "color": "#fa755a" 118 | } 119 | }, 120 | "options": { 121 | "hidePostalCode": true 122 | } 123 | } 124 | ``` 125 | 126 | ## Backend Platform Support 127 | 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. 128 | 129 | We fully support the official [Stripe](https://stripe.com/docs/plugins/magento/install#download) module for Magento2, use the `stripe_payments` as method code. 130 | 131 | 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: 132 | ```json 133 | "stripe": { 134 | "apiKey": "my_example_api_key", 135 | "backendPlatform": "magento2", 136 | "paymentMethodCode": "stripe_payments" 137 | } 138 | ``` 139 | -------------------------------------------------------------------------------- /components/PaymentStripe.vue: -------------------------------------------------------------------------------- 1 | 28 | 29 | 173 | 174 | 212 | -------------------------------------------------------------------------------- /index.ts: -------------------------------------------------------------------------------- 1 | import { StorefrontModule } from '@vue-storefront/core/lib/modules' 2 | import i18n from '@vue-storefront/i18n'; 3 | 4 | export const PaymentStripeModule: StorefrontModule = function ({store, router, appConfig}) { 5 | 6 | const VSF_PAYMENT_CODE = appConfig.stripe.paymentMethodCode || 'stripe' 7 | 8 | // Update the methods 9 | let paymentMethodConfig = { 10 | 'title': i18n.t('Pay by Card (Stripe)'), 11 | 'code': VSF_PAYMENT_CODE, 12 | 'cost': 0, 13 | 'costInclTax': 0, 14 | 'default': false, 15 | 'offline': false, 16 | 'is_server_method': false 17 | } 18 | store.dispatch('checkout/addPaymentMethod', paymentMethodConfig) 19 | 20 | } 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@develodesign/vsf-payment-stripe", 3 | "version": "2.6.2", 4 | "description": "A Stripe extension built for vue-storefront, by Develo Design.", 5 | "main": "lib/index.js", 6 | "directories": { 7 | "lib": "lib" 8 | }, 9 | "scripts": { 10 | "test": "echo \"Error: no test specified\" && exit 1" 11 | }, 12 | "repository": { 13 | "type": "git", 14 | "url": "git+https://github.com/develodesign/vsf-payment-stripe.git" 15 | }, 16 | "keywords": [ 17 | "vue-storefront-stripe", 18 | "vsf-payment-stripe", 19 | "develodesign/vue-storefront-stripe", 20 | "develodesign", 21 | "vue-storefront", 22 | "divanteltd/vue-storefront" 23 | ], 24 | "author": "Mike Sheward (https://www.develodesign.co.uk)", 25 | "maintainers": [ 26 | "Luke Collymore (https://www.develodesign.co.uk)", 27 | "Mike Sheward (https://www.develodesign.co.uk)", 28 | "Dmitry Schegolikhin (https://www.develodesign.co.uk)" 29 | ], 30 | "license": "MIT", 31 | "bugs": { 32 | "url": "https://github.com/develodesign/vsf-payment-stripe/issues" 33 | }, 34 | "homepage": "https://github.com/develodesign/vsf-payment-stripe#readme" 35 | } 36 | --------------------------------------------------------------------------------