@paydock/client-sdk 1.127.0 → 1.128.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/README.md +1136 -3960
- package/bundles/index.cjs +292 -85
- package/bundles/index.cjs.d.ts +48 -3
- package/bundles/index.mjs +292 -85
- package/bundles/index.mjs.d.ts +48 -3
- package/bundles/types/checkout/checkout.d.ts +4 -4
- package/bundles/types/checkout/checkout.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +1 -1
- package/bundles/types/components/param.d.ts +2 -0
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/components/trigger.d.ts +2 -0
- package/bundles/types/components/trigger.d.ts.map +1 -1
- package/bundles/types/index-cba.d.ts +11 -11
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +11 -11
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +24 -2
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/index.d.ts +7 -1
- package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/interfaces.d.ts +10 -2
- package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts +15 -4
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts +2 -0
- package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/services/performance.service.d.ts +32 -0
- package/bundles/types/secure-remote-commerce/services/performance.service.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index.d.ts +6 -6
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/index.d.ts +3 -3
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +2 -2
- package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +5 -5
- package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts +4 -4
- package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts.map +1 -1
- package/bundles/types/widget/multi-widget.d.ts +8 -0
- package/bundles/types/widget/multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +292 -85
- package/bundles/widget.umd.js.d.ts +48 -3
- package/bundles/widget.umd.js.min.d.ts +48 -3
- package/bundles/widget.umd.min.js +1 -1
- package/docs/api-checkout-button.md +0 -370
- package/docs/api-widget.md +1 -2110
- package/docs/checkout-examples.md +2 -127
- package/docs/click-to-pay-examples.md +109 -0
- package/docs/click-to-pay.md +31 -1
- package/docs/license.md +1 -1
- package/docs/wallet-buttons-examples.md +3 -134
- package/docs/wallet-buttons.md +10 -10
- package/docs/wallet-cba-buttons-examples.md +1 -1
- package/package.json +1 -1
- package/slate.md +114 -524
- package/docs/api-vault-display.md +0 -94
package/slate.md
CHANGED
|
@@ -370,140 +370,9 @@ When handling errors, consider:
|
|
|
370
370
|
</html>
|
|
371
371
|
```
|
|
372
372
|
|
|
373
|
-
## Payment sources widget
|
|
374
|
-
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#payment-sources-simple-example)
|
|
375
|
-
|
|
376
|
-
This widget provides a list of previously added (saved) payment-sources by customer_id or reference.
|
|
377
|
-
The widget provides an opportunity to use events to track the process of selecting payment-sources and provide meta information about the payment-sources.
|
|
378
|
-
|
|
379
|
-
Payment-source requires a query_token that represents a pre-generated and secure token for limiting the list
|
|
380
|
-
payment-sources, for a specific user or reference.
|
|
381
|
-
|
|
382
|
-
In order to generate this token, you need to send a GET request to [getCustomerList](#get-customer-list-with-parameters)
|
|
383
|
-
where required query parameter must be id or reference. In response you get response.query_token which you can use in the widget.
|
|
384
|
-
|
|
385
|
-
## Payment sources simple example
|
|
386
|
-
|
|
387
|
-
### Container
|
|
388
|
-
|
|
389
|
-
```html
|
|
390
|
-
<div id="list"></div>
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
You must create a container for the widget. Inside this tag, the widget will be initialized
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
### Initialization
|
|
397
|
-
```javascript
|
|
398
|
-
var list = new paydock.HtmlPaymentSourceWidget('#list', 'publicKey', 'queryToken');
|
|
399
|
-
list.load();
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
```javascript
|
|
403
|
-
// ES2015 | TypeScript
|
|
404
|
-
|
|
405
|
-
import { HtmlPaymentSourceWidget } from '@paydock/client-sdk';
|
|
406
|
-
|
|
407
|
-
var list = new HtmlPaymentSourceWidget('#list', 'publicKey', 'queryToken');
|
|
408
|
-
list.load();
|
|
409
|
-
```
|
|
410
|
-
|
|
411
|
-
Then write only need 2 lines of code in js to initialize widget
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
### Full example
|
|
415
|
-
|
|
416
|
-
```html
|
|
417
|
-
<!DOCTYPE html>
|
|
418
|
-
<html lang="en">
|
|
419
|
-
<head>
|
|
420
|
-
<meta charset="UTF-8">
|
|
421
|
-
<title>Title</title>
|
|
422
|
-
<style>iframe {border: 0;width: 40%;height: 300px;}</style>
|
|
423
|
-
</head>
|
|
424
|
-
<body>
|
|
425
|
-
<div id="list"></div>
|
|
426
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
427
|
-
<script>
|
|
428
|
-
var list = new paydock.HtmlPaymentSourceWidget('#list', 'publicKey', 'queryToken');
|
|
429
|
-
list.load();
|
|
430
|
-
</script>
|
|
431
|
-
</body>
|
|
432
|
-
</html>
|
|
433
|
-
```
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
## Payment sources advanced example
|
|
437
|
-
|
|
438
|
-
### Customization
|
|
439
|
-
|
|
440
|
-
```javascript
|
|
441
|
-
list.setStyles({
|
|
442
|
-
icon_size: 'small'
|
|
443
|
-
});
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
This example shows how you can customize to your needs and design
|
|
447
|
-
|
|
448
|
-
### Settings
|
|
449
|
-
|
|
450
|
-
```javascript
|
|
451
|
-
|
|
452
|
-
list.filterByTypes(['card', 'checkout']); // filter by any payment source types
|
|
453
|
-
list.filterByGatewayIds(['gateway1']); // also other filters
|
|
454
|
-
|
|
455
|
-
list.setRefId('id'); // your unique identifier to identify the data
|
|
456
|
-
|
|
457
|
-
list.setLimit(4); // Pagination elements will show if count of elements more then argument passed
|
|
458
|
-
|
|
459
|
-
list.onSelectInsert('input[name="ps_id"]', 'payment_source_id'); // insert one-time-token to your input after finish checkout
|
|
460
|
-
|
|
461
|
-
list.on('select', function(data) {
|
|
462
|
-
console.log(data);
|
|
463
|
-
});
|
|
464
|
-
```
|
|
465
|
-
|
|
466
|
-
This example shows how you can use a lot of other methods to settings your form
|
|
467
|
-
|
|
468
|
-
### Full example
|
|
469
|
-
|
|
470
|
-
```html
|
|
471
|
-
<!DOCTYPE html>
|
|
472
|
-
<html lang="en">
|
|
473
|
-
<head>
|
|
474
|
-
<meta charset="UTF-8">
|
|
475
|
-
<title>Title</title>
|
|
476
|
-
<style>iframe {border: 0;width: 40%;height: 300px;}</style>
|
|
477
|
-
</head>
|
|
478
|
-
<body>
|
|
479
|
-
<div id="list"></div>
|
|
480
|
-
<input type="text" name="ps_id" />
|
|
481
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
482
|
-
<script>
|
|
483
|
-
var list = new paydock.HtmlPaymentSourceWidget('#list', 'publicKey', 'queryToken');
|
|
484
|
-
list.filterByTypes(['card', 'checkout']);
|
|
485
|
-
list.filterByGatewayIds(['gateway1']);
|
|
486
|
-
list.setRefId('id');
|
|
487
|
-
list.setLimit(4);
|
|
488
|
-
list.setStyles({
|
|
489
|
-
icon_size: 'small'
|
|
490
|
-
});
|
|
491
|
-
|
|
492
|
-
list.load();
|
|
493
|
-
|
|
494
|
-
list.onSelectInsert('input[name="ps_id"]', 'payment_source_id');
|
|
495
|
-
list.on('select', function(data) {
|
|
496
|
-
console.log(data);
|
|
497
|
-
});
|
|
498
|
-
</script>
|
|
499
|
-
</body>
|
|
500
|
-
</html>
|
|
501
|
-
```
|
|
502
|
-
|
|
503
373
|
## Checkout button
|
|
504
374
|
|
|
505
375
|
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#cb_CheckoutButton)
|
|
506
|
-
PayPal meta parameters description [here](https://www.npmjs.com/package/@paydock/client-sdk#ipaypalmeta)
|
|
507
376
|
Zipmoney meta parameters description [here](https://www.npmjs.com/package/@paydock/client-sdk#izipmoneymeta)
|
|
508
377
|
|
|
509
378
|
This widget allows you to turn your button into a full Checkout Button.
|
|
@@ -526,96 +395,18 @@ You must create a button to turn it into checkout-button
|
|
|
526
395
|
|
|
527
396
|
### Initialization
|
|
528
397
|
```javascript
|
|
529
|
-
var button = new paydock.
|
|
398
|
+
var button = new paydock.ZipmoneyCheckoutButton('#button', 'publicKey', 'gatewayId');
|
|
530
399
|
```
|
|
531
400
|
|
|
532
401
|
```javascript
|
|
533
402
|
// ES2015 | TypeScript
|
|
534
403
|
|
|
535
404
|
|
|
536
|
-
var button = new
|
|
405
|
+
var button = new ZipmoneyCheckoutButton('#button', 'publicKey');
|
|
537
406
|
```
|
|
538
407
|
|
|
539
408
|
Then write only need 1 line of code in js to initialize widget
|
|
540
409
|
|
|
541
|
-
|
|
542
|
-
### Full example
|
|
543
|
-
|
|
544
|
-
```html
|
|
545
|
-
<!DOCTYPE html>
|
|
546
|
-
<html lang="en">
|
|
547
|
-
<head>
|
|
548
|
-
<meta charset="UTF-8">
|
|
549
|
-
<title>Title</title>
|
|
550
|
-
</head>
|
|
551
|
-
<body>
|
|
552
|
-
<button type="button" id="button">checkout</button>
|
|
553
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
554
|
-
<script>
|
|
555
|
-
var button = new paydock.PaypalCheckoutButton('#button', 'publicKey');
|
|
556
|
-
</script>
|
|
557
|
-
</body>
|
|
558
|
-
</html>
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
## Checkout button advanced example
|
|
563
|
-
|
|
564
|
-
### Optional methods
|
|
565
|
-
|
|
566
|
-
```javascript
|
|
567
|
-
button.onFinishInsert('input[name="pst"]', 'payment_source_token'); // insert one-time-token to your input after finish checkout
|
|
568
|
-
|
|
569
|
-
button.setMeta({
|
|
570
|
-
brand_name: 'Paydock',
|
|
571
|
-
reference: '15',
|
|
572
|
-
first_name: 'receiver-name',
|
|
573
|
-
last_name: 'receiver-last-name',
|
|
574
|
-
phone: '9379992'}); // settings for checkout pages
|
|
575
|
-
|
|
576
|
-
button.on('finish', function (data) { // Add handler of event
|
|
577
|
-
console.log('on:finish', data);
|
|
578
|
-
});
|
|
579
|
-
```
|
|
580
|
-
|
|
581
|
-
This example shows how you can use a lot of other methods to settings your button
|
|
582
|
-
|
|
583
|
-
### Full Paypal example
|
|
584
|
-
|
|
585
|
-
```html
|
|
586
|
-
<!DOCTYPE html>
|
|
587
|
-
<html lang="en">
|
|
588
|
-
<head>
|
|
589
|
-
<meta charset="UTF-8">
|
|
590
|
-
<title>Title</title>
|
|
591
|
-
</head>
|
|
592
|
-
<body>
|
|
593
|
-
<form id="paymentForm">
|
|
594
|
-
<button type="button" id="button">
|
|
595
|
-
<img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;">
|
|
596
|
-
</button>
|
|
597
|
-
</form>
|
|
598
|
-
|
|
599
|
-
<input type="text" name="pst" />
|
|
600
|
-
|
|
601
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
602
|
-
<script>
|
|
603
|
-
var button = new paydock.PaypalCheckoutButton('#button', 'publicKey', 'gatewayId');
|
|
604
|
-
button.onFinishInsert('input[name="pst"]', 'payment_source_token');
|
|
605
|
-
button.setMeta({
|
|
606
|
-
brand_name: 'Paydock',
|
|
607
|
-
reference: '15',
|
|
608
|
-
first_name: 'Joshua',
|
|
609
|
-
last_name: 'Wood',
|
|
610
|
-
phone: '0231049872'});
|
|
611
|
-
|
|
612
|
-
button.on('finish', function (data) {
|
|
613
|
-
console.log('on:finish', data);
|
|
614
|
-
});
|
|
615
|
-
</script>
|
|
616
|
-
</body>
|
|
617
|
-
</html>
|
|
618
|
-
```
|
|
619
410
|
### Full ZipMoney example
|
|
620
411
|
|
|
621
412
|
```html
|
|
@@ -703,52 +494,6 @@ This example shows how you can use a lot of other methods to settings your butto
|
|
|
703
494
|
</html>
|
|
704
495
|
```
|
|
705
496
|
|
|
706
|
-
### Full Aftepay example
|
|
707
|
-
|
|
708
|
-
```html
|
|
709
|
-
<!DOCTYPE html>
|
|
710
|
-
<html lang="en">
|
|
711
|
-
<head>
|
|
712
|
-
<meta charset="UTF-8">
|
|
713
|
-
<title>Title</title>
|
|
714
|
-
</head>
|
|
715
|
-
<body>
|
|
716
|
-
<button type="button" id="button">
|
|
717
|
-
<img src="https://daepxvbfwwgd0.cloudfront.net/assets/logo_scroll-0c43312c5845a0dcd7a3373325da6402bc1d635d3415af28ed40d6c1b48e3d5c.png" align="left" style="margin-right:7px;">
|
|
718
|
-
</button>
|
|
719
|
-
|
|
720
|
-
<input type="text" name="pst" />
|
|
721
|
-
|
|
722
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
723
|
-
<script>
|
|
724
|
-
var button = new paydock.AfterpayCheckoutButton('#button', 'publicKey', 'gatewayId');
|
|
725
|
-
|
|
726
|
-
button.onFinishInsert('input[name="pst"]', 'payment_source_token');
|
|
727
|
-
button.showEnhancedTrackingProtectionPopup(true);
|
|
728
|
-
button.setMeta({
|
|
729
|
-
amount: "100",
|
|
730
|
-
currency: "AUD",
|
|
731
|
-
reference: 'Vitae commodi provident assumenda',
|
|
732
|
-
email: 'wanda.mertz@example.com',
|
|
733
|
-
first_name: 'Wanda',
|
|
734
|
-
last_name: 'Mertz',
|
|
735
|
-
address_line: '61426 Osvaldo Plains',
|
|
736
|
-
address_line2: 'Apt. 276',
|
|
737
|
-
address_city: 'Lake Robyn',
|
|
738
|
-
address_state: 'WY',
|
|
739
|
-
address_postcode: '07396',
|
|
740
|
-
address_country: 'Australia',
|
|
741
|
-
phone: '0412345678',
|
|
742
|
-
});
|
|
743
|
-
|
|
744
|
-
button.on('finish', function (data) {
|
|
745
|
-
console.log('on:finish', data);
|
|
746
|
-
});
|
|
747
|
-
</script>
|
|
748
|
-
</body>
|
|
749
|
-
</html>
|
|
750
|
-
```
|
|
751
|
-
|
|
752
497
|
## Api
|
|
753
498
|
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#api)
|
|
754
499
|
|
|
@@ -1058,144 +803,11 @@ After you initialized the standalone 3ds charge via `v1/charges/standalone-3ds`
|
|
|
1058
803
|
| <code>error</code> | <code>object</code> | error response |
|
|
1059
804
|
| <code>charge_3ds_id</code> | <code>string</code> | Universal unique transaction identifier to identify the transaction |
|
|
1060
805
|
|
|
1061
|
-
## Vault Display Widget
|
|
1062
|
-
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#vault-display-widget)
|
|
1063
|
-
|
|
1064
|
-
The vault display form allows viewing card number and CVV. The form can be customised according to your needs.
|
|
1065
|
-
You can set styles as well as subscribe to widget events that help monitor user’s actions in real time.
|
|
1066
|
-
|
|
1067
|
-
## Vault Display Widget simple example
|
|
1068
|
-
|
|
1069
|
-
### Container
|
|
1070
|
-
|
|
1071
|
-
```html
|
|
1072
|
-
<div id="widget"></div>
|
|
1073
|
-
```
|
|
1074
|
-
|
|
1075
|
-
You must create a container for the widget. Inside this tag, the widget will be initialized
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
### Initialization
|
|
1079
|
-
```javascript
|
|
1080
|
-
var widget = new paydock.VaultDisplayWidget('#widget', 'token');
|
|
1081
|
-
widget.load();
|
|
1082
|
-
```
|
|
1083
|
-
|
|
1084
|
-
```javascript
|
|
1085
|
-
// ES2015 | TypeScript
|
|
1086
|
-
|
|
1087
|
-
import { VaultDisplayWidget } from '@paydock/client-sdk';
|
|
1088
|
-
|
|
1089
|
-
var widget = new VaultDisplayWidget('#widget', 'token');
|
|
1090
|
-
widget.load();
|
|
1091
|
-
```
|
|
1092
|
-
|
|
1093
|
-
Then write only need 2 lines of code in js to initialize widget
|
|
1094
|
-
|
|
1095
|
-
### Full example
|
|
1096
|
-
|
|
1097
|
-
```html
|
|
1098
|
-
<!DOCTYPE html>
|
|
1099
|
-
<html lang="en">
|
|
1100
|
-
<head>
|
|
1101
|
-
<meta charset="UTF-8">
|
|
1102
|
-
<title>Title</title>
|
|
1103
|
-
<style>iframe {border: 0;width: 100%;height: 300px;}</style>
|
|
1104
|
-
</head>
|
|
1105
|
-
<body>
|
|
1106
|
-
|
|
1107
|
-
<div id="widget"></div>
|
|
1108
|
-
|
|
1109
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
1110
|
-
<script>
|
|
1111
|
-
var widget = new paydock.VaultDisplayWidget('#widget', 'token');
|
|
1112
|
-
widget.load();
|
|
1113
|
-
</script>
|
|
1114
|
-
</body>
|
|
1115
|
-
</html>
|
|
1116
|
-
```
|
|
1117
|
-
|
|
1118
|
-
## Widget advanced example
|
|
1119
|
-
|
|
1120
|
-
### Customization
|
|
1121
|
-
|
|
1122
|
-
```javascript
|
|
1123
|
-
widget.setEnv('sandbox');
|
|
1124
|
-
|
|
1125
|
-
widget.on('after_load', function (data) {
|
|
1126
|
-
console.log(data);
|
|
1127
|
-
});
|
|
1128
|
-
|
|
1129
|
-
widget.on('cvv_secure_code_requested', function (data) {
|
|
1130
|
-
console.log(data);
|
|
1131
|
-
});
|
|
1132
|
-
|
|
1133
|
-
widget.on('card_number_secure_code_requested', function (data) {
|
|
1134
|
-
console.log(data);
|
|
1135
|
-
});
|
|
1136
|
-
|
|
1137
|
-
widget.setStyles({
|
|
1138
|
-
background_color: 'rgb(0, 0, 0)',
|
|
1139
|
-
border_color: 'yellow',
|
|
1140
|
-
text_color: '#FFFFAA',
|
|
1141
|
-
button_color: 'rgba(255, 255, 255, 0.9)',
|
|
1142
|
-
font_size: '20px'
|
|
1143
|
-
});
|
|
1144
|
-
```
|
|
1145
|
-
|
|
1146
|
-
This example shows how you can use a lot of other methods to settings your form
|
|
1147
|
-
|
|
1148
|
-
### Full example
|
|
1149
|
-
|
|
1150
|
-
```html
|
|
1151
|
-
<!DOCTYPE html>
|
|
1152
|
-
<html lang="en">
|
|
1153
|
-
<head>
|
|
1154
|
-
<meta charset="UTF-8">
|
|
1155
|
-
<title>Title</title>
|
|
1156
|
-
<style>iframe {border: 0;width: 40%;height: 450px;}</style>
|
|
1157
|
-
</head>
|
|
1158
|
-
<body>
|
|
1159
|
-
|
|
1160
|
-
<div id="widget"></div>
|
|
1161
|
-
|
|
1162
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
1163
|
-
<script>
|
|
1164
|
-
var widget = new paydock.VaultDisplayWidget('#widget', 'token');
|
|
1165
|
-
|
|
1166
|
-
widget.setEnv('sandbox');
|
|
1167
|
-
|
|
1168
|
-
widget.on('after_load', function (data) {
|
|
1169
|
-
console.log(data);
|
|
1170
|
-
});
|
|
1171
|
-
|
|
1172
|
-
widget.on('cvv_secure_code_requested', function (data) {
|
|
1173
|
-
console.log(data);
|
|
1174
|
-
});
|
|
1175
|
-
|
|
1176
|
-
widget.on('card_number_secure_code_requested', function (data) {
|
|
1177
|
-
console.log(data);
|
|
1178
|
-
});
|
|
1179
|
-
|
|
1180
|
-
widget.setStyles({
|
|
1181
|
-
background_color: 'rgb(0, 0, 0)',
|
|
1182
|
-
border_color: 'yellow',
|
|
1183
|
-
text_color: '#FFFFAA',
|
|
1184
|
-
button_color: 'rgba(255, 255, 255, 0.9)',
|
|
1185
|
-
font_size: '20px'
|
|
1186
|
-
});
|
|
1187
|
-
|
|
1188
|
-
widget.load();
|
|
1189
|
-
</script>
|
|
1190
|
-
</body>
|
|
1191
|
-
</html>
|
|
1192
|
-
```
|
|
1193
|
-
|
|
1194
806
|
## Wallet Buttons
|
|
1195
807
|
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#wallet-buttons-simple-example)
|
|
1196
808
|
|
|
1197
809
|
Wallet Buttons allow you to easily integrate different E-Wallets into your checkout.
|
|
1198
|
-
Currently supports ApplePay, Google Pay, Google Pay and Apple Pay via Stripe
|
|
810
|
+
Currently supports ApplePay, Google Pay, Google Pay and Apple Pay via Stripe and Flypay V2 checkout, Paypal Smart Buttons Checkout and Afterpay.
|
|
1199
811
|
|
|
1200
812
|
If available in your client environment, you will display a simple button that upon clicking it the user will follow the standard flow for the appropriate Wallet. If not available an event will be raised and no button will be displayed.
|
|
1201
813
|
|
|
@@ -1212,55 +824,6 @@ You must create a container for the Wallet Buttons. Inside this tag, the button
|
|
|
1212
824
|
Before initializing the button, you must perform a POST request to `charges/wallet` from a secure environment like your server. This call will return a token that is required to load the button and securely complete the payment. You can find the documentation to this call in the PayDock API documentation.
|
|
1213
825
|
|
|
1214
826
|
### Initialization
|
|
1215
|
-
The following is the minimum required initialization parameters for Apple Pay and Google Pay via Stripe:
|
|
1216
|
-
```javascript
|
|
1217
|
-
let button = new paydock.WalletButtons(
|
|
1218
|
-
"#widget",
|
|
1219
|
-
token,
|
|
1220
|
-
{
|
|
1221
|
-
amount_label: "Total",
|
|
1222
|
-
country: "DE",
|
|
1223
|
-
}
|
|
1224
|
-
);
|
|
1225
|
-
button.load();
|
|
1226
|
-
```
|
|
1227
|
-
|
|
1228
|
-
```javascript
|
|
1229
|
-
// ES2015 | TypeScript
|
|
1230
|
-
import { WalletButtons } from '@paydock/client-sdk';
|
|
1231
|
-
|
|
1232
|
-
var button = new WalletButtons(
|
|
1233
|
-
'#widget',
|
|
1234
|
-
token,
|
|
1235
|
-
{
|
|
1236
|
-
amount_label: 'Total',
|
|
1237
|
-
country: 'DE',
|
|
1238
|
-
}
|
|
1239
|
-
);
|
|
1240
|
-
button.load();
|
|
1241
|
-
```
|
|
1242
|
-
|
|
1243
|
-
Flypay and Paypal wallets do not require any meta sent to the wallet, so the following is enough for initialization:
|
|
1244
|
-
```javascript
|
|
1245
|
-
let button = new paydock.WalletButtons(
|
|
1246
|
-
"#widget",
|
|
1247
|
-
token,
|
|
1248
|
-
{}
|
|
1249
|
-
);
|
|
1250
|
-
button.load();
|
|
1251
|
-
```
|
|
1252
|
-
|
|
1253
|
-
```javascript
|
|
1254
|
-
// ES2015 | TypeScript
|
|
1255
|
-
import { WalletButtons } from '@paydock/client-sdk';
|
|
1256
|
-
|
|
1257
|
-
var button = new WalletButtons(
|
|
1258
|
-
'#widget',
|
|
1259
|
-
token,
|
|
1260
|
-
{}
|
|
1261
|
-
);
|
|
1262
|
-
button.load();
|
|
1263
|
-
```
|
|
1264
827
|
|
|
1265
828
|
For Afterpay wallet, the country code is required:
|
|
1266
829
|
```javascript
|
|
@@ -1361,14 +924,6 @@ If the customer's browser is not supported, or the customer does not have any ca
|
|
|
1361
924
|
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
1362
925
|
```
|
|
1363
926
|
|
|
1364
|
-
### Forcibly closing the checkout
|
|
1365
|
-
|
|
1366
|
-
In some situations you may want to forcibly close the checkout so that your user is back in your checkout screen, fow which you can use this method. Currently supported by Flypay wallet only.
|
|
1367
|
-
|
|
1368
|
-
```javascript
|
|
1369
|
-
button.close();
|
|
1370
|
-
```
|
|
1371
|
-
|
|
1372
927
|
### Performing actions when the wallet button is clicked
|
|
1373
928
|
|
|
1374
929
|
In some situations you may want to perform some validations or actions when the user clicks on the wallet button, for which you can use this method. Currently supported by Paypal, ApplePay and GooglePay wallets.
|
|
@@ -1379,7 +934,7 @@ button.onClick(() => console.log("Perform actions on button click"));
|
|
|
1379
934
|
|
|
1380
935
|
### Performing actions when shipping info is updated
|
|
1381
936
|
|
|
1382
|
-
In
|
|
937
|
+
In Paypal, ApplePay via MPGS and GooglePay via MPGS integrations after each shipping info update the `onUpdate(data)` will be called with the selected shipping address information, plus selected shipping method when applicable for Paypal, ApplePay and GooglePay. Merchants should handle this callback, recalculate shipping costs in their server by analyzing the new data, and submit a backend to backend request to `POST charges/:id` with the new total amount and shipping amount (you can find the documentation of this call in the PayDock API documentation).
|
|
1383
938
|
|
|
1384
939
|
For Paypal integration specifically, if shipping is enabled for the wallet button and different shipping methods were provided in the create wallet charge call, Merchants must ensure that the posted `shipping.amount` to `POST charges/:id` matches the selected shipping option amount (value sent in when initializing the wallet charge). In other words, when providing shipping methods the shipping amount is bound to being one of the provided shipping method amount necessarily. Bear in mind that the total charge amount must include the `shipping.amount`, since it represents the full amount to be charged to the customer.
|
|
1385
940
|
|
|
@@ -1446,47 +1001,11 @@ of the corresponding event names.
|
|
|
1446
1001
|
|
|
1447
1002
|
```javascript
|
|
1448
1003
|
button.on(EVENT.UNAVAILABLE, () => console.log("No wallet buttons available"));
|
|
1449
|
-
button.on(EVENT.UPDATE, (data) => console.log("Updating amount via a backend to backend call to POST charges/:id");
|
|
1004
|
+
button.on(EVENT.UPDATE, (data) => console.log("Updating amount via a backend to backend call to POST charges/:id"));
|
|
1450
1005
|
button.on(EVENT.PAYMENT_SUCCESSFUL, (data) => console.log("The payment was successful"));
|
|
1451
1006
|
button.on(EVENT.PAYMENT_ERROR, (data) => console.log("The payment was not successful"));
|
|
1452
1007
|
```
|
|
1453
1008
|
|
|
1454
|
-
This example shows how to use these functions for **Apple and Google Pay via Stripe**:
|
|
1455
|
-
_(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `wallets`)_
|
|
1456
|
-
### Apple and Google Pay via Stripe Full example
|
|
1457
|
-
|
|
1458
|
-
```html
|
|
1459
|
-
<!DOCTYPE html>
|
|
1460
|
-
<html lang="en">
|
|
1461
|
-
<head>
|
|
1462
|
-
<meta charset="UTF-8">
|
|
1463
|
-
<title>Title</title>
|
|
1464
|
-
</head>
|
|
1465
|
-
<body>
|
|
1466
|
-
<h2>Payment using PayDock Wallet Button!</h2>
|
|
1467
|
-
<div id="widget"></div>
|
|
1468
|
-
</body>
|
|
1469
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
1470
|
-
<script>
|
|
1471
|
-
let button = new paydock.WalletButtons(
|
|
1472
|
-
"#widget",
|
|
1473
|
-
charge_token,
|
|
1474
|
-
{
|
|
1475
|
-
amount_label: "Total",
|
|
1476
|
-
country: "DE",
|
|
1477
|
-
wallets: ["google", "apple"],
|
|
1478
|
-
}
|
|
1479
|
-
);
|
|
1480
|
-
button.setEnv('sandbox');
|
|
1481
|
-
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
1482
|
-
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
1483
|
-
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
1484
|
-
button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
|
|
1485
|
-
button.load();
|
|
1486
|
-
</script>
|
|
1487
|
-
</html>
|
|
1488
|
-
```
|
|
1489
|
-
|
|
1490
1009
|
This example shows how to use these functions for **Paypal Smart Checkout Buttons**:
|
|
1491
1010
|
_(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_later`, `standalone`, `style`)_
|
|
1492
1011
|
### Paypal Smart Checkout Buttons Full example
|
|
@@ -1554,44 +1073,6 @@ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_l
|
|
|
1554
1073
|
</html>
|
|
1555
1074
|
```
|
|
1556
1075
|
|
|
1557
|
-
This example shows how to use these functions for **Flypay v1 Wallet**.
|
|
1558
|
-
_(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_later`, `style`)_
|
|
1559
|
-
### Flypay Full example
|
|
1560
|
-
```html
|
|
1561
|
-
<!DOCTYPE html>
|
|
1562
|
-
<html lang="en">
|
|
1563
|
-
<head>
|
|
1564
|
-
<meta charset="UTF-8">
|
|
1565
|
-
<title>Title</title>
|
|
1566
|
-
</head>
|
|
1567
|
-
<body>
|
|
1568
|
-
<h2>Payment using PayDock Wallet Button!</h2>
|
|
1569
|
-
<div id="widget"></div>
|
|
1570
|
-
</body>
|
|
1571
|
-
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
1572
|
-
<script>
|
|
1573
|
-
let button = new paydock.WalletButtons(
|
|
1574
|
-
"#widget",
|
|
1575
|
-
charge_token,
|
|
1576
|
-
{
|
|
1577
|
-
request_shipping: true
|
|
1578
|
-
}
|
|
1579
|
-
);
|
|
1580
|
-
button.setEnv('sandbox');
|
|
1581
|
-
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
1582
|
-
button.onUpdate((data) => {
|
|
1583
|
-
console.log("Updating amount via a backend to backend call to POST charges/:id");
|
|
1584
|
-
// call `POST charges/:id` to modify charge
|
|
1585
|
-
button.update({ success: true });
|
|
1586
|
-
});
|
|
1587
|
-
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
1588
|
-
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
1589
|
-
button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
|
|
1590
|
-
button.load();
|
|
1591
|
-
</script>
|
|
1592
|
-
</html>
|
|
1593
|
-
```
|
|
1594
|
-
|
|
1595
1076
|
This example shows how to use these functions for **Flypay v2 Wallet**.
|
|
1596
1077
|
_(Required `meta` fields: - . Optional `meta` fields: -)_
|
|
1597
1078
|
### Flypay V2 Full example
|
|
@@ -2062,6 +1543,115 @@ src.setStyles({
|
|
|
2062
1543
|
});
|
|
2063
1544
|
```
|
|
2064
1545
|
|
|
1546
|
+
## Configurations for background loading and improved User Load times
|
|
1547
|
+
|
|
1548
|
+
### hold_for_customer_data
|
|
1549
|
+
When set to `true`, this flag allows you to load the Click to Pay iframe in the background while collecting customer information. This improves the perceived performance by starting the iframe load process early.
|
|
1550
|
+
|
|
1551
|
+
```javascript
|
|
1552
|
+
const clickToPay = new cba.ClickToPay("#checkoutIframe", SERVICE_ID, PUBLIC_KEY, {
|
|
1553
|
+
hold_for_customer_data: true,
|
|
1554
|
+
dpa_config: {
|
|
1555
|
+
dpa_id: DPA_ID,
|
|
1556
|
+
// ... other config
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
```
|
|
1560
|
+
|
|
1561
|
+
### injectCustomerData(customer)
|
|
1562
|
+
Once you have collected the customer information, use this method to provide it to the Click to Pay iframe. This will trigger the checkout to continue.
|
|
1563
|
+
|
|
1564
|
+
```javascript
|
|
1565
|
+
clickToPay.injectCustomerData({
|
|
1566
|
+
email: "customer@example.com",
|
|
1567
|
+
first_name: "John",
|
|
1568
|
+
last_name: "Doe",
|
|
1569
|
+
phone: "+61400123456" // Include country code
|
|
1570
|
+
});
|
|
1571
|
+
```
|
|
1572
|
+
|
|
1573
|
+
### Background Loading Example
|
|
1574
|
+
Here's a complete example showing how to implement background loading while collecting customer information:
|
|
1575
|
+
|
|
1576
|
+
```javascript
|
|
1577
|
+
// 1. Initialize with hold_for_customer_data
|
|
1578
|
+
const clickToPay = new cba.ClickToPay("#checkoutIframe", SERVICE_ID, PUBLIC_KEY, {
|
|
1579
|
+
hold_for_customer_data: true,
|
|
1580
|
+
dpa_config: {
|
|
1581
|
+
dpa_id: DPA_ID,
|
|
1582
|
+
// ... other config
|
|
1583
|
+
}
|
|
1584
|
+
});
|
|
1585
|
+
|
|
1586
|
+
// Hide checkout and show form initially
|
|
1587
|
+
document.getElementById("checkoutIframe").style.display = 'none';
|
|
1588
|
+
document.getElementById("customerForm").style.display = 'block';
|
|
1589
|
+
document.getElementById("loader").style.display = 'none';
|
|
1590
|
+
|
|
1591
|
+
// 2. Setup event handlers
|
|
1592
|
+
clickToPay.on('iframeLoaded', () => {
|
|
1593
|
+
// Iframe is now loaded
|
|
1594
|
+
});
|
|
1595
|
+
|
|
1596
|
+
clickToPay.on('checkoutReady', () => {
|
|
1597
|
+
// Hide loader, show checkout
|
|
1598
|
+
document.getElementById("loader").style.display = 'none';
|
|
1599
|
+
document.getElementById("checkoutIframe").style.display = 'block';
|
|
1600
|
+
clickToPay.showCheckout();
|
|
1601
|
+
});
|
|
1602
|
+
|
|
1603
|
+
// 3. Start loading in background
|
|
1604
|
+
clickToPay.load();
|
|
1605
|
+
|
|
1606
|
+
// 4. Handle form submission
|
|
1607
|
+
document.getElementById("submitButton").addEventListener("click", (e) => {
|
|
1608
|
+
e.preventDefault();
|
|
1609
|
+
|
|
1610
|
+
const customer = {
|
|
1611
|
+
email: document.getElementById("email").value.trim(),
|
|
1612
|
+
first_name: document.getElementById("firstName").value.trim(),
|
|
1613
|
+
last_name: document.getElementById("lastName").value.trim(),
|
|
1614
|
+
phone: document.getElementById("phone").value.trim()
|
|
1615
|
+
};
|
|
1616
|
+
|
|
1617
|
+
// Hide form, show loader
|
|
1618
|
+
document.getElementById("customerForm").style.display = "none";
|
|
1619
|
+
document.getElementById("loader").style.display = "flex";
|
|
1620
|
+
|
|
1621
|
+
try {
|
|
1622
|
+
// Inject customer data to continue checkout
|
|
1623
|
+
clickToPay.injectCustomerData(customer);
|
|
1624
|
+
} catch (error) {
|
|
1625
|
+
// Show form again on error
|
|
1626
|
+
document.getElementById("customerForm").style.display = "block";
|
|
1627
|
+
document.getElementById("loader").style.display = "none";
|
|
1628
|
+
alert("An error occurred. Please try again.");
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
```
|
|
1632
|
+
|
|
1633
|
+
#### HTML Structure
|
|
1634
|
+
Here's the required HTML structure for the background loading example:
|
|
1635
|
+
|
|
1636
|
+
```html
|
|
1637
|
+
<!-- Click to Pay iframe container -->
|
|
1638
|
+
<div id="checkoutIframe"></div>
|
|
1639
|
+
|
|
1640
|
+
<!-- Customer information form -->
|
|
1641
|
+
<form id="customerForm">
|
|
1642
|
+
<input type="email" id="email" placeholder="Email" required>
|
|
1643
|
+
<input type="text" id="firstName" placeholder="First Name" required>
|
|
1644
|
+
<input type="text" id="lastName" placeholder="Last Name" required>
|
|
1645
|
+
<input type="tel" id="phone" placeholder="Phone (with country code)" required>
|
|
1646
|
+
<button type="submit" id="submitButton">Continue to Checkout</button>
|
|
1647
|
+
</form>
|
|
1648
|
+
|
|
1649
|
+
<!-- Loading indicator -->
|
|
1650
|
+
<div id="loader" style="display: none;">
|
|
1651
|
+
Loading...
|
|
1652
|
+
</div>
|
|
1653
|
+
```
|
|
1654
|
+
|
|
2065
1655
|
# Fraud prevention
|
|
2066
1656
|
|
|
2067
1657
|
The Fraud Prevention module allows you to add security layers to your payment workflows
|