@rebilly/framepay-vue 13.10.0 → 13.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +2 -2
- package/README.md +179 -179
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -12,51 +12,51 @@ This is the repo for the official Vue.js wrapper for Rebilly's [FramePay](https:
|
|
|
12
12
|
## Table of Contents
|
|
13
13
|
|
|
14
14
|
- [framepay-vue](#framepay-vue)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
15
|
+
- [Table of Contents](#table-of-contents)
|
|
16
|
+
- [FramePay Documentation](#framepay-documentation)
|
|
17
|
+
- [Demos](#demos)
|
|
18
|
+
- [Installation](#installation)
|
|
19
|
+
- [Getting Started](#getting-started)
|
|
20
|
+
- [Initialization](#initialization)
|
|
21
|
+
- [At startup](#at-startup)
|
|
22
|
+
- [On a component (rebilly-form, rebilly-card etc)](#on-a-component-rebilly-form-rebilly-card-etc)
|
|
23
|
+
- [Lazy loading Framepay files](#lazy-loading-framepay-files)
|
|
24
|
+
- [Using a FramePay instance the page already loads](#using-a-framepay-instance-the-page-already-loads)
|
|
25
|
+
- [Usage](#usage)
|
|
26
|
+
- [Google Pay and Apple Pay](#google-pay-and-apple-pay)
|
|
27
|
+
- [With rebilly-form](#with-rebilly-form)
|
|
28
|
+
- [With rebilly-form and custom submit logic](#with-rebilly-form-and-custom-submit-logic)
|
|
29
|
+
- [With rebilly-token](#with-rebilly-token)
|
|
30
|
+
- [Handle token manually](#handle-token-manually)
|
|
31
|
+
- [Advanced Options](#advanced-options)
|
|
32
|
+
- [Multiple Payment Methods](#multiple-payment-methods)
|
|
33
|
+
- [v-if](#v-if)
|
|
34
|
+
- [v-show](#v-show)
|
|
35
|
+
- [Styling](#styling)
|
|
36
|
+
- [Built in Styling](#built-in-styling)
|
|
37
|
+
- [Custom Styling](#custom-styling)
|
|
38
|
+
- [Events](#events)
|
|
39
|
+
- [`rebilly-form`](#rebilly-form)
|
|
40
|
+
- [on payment method components](#on-payment-method-components)
|
|
41
|
+
- [Validation](#validation)
|
|
42
|
+
- [Element IDs](#element-ids)
|
|
43
|
+
- [Available Components and Methods](#available-components-and-methods)
|
|
44
|
+
- [Methods](#methods)
|
|
45
|
+
- [`createToken` Proxy Method](#createtoken-proxy-method)
|
|
46
|
+
- [`updateConfig` Method](#updateconfig-method)
|
|
47
|
+
- [The `Rebilly` Object](#the-rebilly-object)
|
|
48
|
+
- [Components](#components)
|
|
49
|
+
- [`RebillyForm`](#rebillyform)
|
|
50
|
+
- [`RebillyToken`](#rebillytoken)
|
|
51
|
+
- [Payment Method Components](#payment-method-components)
|
|
52
|
+
- [Combined Credit Card field](#combined-credit-card-field)
|
|
53
|
+
- [Separate Credit Card fields](#separate-credit-card-fields)
|
|
54
|
+
- [Separate Bank Account fields](#separate-bank-account-fields)
|
|
55
|
+
- [IBAN (International Bank Account Number) field](#iban-international-bank-account-number-field)
|
|
56
|
+
- [Props](#props)
|
|
57
|
+
- [The mounted element](#the-mounted-element)
|
|
58
|
+
- [TypeScript](#typescript)
|
|
59
|
+
- [Further Reading](#further-reading)
|
|
60
60
|
|
|
61
61
|
## FramePay Documentation
|
|
62
62
|
|
|
@@ -111,7 +111,7 @@ See here for all initialization options: https://www.rebilly.com/docs/dev-docs/f
|
|
|
111
111
|
import FramePay from '@rebilly/framepay-vue';
|
|
112
112
|
|
|
113
113
|
const configuration = {
|
|
114
|
-
|
|
114
|
+
publishableKey: 'pk_sandbox_1234567890',
|
|
115
115
|
};
|
|
116
116
|
app.use(FramePay, configuration);
|
|
117
117
|
```
|
|
@@ -122,9 +122,9 @@ Add the `publishableKey` on only the first component in the template.
|
|
|
122
122
|
|
|
123
123
|
```html
|
|
124
124
|
<rebilly-form :configuration="{ publishableKey: 'pk_sandbox_1234567890' }">
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
<input data-rebilly="firstName" />
|
|
126
|
+
<input data-rebilly="lastName" />
|
|
127
|
+
<rebilly-card></rebilly-card>
|
|
128
128
|
</rebilly-form>
|
|
129
129
|
```
|
|
130
130
|
|
|
@@ -138,29 +138,29 @@ The script will only be loaded the first time `created()` is called, so you can
|
|
|
138
138
|
|
|
139
139
|
```html
|
|
140
140
|
<template>
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
<rebilly-form>
|
|
142
|
+
<input data-rebilly="firstName" />
|
|
143
|
+
<input data-rebilly="lastName" />
|
|
144
|
+
<rebilly-card></rebilly-card>
|
|
145
|
+
</rebilly-form>
|
|
146
146
|
</template>
|
|
147
147
|
|
|
148
148
|
<script>
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
149
|
+
import FramePay, { RebillyForm, RebillyCard } from '@rebilly/framepay-vue';
|
|
150
|
+
|
|
151
|
+
export default {
|
|
152
|
+
components: {
|
|
153
|
+
RebillyForm,
|
|
154
|
+
RebillyCard,
|
|
155
|
+
},
|
|
156
|
+
created() {
|
|
157
|
+
const config = {
|
|
158
|
+
publishableKey: 'pk_sandbox_1234567890',
|
|
159
|
+
// etc
|
|
160
|
+
};
|
|
161
|
+
app.use(FramePay, config);
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
164
|
</script>
|
|
165
165
|
```
|
|
166
166
|
|
|
@@ -174,11 +174,11 @@ import FramePay from '@rebilly/framepay-vue';
|
|
|
174
174
|
import { loadFramepay } from '@rebilly/framepay';
|
|
175
175
|
|
|
176
176
|
const framepayLoaded = loadFramepay({
|
|
177
|
-
|
|
178
|
-
|
|
177
|
+
scriptLink: 'https://framepay.rebilly.com/framepay.js',
|
|
178
|
+
styleLink: 'no-style-script', // the page ships its own FramePay styles
|
|
179
179
|
}).then((framepay) => {
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
framepay.initialize({ publishableKey: 'pk_sandbox_1234567890' });
|
|
181
|
+
return framepay;
|
|
182
182
|
});
|
|
183
183
|
|
|
184
184
|
app.use(FramePay, {}, { loader: () => framepayLoaded });
|
|
@@ -225,20 +225,20 @@ The default behavior of `RebillyForm` is to intercept the regular submit event,
|
|
|
225
225
|
|
|
226
226
|
```html
|
|
227
227
|
<rebilly-form @error="" @token-ready="" :extraData="{}">
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
228
|
+
<input data-rebilly="firstName" />
|
|
229
|
+
<input data-rebilly="lastName" />
|
|
230
|
+
<rebilly-card></rebilly-card>
|
|
231
231
|
</rebilly-form>
|
|
232
232
|
|
|
233
233
|
<script>
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
234
|
+
import { RebillyForm, RebillyCard } from '@rebilly/framepay-vue';
|
|
235
|
+
|
|
236
|
+
export default {
|
|
237
|
+
components: {
|
|
238
|
+
RebillyCard,
|
|
239
|
+
RebillyForm,
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
242
|
</script>
|
|
243
243
|
```
|
|
244
244
|
|
|
@@ -258,26 +258,26 @@ If you want to perform your own logic after token creation but before form submi
|
|
|
258
258
|
|
|
259
259
|
```html
|
|
260
260
|
<rebilly-form @submit="submitHandler" @error="" :extraData="{}">
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
261
|
+
<input data-rebilly="firstName" />
|
|
262
|
+
<input data-rebilly="lastName" />
|
|
263
|
+
<rebilly-card></rebilly-card>
|
|
264
264
|
</rebilly-form>
|
|
265
265
|
|
|
266
266
|
<script>
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
267
|
+
import { RebillyForm, RebillyCard } from '@rebilly/framepay-vue';
|
|
268
|
+
|
|
269
|
+
export default {
|
|
270
|
+
components: {
|
|
271
|
+
RebillyCard,
|
|
272
|
+
RebillyForm,
|
|
273
|
+
},
|
|
274
|
+
methods: {
|
|
275
|
+
submitHandler(token, form) {
|
|
276
|
+
// do something with token
|
|
277
|
+
form.submit();
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
281
|
</script>
|
|
282
282
|
```
|
|
283
283
|
|
|
@@ -287,33 +287,33 @@ If you prefer to call `createToken()` manually, use the example below. Note that
|
|
|
287
287
|
|
|
288
288
|
```html
|
|
289
289
|
<form @submit="submitHandler">
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
290
|
+
<input data-rebilly="firstName" />
|
|
291
|
+
<input data-rebilly="lastName" />
|
|
292
|
+
<rebilly-card></rebilly-card>
|
|
293
|
+
<rebilly-token></rebilly-token>
|
|
294
294
|
</form>
|
|
295
295
|
|
|
296
296
|
<script>
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
297
|
+
import { createToken, RebillyCard, RebillyToken } from '@rebilly/framepay-vue';
|
|
298
|
+
|
|
299
|
+
export default {
|
|
300
|
+
methods: {
|
|
301
|
+
submitHandler(event) {
|
|
302
|
+
event.preventDefault();
|
|
303
|
+
const form = event.target;
|
|
304
|
+
const extraData = { } // some stuff
|
|
305
|
+
createToken(form, extraData))
|
|
306
|
+
.then((token) => {
|
|
307
|
+
// the token is already added to the form via RebillyToken
|
|
308
|
+
form.submit();
|
|
309
|
+
})
|
|
310
|
+
.catch((error) => {
|
|
311
|
+
// see error.code and error.message
|
|
312
|
+
console.log(error);
|
|
313
|
+
});
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
};
|
|
317
317
|
</script>
|
|
318
318
|
```
|
|
319
319
|
|
|
@@ -323,32 +323,32 @@ The token can also be handled entirely manually. As above, be sure to call the i
|
|
|
323
323
|
|
|
324
324
|
```html
|
|
325
325
|
<form @submit="submitHandler">
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
326
|
+
<input data-rebilly="firstName" />
|
|
327
|
+
<input data-rebilly="lastName" />
|
|
328
|
+
<rebilly-card></rebilly-card>
|
|
329
329
|
</form>
|
|
330
330
|
|
|
331
331
|
<script>
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
332
|
+
import { createToken, RebillyCard } from '@rebilly/framepay-vue';
|
|
333
|
+
|
|
334
|
+
export default {
|
|
335
|
+
methods: {
|
|
336
|
+
submitHandler(event) {
|
|
337
|
+
event.preventDefault();
|
|
338
|
+
const form = event.target;
|
|
339
|
+
const extraData = { } // some stuff
|
|
340
|
+
createToken(form, extraData))
|
|
341
|
+
.then((token) => {
|
|
342
|
+
// you must dynamically add the token id to the form
|
|
343
|
+
form.submit();
|
|
344
|
+
})
|
|
345
|
+
.catch((error) => {
|
|
346
|
+
// see error.code and error.message
|
|
347
|
+
console.log(error);
|
|
348
|
+
});
|
|
349
|
+
},
|
|
349
350
|
},
|
|
350
|
-
}
|
|
351
|
-
};
|
|
351
|
+
};
|
|
352
352
|
</script>
|
|
353
353
|
```
|
|
354
354
|
|
|
@@ -362,14 +362,14 @@ Framepay will automatically use the first payment method it detects in the form.
|
|
|
362
362
|
|
|
363
363
|
```html
|
|
364
364
|
<rebilly-form @error="" :extraData="{}">
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
365
|
+
<input data-rebilly="firstName" />
|
|
366
|
+
<input data-rebilly="lastName" />
|
|
367
|
+
<rebilly-card v-if="paymentMethod === 'payment-card'"></rebilly-card>
|
|
368
|
+
<div v-if="paymentMethod=== 'ach'">
|
|
369
|
+
<rebilly-bban-account-type></rebilly-bban-account-type>
|
|
370
|
+
<rebilly-bban-account-number></rebilly-bban-account-number>
|
|
371
|
+
<rebilly-bban-routing-number></rebilly-bban-routing-number>
|
|
372
|
+
</div>
|
|
373
373
|
</rebilly-form>
|
|
374
374
|
|
|
375
375
|
<button @click="paymentMethod = 'payment-card'">PaymentCard</button>
|
|
@@ -384,14 +384,14 @@ It is possible to use `v-show` instead, which will allow you to preserve the use
|
|
|
384
384
|
|
|
385
385
|
```html
|
|
386
386
|
<rebilly-form @error="" :extraData="{ method: paymentMethod }">
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
387
|
+
<input data-rebilly="firstName" />
|
|
388
|
+
<input data-rebilly="lastName" />
|
|
389
|
+
<rebilly-card v-show="paymentMethod === 'payment-card'"></rebilly-card>
|
|
390
|
+
<div v-show="paymentMethod=== 'ach'">
|
|
391
|
+
<rebilly-bban-account-type></rebilly-bban-account-type>
|
|
392
|
+
<rebilly-bban-account-number></rebilly-bban-account-number>
|
|
393
|
+
<rebilly-bban-routing-number></rebilly-bban-routing-number>
|
|
394
|
+
</div>
|
|
395
395
|
</rebilly-form>
|
|
396
396
|
|
|
397
397
|
<button @click="paymentMethod = 'payment-card'">PaymentCard</button>
|
|
@@ -420,10 +420,10 @@ The Google Pay, Apple Pay, and PayPal components emit `token-ready` with the tok
|
|
|
420
420
|
import { FramePayLoadError } from '@rebilly/framepay-vue';
|
|
421
421
|
|
|
422
422
|
function onFieldError(error) {
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
423
|
+
if (error instanceof FramePayLoadError) {
|
|
424
|
+
// The FramePay script, or the host's loader, failed.
|
|
425
|
+
}
|
|
426
|
+
console.error(error, error.cause);
|
|
427
427
|
}
|
|
428
428
|
```
|
|
429
429
|
|
|
@@ -437,19 +437,19 @@ Validation errors on payment method components can be detected by attaching a li
|
|
|
437
437
|
|
|
438
438
|
```html
|
|
439
439
|
<rebilly-form @error="" :extraData="{}">
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
440
|
+
<input data-rebilly="firstName" />
|
|
441
|
+
<input data-rebilly="lastName" />
|
|
442
|
+
<rebilly-card @change="changeHandler"></rebilly-card>
|
|
443
443
|
</rebilly-form>
|
|
444
444
|
|
|
445
445
|
<script>
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
446
|
+
export default {
|
|
447
|
+
methods: {
|
|
448
|
+
changeHandler(e) {
|
|
449
|
+
// e.valid, e.source, e.error
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
};
|
|
453
453
|
</script>
|
|
454
454
|
```
|
|
455
455
|
|
|
@@ -461,8 +461,8 @@ A payment method component's element has no ID unless you pass `id` as a prop to
|
|
|
461
461
|
|
|
462
462
|
```html
|
|
463
463
|
<rebilly-form>
|
|
464
|
-
|
|
465
|
-
|
|
464
|
+
<label for="card-cvv">CVV</label>
|
|
465
|
+
<rebilly-card-cvv id="card-cvv" />
|
|
466
466
|
</rebilly-form>
|
|
467
467
|
```
|
|
468
468
|
|