├── .eslintignore
├── vue-stripe-logo-variant-1.png
├── vue-stripe-logo-variant-2.png
├── vue-stripe-logo-variant-1-small.png
├── stripe_partner_badge_verified_blurple.png
├── .editorconfig
├── src
├── utils.js
├── index.js
├── load-stripe-sdk.js
├── elements
│ ├── index.js
│ ├── Card.vue
│ └── Payment.vue
├── stripe
│ └── index.js
├── checkout
│ ├── props.js
│ └── index.js
└── constants.js
├── .gitignore
├── .npmignore
├── babel.config.js
├── .github
├── FUNDING.yml
├── ISSUE_TEMPLATE
│ ├── feature_request.md
│ └── bug_report.md
└── workflows
│ ├── main.yml
│ └── codeql-analysis.yml
├── .eslintrc
├── rollup.config.js
├── LICENSE
├── typings
└── index.d.ts
├── package.json
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
└── README.md
/.eslintignore:
--------------------------------------------------------------------------------
1 | dist
--------------------------------------------------------------------------------
/vue-stripe-logo-variant-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Incredidev9285/vue-stripe/HEAD/vue-stripe-logo-variant-1.png
--------------------------------------------------------------------------------
/vue-stripe-logo-variant-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Incredidev9285/vue-stripe/HEAD/vue-stripe-logo-variant-2.png
--------------------------------------------------------------------------------
/vue-stripe-logo-variant-1-small.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Incredidev9285/vue-stripe/HEAD/vue-stripe-logo-variant-1-small.png
--------------------------------------------------------------------------------
/stripe_partner_badge_verified_blurple.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Incredidev9285/vue-stripe/HEAD/stripe_partner_badge_verified_blurple.png
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | [*.{js,jsx,ts,tsx,vue}]
2 | indent_style = space
3 | indent_size = 2
4 | trim_trailing_whitespace = true
5 | insert_final_newline = true
6 |
--------------------------------------------------------------------------------
/src/utils.js:
--------------------------------------------------------------------------------
1 | export const isSecureHost = (testMode) => {
2 | if (testMode) return true;
3 | return window.location.hostname === 'localhost' || window.location.protocol === 'https:';
4 | };
5 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | demo/
3 | dist/
4 | node_modules/
5 | npm-debug.log
6 | yarn-error.log
7 |
8 | # Editor directories and files
9 | .idea
10 | *.suo
11 | *.ntvs*
12 | *.njsproj
13 | *.sln
--------------------------------------------------------------------------------
/.npmignore:
--------------------------------------------------------------------------------
1 | test/
2 | src/
3 | node_modules/
4 | .github/
5 | .editorconfig
6 | .eslintignore
7 | .eslintrc
8 | .babel.config.js
9 | .rollup.config.js
10 | vue-stripe-logo-*
11 | stripe_partner_badge_verified_blurple.png
12 | CODE_OF_CONDUCT.md
13 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import StripePlugin from './stripe';
2 | import StripeCheckout from './checkout';
3 | import StripeElementCard from './elements/Card.vue';
4 | import StripeElementPayment from './elements/Payment.vue';
5 | import StripeElementsPlugin from './elements';
6 |
7 | export {
8 | StripePlugin,
9 | StripeCheckout,
10 | StripeElementCard,
11 | StripeElementPayment,
12 | StripeElementsPlugin,
13 | };
14 |
--------------------------------------------------------------------------------
/babel.config.js:
--------------------------------------------------------------------------------
1 | module.exports = function (api) {
2 | api.cache(true);
3 |
4 | const presets = [
5 | '@babel/preset-env',
6 | // 'minify'
7 | ];
8 | const plugins = [
9 | '@babel/transform-runtime',
10 | '@babel/plugin-proposal-export-default-from',
11 | '@babel/plugin-proposal-optional-chaining',
12 | ];
13 | // const ignore = [
14 | // '**/*.test.js',
15 | // ];
16 |
17 | return {
18 | presets,
19 | plugins,
20 | // ignore
21 | };
22 | };
23 |
--------------------------------------------------------------------------------
/src/load-stripe-sdk.js:
--------------------------------------------------------------------------------
1 | import { STRIPE_JS_SDK_URL } from './constants';
2 |
3 | export const loadStripeSdk = ({ version = 'v3', disableAdvancedFraudDetection }, callback) => {
4 | if (window.Stripe) {
5 | callback();
6 | return;
7 | }
8 | let url = `${STRIPE_JS_SDK_URL}/${version}`;
9 | if (disableAdvancedFraudDetection) url += '?advancedFraudSignals=false';
10 | const e = document.createElement('script');
11 | e.src = url;
12 | e.type = 'text/javascript';
13 | document.getElementsByTagName('head')[0].appendChild(e);
14 | e.addEventListener('load', callback);
15 | };
16 |
--------------------------------------------------------------------------------
/src/elements/index.js:
--------------------------------------------------------------------------------
1 | import { STRIPE_PARTNER_DETAILS } from '../constants';
2 | /**
3 | * @deprecated - This can be achieved by using the Stripe plugin.
4 | */
5 | export default {
6 | async install (Vue, options) {
7 | const {
8 | pk,
9 | stripeAccount,
10 | apiVersion,
11 | locale,
12 | elementsOptions,
13 | } = options;
14 | const stripe = window.Stripe(pk, { stripeAccount, apiVersion, locale });
15 | stripe.registerAppInfo(STRIPE_PARTNER_DETAILS);
16 | const elements = stripe.elements(elementsOptions);
17 | Vue.prototype.$stripe = stripe;
18 | Vue.prototype.$stripeElements = elements;
19 | },
20 | };
21 |
--------------------------------------------------------------------------------
/src/stripe/index.js:
--------------------------------------------------------------------------------
1 | import {
2 | STRIPE_PARTNER_DETAILS,
3 | // INSECURE_HOST_ERROR_MESSAGE,
4 | } from '../constants';
5 | // import { isSecureHost } from '../utils';
6 | export default {
7 | install (Vue, options) {
8 | // FIXME: temporarily remove to avoid problems with remote non-production deployments
9 | // if (!isSecureHost(options.testMode)) console.warn(INSECURE_HOST_ERROR_MESSAGE);
10 | const {
11 | pk,
12 | stripeAccount,
13 | apiVersion,
14 | locale,
15 | } = options;
16 | const stripe = window.Stripe(pk, { stripeAccount, apiVersion, locale });
17 | stripe.registerAppInfo(STRIPE_PARTNER_DETAILS);
18 | Vue.prototype.$stripe = stripe;
19 | },
20 | };
21 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: [OSSPhilippines, jofftiquez] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: # vue-stripe-checkout
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username"
12 | custom: ['https://paypal.me/jofftiquez']
13 |
--------------------------------------------------------------------------------
/.eslintrc:
--------------------------------------------------------------------------------
1 | {
2 | "rules": {
3 | "semi": [
4 | 2,
5 | "always"
6 | ],
7 | "space-before-function-paren": [
8 | 2,
9 | "always"
10 | ],
11 | "keyword-spacing": [
12 | 2,
13 | {
14 | "before": true,
15 | "after": true
16 | }
17 | ],
18 | "space-before-blocks": [
19 | 2,
20 | "always"
21 | ],
22 | "comma-dangle": [
23 | 2,
24 | "always-multiline"
25 | ]
26 | },
27 | "parser": "vue-eslint-parser",
28 | "root": true,
29 | "env": {
30 | "node": true
31 | },
32 | "extends": [
33 | "plugin:vue/essential",
34 | "plugin:vue/strongly-recommended",
35 | "plugin:vue/recommended",
36 | "@vue/standard"
37 | ],
38 | "parserOptions": {
39 | "ecmaVersion": 2020
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ## NOTE: Moving forward, issues that does not conform with this format will be closed automatically. (You can delete this part)
11 |
12 | **Is your feature request related to a problem? Please describe.**
13 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
14 |
15 | **Describe the solution you'd like**
16 | A clear and concise description of what you want to happen.
17 |
18 | **Describe alternatives you've considered**
19 | A clear and concise description of any alternative solutions or features you've considered.
20 |
21 | **Additional context**
22 | Add any other context or screenshots about the feature request here.
23 |
--------------------------------------------------------------------------------
/rollup.config.js:
--------------------------------------------------------------------------------
1 | import babel from 'rollup-plugin-babel';
2 | import vue from 'rollup-plugin-vue';
3 | import postcss from 'rollup-plugin-postcss';
4 | import { terser } from 'rollup-plugin-terser';
5 | import resolve from '@rollup/plugin-node-resolve';
6 | import commonjs from 'rollup-plugin-commonjs';
7 |
8 | export default {
9 | input: 'src/index.js',
10 | output: [
11 | {
12 | exports: 'named',
13 | name: 'vue-stripe',
14 | file: 'dist/index.js',
15 | format: 'cjs',
16 | },
17 | {
18 | exports: 'named',
19 | name: 'VueStripe',
20 | file: 'dist/vue-stripe.js',
21 | format: 'umd',
22 | },
23 | ],
24 | plugins: [
25 | terser(),
26 | vue(),
27 | resolve(),
28 | babel({
29 | runtimeHelpers: true,
30 | exclude: /node_modules/,
31 | }),
32 | postcss({
33 | plugins: [],
34 | }),
35 | commonjs(),
36 | ],
37 | };
38 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Jofferson Ramirez Tiquez
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 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | ## NOTE: Moving forward, issues that does not conform with this format will be closed automatically. (You can delete this part)
11 |
12 | **Describe the bug**
13 | A clear and concise description of what the bug is.
14 |
15 | **To Reproduce**
16 | Steps to reproduce the behavior:
17 | 1. Go to '...'
18 | 2. Click on '....'
19 | 3. Scroll down to '....'
20 | 4. See error
21 |
22 | **Expected behavior**
23 | A clear and concise description of what you expected to happen.
24 |
25 | **Screenshots**
26 | If applicable, add screenshots to help explain your problem.
27 |
28 | **Desktop (please complete the following information):**
29 | - OS: [e.g. iOS]
30 | - Browser [e.g. chrome, safari]
31 | - Version [e.g. 22]
32 |
33 | **Smartphone (please complete the following information):**
34 | - Device: [e.g. iPhone6]
35 | - OS: [e.g. iOS8.1]
36 | - Browser [e.g. stock browser, safari]
37 | - Version [e.g. 22]
38 |
39 | **Additional context**
40 | Add any other context about the problem here.
41 |
--------------------------------------------------------------------------------
/.github/workflows/main.yml:
--------------------------------------------------------------------------------
1 | name: Deploy
2 |
3 | on:
4 | push:
5 | tags:
6 | - 'v*'
7 |
8 | jobs:
9 | build-test-publish:
10 | name: Lint, Test, Build, and Publish to NPM
11 | runs-on: ubuntu-latest
12 | strategy:
13 | matrix:
14 | node: [10]
15 | steps:
16 | - uses: actions/checkout@master
17 | - uses: actions/setup-node@v1
18 | with:
19 | node-version: ${{ matrix.node }}
20 | registry-url: https://registry.npmjs.org/
21 | - name: Install yarn
22 | run: npm install yarn@latest -g
23 | - name: Install dependencies
24 | run: yarn
25 | - name: Run lint, build
26 | env:
27 | VUE_STRIPE_WEBSITE: https://vuestripe.com
28 | VUE_STRIPE_PARTNER_ID: ${{ secrets.VUE_STRIPE_PARTNER_ID }}
29 | run: |
30 | echo ${{ secrets.VUE_STRIPE_PARTNER_ID }}
31 | yarn lint
32 | yarn build
33 | - name: Ensure package-lock.json
34 | run: |
35 | rm -rf node_modules
36 | npm install
37 | - name: Publish
38 | run: |
39 | npm ci
40 | npm publish --access public
41 | env:
42 | NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
43 |
--------------------------------------------------------------------------------
/src/checkout/props.js:
--------------------------------------------------------------------------------
1 | import {
2 | BILLING_ADDRESS_COLLECTION_TYPES,
3 | DEFAULT_LOCALE,
4 | SUPPORTED_LOCALES,
5 | SUPPORTED_SUBMIT_TYPES,
6 | } from '../constants';
7 |
8 | export default {
9 | pk: {
10 | type: String,
11 | required: true,
12 | },
13 | mode: {
14 | type: String,
15 | validator: value => ['payment', 'subscription'].includes(value),
16 | },
17 | lineItems: {
18 | type: Array,
19 | default: undefined,
20 | },
21 | items: {
22 | type: Array,
23 | },
24 | successUrl: {
25 | type: String,
26 | default: window.location.href,
27 | },
28 | cancelUrl: {
29 | type: String,
30 | default: window.location.href,
31 | },
32 | submitType: {
33 | type: String,
34 | validator: (value) => SUPPORTED_SUBMIT_TYPES.includes(value),
35 | },
36 | billingAddressCollection: {
37 | type: String,
38 | default: 'auto',
39 | validator: (value) => BILLING_ADDRESS_COLLECTION_TYPES.includes(value),
40 | },
41 | clientReferenceId: {
42 | type: String,
43 | },
44 | customerEmail: {
45 | type: String,
46 | },
47 | sessionId: {
48 | type: String,
49 | },
50 | stripeAccount: {
51 | type: String,
52 | default: undefined,
53 | },
54 | apiVersion: {
55 | type: String,
56 | default: undefined,
57 | },
58 | locale: {
59 | type: String,
60 | default: DEFAULT_LOCALE,
61 | coerce: (locale) => {
62 | if (SUPPORTED_LOCALES.includes(locale)) return locale;
63 | console.warn(`VueStripe Warning: '${locale}' is not supported by Stripe yet. Falling back to default '${DEFAULT_LOCALE}'.`);
64 | return DEFAULT_LOCALE;
65 | },
66 | },
67 | shippingAddressCollection: {
68 | type: Object,
69 | validator: value => Object.prototype.hasOwnProperty.call(value, 'allowedCountries'),
70 | },
71 | disableAdvancedFraudDetection: {
72 | type: Boolean,
73 | },
74 | stripeOptions: {
75 | type: Object,
76 | default: null,
77 | },
78 | };
79 |
--------------------------------------------------------------------------------
/typings/index.d.ts:
--------------------------------------------------------------------------------
1 | import Vue, { PluginObject, PluginFunction } from "vue";
2 |
3 | export type StripePluginOptions = {
4 | pk: string;
5 | stripeAccount: string;
6 | apiVersion: string;
7 | locale: string;
8 | }
9 |
10 | export interface StripePluginObject extends PluginObject
6 |
7 | Vue Stripe 💳
8 |
[](https://opencollective.com/vue-stripe-checkout)    [](https://opencollective.com/vue-stripe-checkout)
11 |
12 | > [Vue Stripe](https://vuestripe.com) is now an official [Stripe partner](https://stripe.com/partners/vue-stripe) 🎉
13 |
14 | Stripe Checkout & Elements for Vue.js (support for Vue3 is currently in development)
15 |
16 | You can support this project by giving it a star, or following the author. You can also send your love through [Open Collective](https://opencollective.com/vue-stripe-checkout#section-contribute) :heart:.
17 |
18 | ## Documentation
19 |
20 | - [Website (https://vuestripe.com)](https://vuestripe.com)
21 | - [Documentation](https://docs.vuestripe.com/vue-stripe/)
22 | - [Stripe Checkout](https://docs.vuestripe.com/vue-stripe/stripe-checkout)
23 | - [Stripe Elements](https://docs.vuestripe.com/vue-stripe/stripe-elements)
24 | - [Stripe Plugin](https://docs.vuestripe.com/vue-stripe/vue-stripe-plugin)
25 |
26 | ## Contributors
27 |
28 | ### Code Contributors
29 |
30 | This project exists thanks to all the people who contribute. [[Contribute](CONTRIBUTING.md)].
31 |
](https://mightyminds.org)
60 | [
](https://mycure.md)
61 | [
](http://myteamops.com)
62 |
63 | **Vue Stripe is now powered by GitBook**
64 |
65 | [
](https://gitbook.com)
66 |
67 | Made with :heart: by [Joff Tiquez](https://twitter.com/jrtiquez)
68 |
--------------------------------------------------------------------------------
/src/elements/Card.vue:
--------------------------------------------------------------------------------
1 |
2 |