@paydock/client-sdk 1.11.2-beta → 1.11.4
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 +999 -474
- package/bundles/widget.umd.js +501 -1
- package/bundles/widget.umd.min.js +1 -1
- package/lib/api/api-internal.d.ts +2 -0
- package/lib/api/api-internal.js +4 -0
- package/lib/api/api-internal.js.map +1 -1
- package/lib/api/api-service-internal.d.ts +17 -0
- package/lib/api/api-service-internal.js +18 -0
- package/lib/api/api-service-internal.js.map +1 -0
- package/lib/canvas-3ds/services/gpayments-service.js +1 -1
- package/lib/canvas-3ds/services/gpayments-service.js.map +1 -1
- package/lib/components/iframe-event.d.ts +3 -0
- package/lib/components/iframe-event.js +2 -0
- package/lib/components/iframe-event.js.map +1 -1
- package/lib/components/link.d.ts +4 -2
- package/lib/components/link.js +4 -0
- package/lib/components/link.js.map +1 -1
- package/lib/components/param.d.ts +6 -0
- package/lib/components/param.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/secure-remote-commerce/index.d.ts +1 -0
- package/lib/secure-remote-commerce/index.js +2 -0
- package/lib/secure-remote-commerce/index.js.map +1 -0
- package/lib/secure-remote-commerce/interfaces.d.ts +71 -0
- package/lib/secure-remote-commerce/interfaces.js +28 -0
- package/lib/secure-remote-commerce/interfaces.js.map +1 -0
- package/lib/secure-remote-commerce/providers/src-provider.d.ts +10 -0
- package/lib/secure-remote-commerce/providers/src-provider.js +1 -0
- package/lib/secure-remote-commerce/providers/src-provider.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/helper.d.ts +7 -0
- package/lib/secure-remote-commerce/providers/visa-src/helper.js +36 -0
- package/lib/secure-remote-commerce/providers/visa-src/helper.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.d.ts +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.js +2 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.d.ts +27 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.js +106 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +8 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js +10 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js.map +1 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.d.ts +162 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.js +237 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.js.map +1 -0
- package/package.json +1 -1
- package/slate.md +261 -3
package/slate.md
CHANGED
|
@@ -1081,7 +1081,7 @@ button.load();
|
|
|
1081
1081
|
|
|
1082
1082
|
```javascript--es2015
|
|
1083
1083
|
// ES2015 | TypeScript
|
|
1084
|
-
import { WalletButtons } from '@paydock/client-sdk
|
|
1084
|
+
import { WalletButtons } from '@paydock/client-sdk';
|
|
1085
1085
|
|
|
1086
1086
|
var button = new WalletButtons(
|
|
1087
1087
|
'#widget',
|
|
@@ -1106,7 +1106,7 @@ button.load();
|
|
|
1106
1106
|
|
|
1107
1107
|
```javascript--es2015
|
|
1108
1108
|
// ES2015 | TypeScript
|
|
1109
|
-
import { WalletButtons } from '@paydock/client-sdk
|
|
1109
|
+
import { WalletButtons } from '@paydock/client-sdk';
|
|
1110
1110
|
|
|
1111
1111
|
var button = new WalletButtons(
|
|
1112
1112
|
'#widget',
|
|
@@ -1476,4 +1476,262 @@ Also, for **ApplePay via MPGS** you can initialize the `ApplePayPaymentRequest`
|
|
|
1476
1476
|
button.load();
|
|
1477
1477
|
</script>
|
|
1478
1478
|
</html>
|
|
1479
|
-
```
|
|
1479
|
+
```
|
|
1480
|
+
## Secure Remote Commerce
|
|
1481
|
+
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#SRC).
|
|
1482
|
+
|
|
1483
|
+
This widget provides you with the ability to easily integrate with SRC providers. Currently Visa SRC is supported.
|
|
1484
|
+
|
|
1485
|
+
## SRC simple example
|
|
1486
|
+
|
|
1487
|
+
### Container
|
|
1488
|
+
|
|
1489
|
+
```html
|
|
1490
|
+
<div id="checkoutButton"></div>
|
|
1491
|
+
<div id="checkoutIframe"></div>
|
|
1492
|
+
```
|
|
1493
|
+
|
|
1494
|
+
You must create a container for the initial checkout button, and a different one for the checkout iFrame. Inside the first tag the button will be initialized, and inside the second one the iFrame will be loaded once the button is clicked.
|
|
1495
|
+
|
|
1496
|
+
|
|
1497
|
+
### Initialization
|
|
1498
|
+
```javascript
|
|
1499
|
+
var src = new paydock.SRC(
|
|
1500
|
+
"#checkoutButton",
|
|
1501
|
+
"#checkoutIframe",
|
|
1502
|
+
"scheme_service_id",
|
|
1503
|
+
"paydock_public_key_or_access_token",
|
|
1504
|
+
{}, // meta
|
|
1505
|
+
);
|
|
1506
|
+
src.load();
|
|
1507
|
+
```
|
|
1508
|
+
|
|
1509
|
+
```javascript--es2015
|
|
1510
|
+
// ES2015 | TypeScript
|
|
1511
|
+
|
|
1512
|
+
import { SRC } from '@paydock/client-sdk';
|
|
1513
|
+
|
|
1514
|
+
var src = new SRC(
|
|
1515
|
+
"#checkoutButton",
|
|
1516
|
+
"#checkoutIframe",
|
|
1517
|
+
"scheme_service_id",
|
|
1518
|
+
"paydock_public_key_or_access_token",
|
|
1519
|
+
{}, // meta
|
|
1520
|
+
);
|
|
1521
|
+
src.load();
|
|
1522
|
+
```
|
|
1523
|
+
|
|
1524
|
+
*NOTE:* it's highly recommended to use a Paydock Access Token instead of the public key for security reasons. When creating it, you will need to enable the `Secure Remote Commerce` and add a whiteliste for the domain of your checkout screen.
|
|
1525
|
+
|
|
1526
|
+
### Full example
|
|
1527
|
+
|
|
1528
|
+
```html
|
|
1529
|
+
<!DOCTYPE html>
|
|
1530
|
+
<html lang="en">
|
|
1531
|
+
<head>
|
|
1532
|
+
<meta charset="UTF-8">
|
|
1533
|
+
<title>Title</title>
|
|
1534
|
+
<style>iframe {border: 0;width: 40%;height: 300px;}</style>
|
|
1535
|
+
</head>
|
|
1536
|
+
<body>
|
|
1537
|
+
<div id="checkoutButton"></div>
|
|
1538
|
+
<div id="checkoutIframe"></div>
|
|
1539
|
+
<script src="https://app-sandbox.paydock.com/v1/widget.umd.js" ></script>
|
|
1540
|
+
<script>
|
|
1541
|
+
var src = new paydock.SRC(
|
|
1542
|
+
"#checkoutButton",
|
|
1543
|
+
"#checkoutIframe",
|
|
1544
|
+
"scheme_service_id",
|
|
1545
|
+
"paydock_public_key_or_access_token",
|
|
1546
|
+
{},
|
|
1547
|
+
);
|
|
1548
|
+
src.load();
|
|
1549
|
+
</script>
|
|
1550
|
+
</body>
|
|
1551
|
+
</html>
|
|
1552
|
+
```
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
## SRC advanced example
|
|
1556
|
+
|
|
1557
|
+
### Settings
|
|
1558
|
+
|
|
1559
|
+
```javascript
|
|
1560
|
+
|
|
1561
|
+
src.setEnv('sandbox'); // set enviroment
|
|
1562
|
+
|
|
1563
|
+
src.hideButton(); // hide button
|
|
1564
|
+
|
|
1565
|
+
src.showButton(); // show button
|
|
1566
|
+
|
|
1567
|
+
src.hideCheckout(); // hide checkout iframe
|
|
1568
|
+
|
|
1569
|
+
src.showCheckout(); // show checkout iframe
|
|
1570
|
+
|
|
1571
|
+
src.on('checkoutButtonLoaded', () => {
|
|
1572
|
+
console.log("Button loaded");
|
|
1573
|
+
});
|
|
1574
|
+
|
|
1575
|
+
src.on('checkoutButtonClicked', () => {
|
|
1576
|
+
console.log("Button clicked");
|
|
1577
|
+
});
|
|
1578
|
+
|
|
1579
|
+
src.on('iframeLoaded', () => {
|
|
1580
|
+
console.log("Initial iframe loaded");
|
|
1581
|
+
});
|
|
1582
|
+
|
|
1583
|
+
src.on('checkoutReady', () => {
|
|
1584
|
+
console.log("Checkout ready to be used");
|
|
1585
|
+
});
|
|
1586
|
+
|
|
1587
|
+
src.on('checkoutCompleted', (token) => {
|
|
1588
|
+
console.log(token);
|
|
1589
|
+
});
|
|
1590
|
+
|
|
1591
|
+
src.on('checkoutError', (error) => {
|
|
1592
|
+
console.log(error);
|
|
1593
|
+
});
|
|
1594
|
+
```
|
|
1595
|
+
|
|
1596
|
+
Here you can see how you can use this methods to customize your checkout experience
|
|
1597
|
+
|
|
1598
|
+
### Full example
|
|
1599
|
+
|
|
1600
|
+
```html
|
|
1601
|
+
<!DOCTYPE html>
|
|
1602
|
+
<html lang="en">
|
|
1603
|
+
<head>
|
|
1604
|
+
<meta charset="UTF-8">
|
|
1605
|
+
<title>Title</title>
|
|
1606
|
+
<style>iframe {border: 0;width: 40%;height: 450px;}</style>
|
|
1607
|
+
</head>
|
|
1608
|
+
<body>
|
|
1609
|
+
<div id="checkoutButton"></div>
|
|
1610
|
+
<div id="checkoutIframe"></div>
|
|
1611
|
+
<script src="https://app-sandbox.paydock.com/v1/widget.umd.js" ></script>
|
|
1612
|
+
<script>
|
|
1613
|
+
var src = new paydock.SRC(
|
|
1614
|
+
"#checkoutButton",
|
|
1615
|
+
"#checkoutIframe",
|
|
1616
|
+
"scheme_service_id",
|
|
1617
|
+
"paydock_public_key_or_access_token",
|
|
1618
|
+
{},
|
|
1619
|
+
);
|
|
1620
|
+
|
|
1621
|
+
src.on('checkoutReady', () => {
|
|
1622
|
+
console.log("Checkout ready to be used");
|
|
1623
|
+
});
|
|
1624
|
+
|
|
1625
|
+
src.on('checkoutCompleted', (token) => {
|
|
1626
|
+
console.log(token);
|
|
1627
|
+
});
|
|
1628
|
+
src.load();
|
|
1629
|
+
</script>
|
|
1630
|
+
</body>
|
|
1631
|
+
</html>
|
|
1632
|
+
```
|
|
1633
|
+
|
|
1634
|
+
## Customization options for address fields
|
|
1635
|
+
### Shipping address:
|
|
1636
|
+
|
|
1637
|
+
To customize shipping address experience we use a flag that manages how VisaSRC requires or not shipping address to the customer. Options are NONE (default option), POSTAL_COUNTRY or ALL.
|
|
1638
|
+
|
|
1639
|
+
```
|
|
1640
|
+
var src = new paydock.SRC(
|
|
1641
|
+
"#checkoutButton",
|
|
1642
|
+
"#checkoutIframe",
|
|
1643
|
+
"scheme_service_id",
|
|
1644
|
+
"paydock_public_key_or_access_token",
|
|
1645
|
+
{
|
|
1646
|
+
"dpa_transaction_options": {
|
|
1647
|
+
"dpa_shipping_preference": "ALL"
|
|
1648
|
+
}
|
|
1649
|
+
},
|
|
1650
|
+
);
|
|
1651
|
+
```
|
|
1652
|
+
|
|
1653
|
+
With this the Visa popup requires the shipping address from consumer, and these information will be stored in the Paydock charge.
|
|
1654
|
+
|
|
1655
|
+
Another option is at time of creating the charge. Say that you have a different way of collecting the shipping address (outside Paydock checkout), you can then disable the shipping address on our SRC widget and send it when creating the charge creation after getting the One Time Token out of the SRC widget:
|
|
1656
|
+
|
|
1657
|
+
```
|
|
1658
|
+
POST v1/charges
|
|
1659
|
+
|
|
1660
|
+
{
|
|
1661
|
+
"amount": "10.00",
|
|
1662
|
+
"currency": "AUD",
|
|
1663
|
+
"token": "token",
|
|
1664
|
+
"customer": {
|
|
1665
|
+
"payment_source": {
|
|
1666
|
+
"gateway_id": "gateway_id"
|
|
1667
|
+
}
|
|
1668
|
+
},
|
|
1669
|
+
"shipping": {
|
|
1670
|
+
"address_line1": "address_line1",
|
|
1671
|
+
"address_line2": "address_line2",
|
|
1672
|
+
"address_line3": "address_line3",
|
|
1673
|
+
"address_city": "address_city",
|
|
1674
|
+
"address_postcode": "address_postcode",
|
|
1675
|
+
"address_state": "address_state",
|
|
1676
|
+
"address_country": "address_country"
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1679
|
+
```
|
|
1680
|
+
|
|
1681
|
+
- Billing address:
|
|
1682
|
+
|
|
1683
|
+
Billing address fields are always present on the checkout and required when adding a new credit card (or for new consumer checkout). You can send billing fields on the meta data to pre-fill these fields inside the customer object:
|
|
1684
|
+
|
|
1685
|
+
```
|
|
1686
|
+
var src = new paydock.SRC(
|
|
1687
|
+
"#checkoutButton",
|
|
1688
|
+
"#checkoutIframe",
|
|
1689
|
+
"scheme_service_id",
|
|
1690
|
+
"paydock_public_key_or_access_token",
|
|
1691
|
+
{
|
|
1692
|
+
"customer": {
|
|
1693
|
+
"email": "test@email.com",
|
|
1694
|
+
"first_name": "Name",
|
|
1695
|
+
"last_name": "Surname",
|
|
1696
|
+
"phone": {
|
|
1697
|
+
"country_code": "1",
|
|
1698
|
+
"phone": "2124567890"
|
|
1699
|
+
},
|
|
1700
|
+
"payment_source": {
|
|
1701
|
+
"address_line1": "Line 1",
|
|
1702
|
+
"address_line2": "Line 2",
|
|
1703
|
+
"address_city": "Miami",
|
|
1704
|
+
"address_postcode": "33126",
|
|
1705
|
+
"address_state": "FL",
|
|
1706
|
+
"address_country": "US"
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
},
|
|
1710
|
+
);
|
|
1711
|
+
```
|
|
1712
|
+
|
|
1713
|
+
## Personalization Styling
|
|
1714
|
+
|
|
1715
|
+
To improve the experience in the use of the widget, it is allowed to send props that customize the UI.
|
|
1716
|
+
|
|
1717
|
+
### Example code
|
|
1718
|
+
|
|
1719
|
+
```
|
|
1720
|
+
var src = new paydock.SRC(
|
|
1721
|
+
"#checkoutButton",
|
|
1722
|
+
"#checkoutIframe",
|
|
1723
|
+
"scheme_service_id",
|
|
1724
|
+
"paydock_public_key",
|
|
1725
|
+
);
|
|
1726
|
+
|
|
1727
|
+
button.setStyles({"primary_color":"#a83232","button_text_color":"#171e9c","font_family":"sans-serif"})
|
|
1728
|
+
|
|
1729
|
+
```
|
|
1730
|
+
## Event and Values
|
|
1731
|
+
|
|
1732
|
+
| Event Value | Type | Description |
|
|
1733
|
+
| ------------------- | ------------------- | -------------------------------------------------------------- |
|
|
1734
|
+
| primary_color | <code>string</code> | HEX color for the principal buttons, example : #32a852 |
|
|
1735
|
+
| button_text_color | <code>string</code> | HEX color for the text of the buttons, example : #32a852|
|
|
1736
|
+
| font_family | <code>string</code> | Look more [mozilla.org/color](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family)|
|
|
1737
|
+
| card_schemes | <code>[string] - array of string</code> | Possible values "visa", "mastercard", "amex" and "discover" - Default show all logos
|