Skip to content

Commit d70fb1b

Browse files
committed
feat: process cards
Process card info to produce a Stripe token or source
1 parent 3e7b2ef commit d70fb1b

8 files changed

Lines changed: 515 additions & 254 deletions

File tree

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
[![Build Status](https://travis-ci.org/morphatic/v-stripe-elements.svg?branch=master)](https://travis-ci.org/morphatic/v-stripe-elements)
44
[![Coverage Status](https://coveralls.io/repos/github/morphatic/v-stripe-elements/badge.svg?branch=master)](https://coveralls.io/github/morphatic/v-stripe-elements?branch=master)
5-
![npm](https://img.shields.io/npm/v/@morphatic/v-stripe-elements.svg)
6-
![MIT](https://img.shields.io/npm/l/@morphatic/v-stripe-elements.svg)
5+
![npm](https://img.shields.io/npm/v/v-stripe-elements)
6+
![NPM](https://img.shields.io/npm/l/v-stripe-elements)
77
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
88

99
A set of Vue components that styles [Stripe Elements](https://stripe.com/payments/elements) to match the [Vuetify UI library](https://vuetifyjs.com).
@@ -19,13 +19,13 @@ npm i -S v-stripe-elements
1919
Then in the `.env` file in the root of your project:
2020

2121
```sh
22-
VUE_APP_STRIPE_API_KEY=sk_live_4eC39HqLyjWDarjtT1zdp7dc
22+
VUE_APP_STRIPE_API_KEY=pk_live_4eC39HqLyjWDarjtT1zdp7dc
2323
```
2424

2525
Optionally, add your test key to `.env.local`. This will automatically use the test key when doing local development and testing.
2626

2727
```sh
28-
VUE_APP_STRIPE_API_KEY=sk_test_4eC39HqLyjWDarjtT1zdp7dc
28+
VUE_APP_STRIPE_API_KEY=pk_test_4eC39HqLyjWDarjtT1zdp7dc
2929
```
3030

3131
## Basic Usage

dev/App.vue

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,30 +21,30 @@
2121
<v-col cols="6">
2222
<v-stripe-card
2323
v-model="source"
24-
25-
append-icon="mdi-check"
26-
success
24+
:api-key="apiKey"
25+
:append-icon="source && icons.check"
26+
create="source"
2727
label="Some label"
28-
hint="Some hint"
28+
:hint="source ? 'Card is valid' : 'Please enter card info'"
2929
persistent-hint
30+
:success="!!source"
3031
/>
3132
</v-col>
3233
<v-col cols="6">
3334
<v-text-field
34-
success
3535
label="Some label"
3636
hint="Some hint"
3737
persistent-hint
38+
:success="!!source"
3839
/>
3940
</v-col>
4041
</v-row>
4142
<v-row>
4243
<v-col cols="6">
4344
<v-stripe-card
4445
v-model="source"
45-
font="Shadows Into Light"
46+
font-name="Shadows Into Light"
4647
solo
47-
success
4848
:api-key="apiKey"
4949
label="Some label"
5050
hint="Some hint"
@@ -54,7 +54,6 @@
5454
<v-col cols="6">
5555
<v-text-field
5656
solo
57-
success
5857
label="Some label"
5958
hint="Some hint"
6059
persistent-hint
@@ -64,9 +63,10 @@
6463
<v-row>
6564
<v-col cols="6">
6665
<v-stripe-card
67-
v-model="source"
66+
v-model="token"
6867
filled
69-
success
68+
font-name="Hepta Slab"
69+
font-url="https://fonts.googleapis.com/css?family=Hepta+Slab:700&display=swap"
7070
:api-key="apiKey"
7171
label="Some label"
7272
hint="Some hint"
@@ -76,7 +76,6 @@
7676
<v-col cols="6">
7777
<v-text-field
7878
filled
79-
success
8079
label="Some label"
8180
hint="Some hint"
8281
persistent-hint
@@ -88,7 +87,6 @@
8887
<v-stripe-card
8988
v-model="source"
9089
outlined
91-
success
9290
:api-key="apiKey"
9391
label="Some label"
9492
hint="Some hint"
@@ -98,7 +96,6 @@
9896
<v-col cols="6">
9997
<v-text-field
10098
outlined
101-
success
10299
label="Some reall long label"
103100
hint="Some hint"
104101
persistent-hint
@@ -111,7 +108,6 @@
111108
v-model="source"
112109
solo
113110
outlined
114-
success
115111
:api-key="apiKey"
116112
label="Some label"
117113
hint="Some hint"
@@ -122,7 +118,6 @@
122118
<v-text-field
123119
solo
124120
outlined
125-
success
126121
label="Some label"
127122
hint="Some hint"
128123
persistent-hint
@@ -136,17 +131,21 @@
136131

137132
<script>
138133
// import { VStripeCard } from '../src/'
139-
134+
import { mdiCheck } from '@mdi/js'
140135
export default {
141136
// components: {
142137
// VStripeCard,
143138
// },
144139
data: () => ({
145140
apiKey: 'pk_test_TYooMQauvdEDq54NiTphI7jx',
146141
filled: false,
142+
icons: {
143+
check: mdiCheck,
144+
},
147145
outlined: false,
148146
solo: false,
149147
source: null,
148+
token: null,
150149
}),
151150
}
152151
</script>

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
"css-loader": "^3.2.0",
7878
"cssnano": "^4.1.10",
7979
"cz-conventional-changelog": "3.0.2",
80+
"deepmerge": "^4.0.0",
8081
"dotenv": "^8.0.0",
8182
"eslint": "^6.1.0",
8283
"eslint-loader": "^2.2.1",
@@ -113,7 +114,7 @@
113114
"vue-meta": "^2.2.1",
114115
"vue-plugin-load-script": "^1.2.0",
115116
"vue-template-compiler": "^2.6.10",
116-
"vuetify": "^2.0.10",
117+
"vuetify": "^2.0.11",
117118
"vuetify-loader": "^1.3.0",
118119
"webpack": "^4.39.2",
119120
"webpack-cli": "^3.3.6",

0 commit comments

Comments
 (0)