@paydock/client-sdk 1.10.39-beta → 1.10.43-beta
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 +151 -5
- package/bundles/widget.umd.js +135 -36
- package/bundles/widget.umd.min.js +1 -1
- package/lib/api/api-charge-internal.d.ts +2 -1
- package/lib/components/param.d.ts +2 -0
- package/lib/wallet-buttons/apple.wallet-service.d.ts +7 -1
- package/lib/wallet-buttons/apple.wallet-service.js +86 -33
- package/lib/wallet-buttons/apple.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/mastercard.wallet-service.d.ts +2 -1
- package/lib/wallet-buttons/mastercard.wallet-service.js +3 -0
- package/lib/wallet-buttons/mastercard.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/wallet-buttons.d.ts +38 -1
- package/lib/wallet-buttons/wallet-buttons.js +38 -1
- package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
- package/lib/wallet-buttons/wallet-service.d.ts +27 -2
- package/lib/wallet-buttons/wallet-service.js.map +1 -1
- package/package.json +1 -1
- package/slate.md +112 -4
package/slate.md
CHANGED
|
@@ -1092,7 +1092,7 @@ button.close();
|
|
|
1092
1092
|
|
|
1093
1093
|
### Performing actions when shipping info is updated
|
|
1094
1094
|
|
|
1095
|
-
In Flypay and
|
|
1095
|
+
In Flypay, Paypal and ApplePay via MPGS integrations after each shipping info update the `onUpdate(data)` will be called with the selected shipping address information (plus selected shipping method for Paypal). 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).
|
|
1096
1096
|
|
|
1097
1097
|
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.
|
|
1098
1098
|
|
|
@@ -1106,6 +1106,35 @@ button.onUpdate((data) => {
|
|
|
1106
1106
|
});
|
|
1107
1107
|
```
|
|
1108
1108
|
|
|
1109
|
+
For ApplePay via MPGS integration specifically, you must return the new `amount` and new `shipping_options` If new options are needed based on the updated shipping data. Before the user authorizes the transaction with Touch ID, Face ID, or passcode, you receive redacted address information (address_country, address_city, address_state, address_postcode), this data can be used to recalculate the amount and new shipping options. (https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypayment/1916097-shippingcontact)
|
|
1110
|
+
|
|
1111
|
+
```javascript
|
|
1112
|
+
button.onUpdate((data) => {
|
|
1113
|
+
console.log("Updating amount via a backend to backend call to POST charges/:id");
|
|
1114
|
+
// call `POST charges/:id` to modify charge
|
|
1115
|
+
button.update({
|
|
1116
|
+
success: true,
|
|
1117
|
+
body: {
|
|
1118
|
+
amount: 15,
|
|
1119
|
+
shipping_options: [
|
|
1120
|
+
{
|
|
1121
|
+
id: "NEW-FreeShip",
|
|
1122
|
+
label: "NEW - Free Shipping",
|
|
1123
|
+
detail: "Arrives in 3 to 5 days",
|
|
1124
|
+
amount: "0.00"
|
|
1125
|
+
},
|
|
1126
|
+
{
|
|
1127
|
+
id: "NEW - FastShip",
|
|
1128
|
+
label: "NEW - Fast Shipping",
|
|
1129
|
+
detail: "Arrives in less than 1 day",
|
|
1130
|
+
amount: "10.00"
|
|
1131
|
+
}
|
|
1132
|
+
]
|
|
1133
|
+
}
|
|
1134
|
+
});
|
|
1135
|
+
});
|
|
1136
|
+
```
|
|
1137
|
+
|
|
1109
1138
|
### Performing actions after the payment is completed
|
|
1110
1139
|
|
|
1111
1140
|
After the payment is completed, the onPaymentSuccessful(data) will be called if the payment was successful. If the payment was not successful, the function onPaymentError(data) will be called. If fraud check is active for the gateway, a fraud body was sent in the wallet charge initialize call and the fraud service left the charge in review, then the onPaymentInReview(data) will be called.
|
|
@@ -1253,7 +1282,7 @@ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_l
|
|
|
1253
1282
|
```
|
|
1254
1283
|
|
|
1255
1284
|
This example shows how to use these functions for **ApplePay via MPGS**:
|
|
1256
|
-
_(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `request_shipping`, `style.button_type`)_
|
|
1285
|
+
_(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `raw_data_initialization`, `request_shipping`, `style.button_type`)_
|
|
1257
1286
|
### Full example
|
|
1258
1287
|
|
|
1259
1288
|
```html
|
|
@@ -1275,10 +1304,89 @@ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `re
|
|
|
1275
1304
|
{
|
|
1276
1305
|
amount_label: "Total",
|
|
1277
1306
|
country: 'DE',
|
|
1278
|
-
request_shipping:
|
|
1307
|
+
request_shipping: true,
|
|
1279
1308
|
style: {
|
|
1280
1309
|
button_type: 'buy',
|
|
1281
|
-
}
|
|
1310
|
+
},
|
|
1311
|
+
shipping_options: [
|
|
1312
|
+
{
|
|
1313
|
+
id: "FreeShip",
|
|
1314
|
+
label: "Free Shipping",
|
|
1315
|
+
detail: "Arrives in 5 to 7 days",
|
|
1316
|
+
amount: "0.00"
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
id: "FastShip",
|
|
1320
|
+
label: "Fast Shipping",
|
|
1321
|
+
detail: "Arrives in 1 day",
|
|
1322
|
+
amount: "10.00"
|
|
1323
|
+
}
|
|
1324
|
+
]
|
|
1325
|
+
}
|
|
1326
|
+
);
|
|
1327
|
+
button.setEnv('sandbox');
|
|
1328
|
+
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
1329
|
+
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
1330
|
+
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
1331
|
+
button.load();
|
|
1332
|
+
</script>
|
|
1333
|
+
</html>
|
|
1334
|
+
```
|
|
1335
|
+
|
|
1336
|
+
Also, for **ApplePay via MPGS** you can initialize the `ApplePayPaymentRequest` with your own values instead of using the default ones. Below you can see an example on how to initialize the `ApplePayPaymentRequest` with the `raw_data_initialization` meta field:
|
|
1337
|
+
|
|
1338
|
+
### Raw data initialization example
|
|
1339
|
+
|
|
1340
|
+
```html
|
|
1341
|
+
<!DOCTYPE html>
|
|
1342
|
+
<html lang="en">
|
|
1343
|
+
<head>
|
|
1344
|
+
<meta charset="UTF-8">
|
|
1345
|
+
<title>Title</title>
|
|
1346
|
+
</head>
|
|
1347
|
+
<body>
|
|
1348
|
+
<h2>Payment using PayDock Wallet Button!</h2>
|
|
1349
|
+
<div id="widget"></div>
|
|
1350
|
+
</body>
|
|
1351
|
+
<script src="https://app-sandbox.paydock.com/v1/widget.umd.js" ></script>
|
|
1352
|
+
<script>
|
|
1353
|
+
let button = new paydock.WalletButtons(
|
|
1354
|
+
"#widget",
|
|
1355
|
+
charge_token,
|
|
1356
|
+
{
|
|
1357
|
+
raw_data_initialization: {
|
|
1358
|
+
countryCode: "AU",
|
|
1359
|
+
currencyCode: "AUD",
|
|
1360
|
+
merchantCapabilities: ["supports3DS","supportsCredit","supportsDebit"],
|
|
1361
|
+
supportedNetworks: ["visa","masterCard","amex","discover"],
|
|
1362
|
+
requiredBillingContactFields: ["name","postalAddress"],
|
|
1363
|
+
requiredShippingContactFields:["postalAddress","name","phone","email" ],
|
|
1364
|
+
total: {
|
|
1365
|
+
label: "Total",
|
|
1366
|
+
amount: "10",
|
|
1367
|
+
type: "final",
|
|
1368
|
+
}
|
|
1369
|
+
},
|
|
1370
|
+
amount_label: "Total",
|
|
1371
|
+
country: 'DE',
|
|
1372
|
+
request_shipping: true,
|
|
1373
|
+
style: {
|
|
1374
|
+
button_type: 'buy',
|
|
1375
|
+
},
|
|
1376
|
+
shipping_options: [
|
|
1377
|
+
{
|
|
1378
|
+
id: "FreeShip",
|
|
1379
|
+
label: "Free Shipping",
|
|
1380
|
+
detail: "Arrives in 5 to 7 days",
|
|
1381
|
+
amount: "0.00"
|
|
1382
|
+
},
|
|
1383
|
+
{
|
|
1384
|
+
id: "FastShip",
|
|
1385
|
+
label: "Fast Shipping",
|
|
1386
|
+
detail: "Arrives in 1 day",
|
|
1387
|
+
amount: "10.00"
|
|
1388
|
+
}
|
|
1389
|
+
]
|
|
1282
1390
|
}
|
|
1283
1391
|
);
|
|
1284
1392
|
button.setEnv('sandbox');
|