@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.
Files changed (78) hide show
  1. package/README.md +1136 -3960
  2. package/bundles/index.cjs +292 -85
  3. package/bundles/index.cjs.d.ts +48 -3
  4. package/bundles/index.mjs +292 -85
  5. package/bundles/index.mjs.d.ts +48 -3
  6. package/bundles/types/checkout/checkout.d.ts +4 -4
  7. package/bundles/types/checkout/checkout.d.ts.map +1 -1
  8. package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
  9. package/bundles/types/checkout/layout-widgets/payment-template.d.ts.map +1 -1
  10. package/bundles/types/components/param.d.ts +2 -0
  11. package/bundles/types/components/param.d.ts.map +1 -1
  12. package/bundles/types/components/trigger.d.ts +2 -0
  13. package/bundles/types/components/trigger.d.ts.map +1 -1
  14. package/bundles/types/index-cba.d.ts +11 -11
  15. package/bundles/types/index-cba.d.ts.map +1 -1
  16. package/bundles/types/index.d.ts +11 -11
  17. package/bundles/types/index.d.ts.map +1 -1
  18. package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +24 -2
  19. package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts.map +1 -1
  20. package/bundles/types/secure-remote-commerce/index.d.ts +7 -1
  21. package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
  22. package/bundles/types/secure-remote-commerce/interfaces.d.ts +10 -2
  23. package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
  24. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts +15 -4
  25. package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -1
  26. package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts +2 -0
  27. package/bundles/types/secure-remote-commerce/providers/src-provider.d.ts.map +1 -1
  28. package/bundles/types/secure-remote-commerce/services/performance.service.d.ts +32 -0
  29. package/bundles/types/secure-remote-commerce/services/performance.service.d.ts.map +1 -0
  30. package/bundles/types/wallet-buttons/index.d.ts +6 -6
  31. package/bundles/types/wallet-buttons/wallet-buttons.d.ts +2 -2
  32. package/bundles/types/wallet-buttons-express/enum/event.enum.d.ts.map +1 -1
  33. package/bundles/types/wallet-buttons-express/index.d.ts +3 -3
  34. package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
  35. package/bundles/types/wallet-buttons-express/interfaces/charge-wallet-token-meta.interface.d.ts.map +1 -1
  36. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts +2 -2
  37. package/bundles/types/wallet-buttons-express/interfaces/on-click-event-data.interface.d.ts.map +1 -1
  38. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts +2 -2
  39. package/bundles/types/wallet-buttons-express/interfaces/on-close-event-data.interface.d.ts.map +1 -1
  40. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts +2 -2
  41. package/bundles/types/wallet-buttons-express/interfaces/on-error-event-data.interface.d.ts.map +1 -1
  42. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts +2 -2
  43. package/bundles/types/wallet-buttons-express/interfaces/on-payment-error-event-data.interface.d.ts.map +1 -1
  44. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts +2 -2
  45. package/bundles/types/wallet-buttons-express/interfaces/on-payment-in-review-event-data.interface.d.ts.map +1 -1
  46. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts +2 -2
  47. package/bundles/types/wallet-buttons-express/interfaces/on-payment-successful-event-data.interface.d.ts.map +1 -1
  48. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-data.interface.d.ts.map +1 -1
  49. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-address-change-event-response.interface.d.ts.map +1 -1
  50. package/bundles/types/wallet-buttons-express/interfaces/on-shipping-option-change-event-data.interface.d.ts.map +1 -1
  51. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts +2 -2
  52. package/bundles/types/wallet-buttons-express/interfaces/on-unavailable-event-data.interface.d.ts.map +1 -1
  53. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts +5 -5
  54. package/bundles/types/wallet-buttons-express/services/apple-pay/interfaces/apple-pay-wallet-meta.interface.d.ts.map +1 -1
  55. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-data.d.ts.map +1 -1
  56. package/bundles/types/wallet-buttons-express/services/apple-pay/types/apple-pay-shipping-method.type.d.ts.map +1 -1
  57. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -1
  58. package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
  59. package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts +4 -4
  60. package/bundles/types/wallet-buttons-express/types/shipping-event-to-response.type.d.ts.map +1 -1
  61. package/bundles/types/widget/multi-widget.d.ts +8 -0
  62. package/bundles/types/widget/multi-widget.d.ts.map +1 -1
  63. package/bundles/widget.umd.js +292 -85
  64. package/bundles/widget.umd.js.d.ts +48 -3
  65. package/bundles/widget.umd.js.min.d.ts +48 -3
  66. package/bundles/widget.umd.min.js +1 -1
  67. package/docs/api-checkout-button.md +0 -370
  68. package/docs/api-widget.md +1 -2110
  69. package/docs/checkout-examples.md +2 -127
  70. package/docs/click-to-pay-examples.md +109 -0
  71. package/docs/click-to-pay.md +31 -1
  72. package/docs/license.md +1 -1
  73. package/docs/wallet-buttons-examples.md +3 -134
  74. package/docs/wallet-buttons.md +10 -10
  75. package/docs/wallet-cba-buttons-examples.md +1 -1
  76. package/package.json +1 -1
  77. package/slate.md +114 -524
  78. package/docs/api-vault-display.md +0 -94
@@ -1,7 +1,6 @@
1
1
  ## Checkout button
2
2
 
3
3
  You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#cb_CheckoutButton)
4
- PayPal meta parameters description [here](https://www.npmjs.com/package/@paydock/client-sdk#ipaypalmeta)
5
4
  Zipmoney meta parameters description [here](https://www.npmjs.com/package/@paydock/client-sdk#izipmoneymeta)
6
5
 
7
6
  This widget allows you to turn your button into a full Checkout Button.
@@ -24,96 +23,18 @@ You must create a button to turn it into checkout-button
24
23
 
25
24
  ### Initialization
26
25
  ```javascript
27
- var button = new paydock.PaypalCheckoutButton('#button', 'publicKey', 'gatewayId');
26
+ var button = new paydock.ZipmoneyCheckoutButton('#button', 'publicKey', 'gatewayId');
28
27
  ```
29
28
 
30
29
  ```javascript
31
30
  // ES2015 | TypeScript
32
31
 
33
32
 
34
- var button = new PaypalCheckoutButton('#button', 'publicKey');
33
+ var button = new ZipmoneyCheckoutButton('#button', 'publicKey');
35
34
  ```
36
35
 
37
36
  Then write only need 1 line of code in js to initialize widget
38
37
 
39
-
40
- ### Full example
41
-
42
- ```html
43
- <!DOCTYPE html>
44
- <html lang="en">
45
- <head>
46
- <meta charset="UTF-8">
47
- <title>Title</title>
48
- </head>
49
- <body>
50
- <button type="button" id="button">checkout</button>
51
- <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
52
- <script>
53
- var button = new paydock.PaypalCheckoutButton('#button', 'publicKey');
54
- </script>
55
- </body>
56
- </html>
57
- ```
58
-
59
-
60
- ## Checkout button advanced example
61
-
62
- ### Optional methods
63
-
64
- ```javascript
65
- button.onFinishInsert('input[name="pst"]', 'payment_source_token'); // insert one-time-token to your input after finish checkout
66
-
67
- button.setMeta({
68
- brand_name: 'Paydock',
69
- reference: '15',
70
- first_name: 'receiver-name',
71
- last_name: 'receiver-last-name',
72
- phone: '9379992'}); // settings for checkout pages
73
-
74
- button.on('finish', function (data) { // Add handler of event
75
- console.log('on:finish', data);
76
- });
77
- ```
78
-
79
- This example shows how you can use a lot of other methods to settings your button
80
-
81
- ### Full Paypal example
82
-
83
- ```html
84
- <!DOCTYPE html>
85
- <html lang="en">
86
- <head>
87
- <meta charset="UTF-8">
88
- <title>Title</title>
89
- </head>
90
- <body>
91
- <form id="paymentForm">
92
- <button type="button" id="button">
93
- <img src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="left" style="margin-right:7px;">
94
- </button>
95
- </form>
96
-
97
- <input type="text" name="pst" />
98
-
99
- <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
100
- <script>
101
- var button = new paydock.PaypalCheckoutButton('#button', 'publicKey', 'gatewayId');
102
- button.onFinishInsert('input[name="pst"]', 'payment_source_token');
103
- button.setMeta({
104
- brand_name: 'Paydock',
105
- reference: '15',
106
- first_name: 'Joshua',
107
- last_name: 'Wood',
108
- phone: '0231049872'});
109
-
110
- button.on('finish', function (data) {
111
- console.log('on:finish', data);
112
- });
113
- </script>
114
- </body>
115
- </html>
116
- ```
117
38
  ### Full ZipMoney example
118
39
 
119
40
  ```html
@@ -200,49 +121,3 @@ This example shows how you can use a lot of other methods to settings your butto
200
121
  </body>
201
122
  </html>
202
123
  ```
203
-
204
- ### Full Aftepay example
205
-
206
- ```html
207
- <!DOCTYPE html>
208
- <html lang="en">
209
- <head>
210
- <meta charset="UTF-8">
211
- <title>Title</title>
212
- </head>
213
- <body>
214
- <button type="button" id="button">
215
- <img src="https://daepxvbfwwgd0.cloudfront.net/assets/logo_scroll-0c43312c5845a0dcd7a3373325da6402bc1d635d3415af28ed40d6c1b48e3d5c.png" align="left" style="margin-right:7px;">
216
- </button>
217
-
218
- <input type="text" name="pst" />
219
-
220
- <script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
221
- <script>
222
- var button = new paydock.AfterpayCheckoutButton('#button', 'publicKey', 'gatewayId');
223
-
224
- button.onFinishInsert('input[name="pst"]', 'payment_source_token');
225
- button.showEnhancedTrackingProtectionPopup(true);
226
- button.setMeta({
227
- amount: "100",
228
- currency: "AUD",
229
- reference: 'Vitae commodi provident assumenda',
230
- email: 'wanda.mertz@example.com',
231
- first_name: 'Wanda',
232
- last_name: 'Mertz',
233
- address_line: '61426 Osvaldo Plains',
234
- address_line2: 'Apt. 276',
235
- address_city: 'Lake Robyn',
236
- address_state: 'WY',
237
- address_postcode: '07396',
238
- address_country: 'Australia',
239
- phone: '0412345678',
240
- });
241
-
242
- button.on('finish', function (data) {
243
- console.log('on:finish', data);
244
- });
245
- </script>
246
- </body>
247
- </html>
248
- ```
@@ -229,3 +229,112 @@ src.setStyles({
229
229
  font_family: 'Arial',
230
230
  });
231
231
  ```
232
+
233
+ ## Configurations for background loading and improved User Load times
234
+
235
+ ### hold_for_customer_data
236
+ 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.
237
+
238
+ ```javascript
239
+ const clickToPay = new cba.ClickToPay("#checkoutIframe", SERVICE_ID, PUBLIC_KEY, {
240
+ hold_for_customer_data: true,
241
+ dpa_config: {
242
+ dpa_id: DPA_ID,
243
+ // ... other config
244
+ }
245
+ });
246
+ ```
247
+
248
+ ### injectCustomerData(customer)
249
+ 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.
250
+
251
+ ```javascript
252
+ clickToPay.injectCustomerData({
253
+ email: "customer@example.com",
254
+ first_name: "John",
255
+ last_name: "Doe",
256
+ phone: "+61400123456" // Include country code
257
+ });
258
+ ```
259
+
260
+ ### Background Loading Example
261
+ Here's a complete example showing how to implement background loading while collecting customer information:
262
+
263
+ ```javascript
264
+ // 1. Initialize with hold_for_customer_data
265
+ const clickToPay = new cba.ClickToPay("#checkoutIframe", SERVICE_ID, PUBLIC_KEY, {
266
+ hold_for_customer_data: true,
267
+ dpa_config: {
268
+ dpa_id: DPA_ID,
269
+ // ... other config
270
+ }
271
+ });
272
+
273
+ // Hide checkout and show form initially
274
+ document.getElementById("checkoutIframe").style.display = 'none';
275
+ document.getElementById("customerForm").style.display = 'block';
276
+ document.getElementById("loader").style.display = 'none';
277
+
278
+ // 2. Setup event handlers
279
+ clickToPay.on('iframeLoaded', () => {
280
+ // Iframe is now loaded
281
+ });
282
+
283
+ clickToPay.on('checkoutReady', () => {
284
+ // Hide loader, show checkout
285
+ document.getElementById("loader").style.display = 'none';
286
+ document.getElementById("checkoutIframe").style.display = 'block';
287
+ clickToPay.showCheckout();
288
+ });
289
+
290
+ // 3. Start loading in background
291
+ clickToPay.load();
292
+
293
+ // 4. Handle form submission
294
+ document.getElementById("submitButton").addEventListener("click", (e) => {
295
+ e.preventDefault();
296
+
297
+ const customer = {
298
+ email: document.getElementById("email").value.trim(),
299
+ first_name: document.getElementById("firstName").value.trim(),
300
+ last_name: document.getElementById("lastName").value.trim(),
301
+ phone: document.getElementById("phone").value.trim()
302
+ };
303
+
304
+ // Hide form, show loader
305
+ document.getElementById("customerForm").style.display = "none";
306
+ document.getElementById("loader").style.display = "flex";
307
+
308
+ try {
309
+ // Inject customer data to continue checkout
310
+ clickToPay.injectCustomerData(customer);
311
+ } catch (error) {
312
+ // Show form again on error
313
+ document.getElementById("customerForm").style.display = "block";
314
+ document.getElementById("loader").style.display = "none";
315
+ alert("An error occurred. Please try again.");
316
+ }
317
+ });
318
+ ```
319
+
320
+ #### HTML Structure
321
+ Here's the required HTML structure for the background loading example:
322
+
323
+ ```html
324
+ <!-- Click to Pay iframe container -->
325
+ <div id="checkoutIframe"></div>
326
+
327
+ <!-- Customer information form -->
328
+ <form id="customerForm">
329
+ <input type="email" id="email" placeholder="Email" required>
330
+ <input type="text" id="firstName" placeholder="First Name" required>
331
+ <input type="text" id="lastName" placeholder="Last Name" required>
332
+ <input type="tel" id="phone" placeholder="Phone (with country code)" required>
333
+ <button type="submit" id="submitButton">Continue to Checkout</button>
334
+ </form>
335
+
336
+ <!-- Loading indicator -->
337
+ <div id="loader" style="display: none;">
338
+ Loading...
339
+ </div>
340
+ ```
@@ -53,7 +53,7 @@ Interface of data used for the Mastercard Checkout. For further information refe
53
53
  | [checkout_experience] | <code>string</code> | Checkout experience type, either 'WITHIN_CHECKOUT' or 'PAYMENT_SETTINGS'. |
54
54
  | [services] | <code>string</code> | Services offered, such as 'INLINE_CHECKOUT' or 'INLINE_INSTALLMENTS'. |
55
55
  | [dpa_transaction_options] | <code>object</code> | Object that stores options for creating a transaction with DPA. |
56
- | [dpa_transaction_options.dpa_locale] | <code>string</code> | DPAs preferred locale, example en_US. |
56
+ | [dpa_transaction_options.dpa_locale] | <code>string</code> | DPA's preferred locale, example en_US. |
57
57
  | [dpa_transaction_options.dpa_accepted_billing_countries] | <code>Array.&lt;string&gt;</code> | List of accepted billing countries for DPA in ISO 3166-1 alpha-2 format. |
58
58
  | [dpa_transaction_options.dpa_billing_preference] | <code>string</code> | Billing preferences for DPA, options are 'FULL', 'POSTAL_COUNTRY', 'NONE'. |
59
59
  | [dpa_transaction_options.payment_options] | <code>Array.&lt;object&gt;</code> | Payment options included in the transaction. |
@@ -78,6 +78,12 @@ Interface of data used for the Mastercard Checkout. For further information refe
78
78
  | [customer.phone.country_code] | <code>string</code> | Customer phone country code (example "1" for US). |
79
79
  | [customer.phone.phone] | <code>string</code> | Customer phone number. |
80
80
  | [unaccepted_card_type] | <code>string</code> | Used to block a specific card type. Options are 'CREDIT', 'DEBIT'. |
81
+ | [dpa_config] | <code>object</code> | Raw DPA configuration object for performance optimization. Skips API call when provided. |
82
+ | [dpa_config.dpa_id] | <code>string</code> | DPA identifier. |
83
+ | [dpa_config.dpa_name] | <code>string</code> | DPA name. |
84
+ | [dpa_config.dpa_supported_card_schemes] | <code>Array.&lt;string&gt;</code> | List of supported card schemes: 'MASTERCARD', 'VISA', 'AMEX', 'DISCOVER'. |
85
+ | [dpa_config.mode] | <code>string</code> | DPA mode, either 'sandbox' or 'live'. |
86
+ | [hold_for_customer_data] | <code>boolean</code> | Flag to hold initialization for customer data injection. Enables background initialization. |
81
87
 
82
88
  <a name="EventData" id="EventData" href="#EventData">&nbsp;</a>
83
89
 
@@ -152,6 +158,7 @@ Class ClickToPay include methods for interacting with the ClickToPay checkout an
152
158
  * [ClickToPay](#ClickToPay) ⇐ <code>SRC</code>
153
159
  * [new ClickToPay(iframe_selector, service_id, public_key_or_access_token, meta)](#new_ClickToPay_new)
154
160
  * [.load()](#ClickToPay+load)
161
+ * [.injectCustomerData(customerData)](#ClickToPay+injectCustomerData)
155
162
  * [.setStyles(fields)](#SRC+setStyles)
156
163
  * [.setEnv(env, [alias])](#SRC+setEnv)
157
164
  * [.getEnv()](#SRC+getEnv)
@@ -182,6 +189,29 @@ var mastercardSRC = new ClickToPay('#checkoutIframe', 'service_id', 'public_key'
182
189
  The final method after configuring the SRC to start the load process of Click To Pay checkout
183
190
 
184
191
  **Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
192
+ <a name="ClickToPay+injectCustomerData" id="ClickToPay+injectCustomerData" href="#ClickToPay+injectCustomerData">&nbsp;</a>
193
+
194
+ ### clickToPay.injectCustomerData(customerData)
195
+ Inject customer data after widget initialization via postMessage
196
+
197
+ **Kind**: instance method of [<code>ClickToPay</code>](#ClickToPay)
198
+ **Throws**:
199
+
200
+ - <code>Error</code> When customer data is invalid or widget is not ready
201
+
202
+
203
+ | Param | Type | Description |
204
+ | --- | --- | --- |
205
+ | customerData | <code>Customer</code> | Customer data to inject |
206
+
207
+ **Example**
208
+ ```js
209
+ widget.injectCustomerData({
210
+ email: 'user@example.com',
211
+ first_name: 'John',
212
+ last_name: 'Doe'
213
+ });
214
+ ```
185
215
  <a name="SRC+setStyles" id="SRC+setStyles" href="#SRC+setStyles">&nbsp;</a>
186
216
 
187
217
  ### clickToPay.setStyles(fields)
package/docs/license.md CHANGED
@@ -1,2 +1,2 @@
1
1
  ## License
2
- Copyright (c) 2024 paydock
2
+ Copyright (c) 2025 paydock
@@ -2,7 +2,7 @@
2
2
  You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#wallet-buttons-simple-example)
3
3
 
4
4
  Wallet Buttons allow you to easily integrate different E-Wallets into your checkout.
5
- Currently supports ApplePay, Google Pay, Google Pay and Apple Pay via Stripe, Flypay and Flypay V2 checkout, Paypal Smart Buttons Checkout and Afterpay.
5
+ Currently supports ApplePay, Google Pay, Google Pay and Apple Pay via Stripe and Flypay V2 checkout, Paypal Smart Buttons Checkout and Afterpay.
6
6
 
7
7
  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.
8
8
 
@@ -19,55 +19,6 @@ You must create a container for the Wallet Buttons. Inside this tag, the button
19
19
  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.
20
20
 
21
21
  ### Initialization
22
- The following is the minimum required initialization parameters for Apple Pay and Google Pay via Stripe:
23
- ```javascript
24
- let button = new paydock.WalletButtons(
25
- "#widget",
26
- token,
27
- {
28
- amount_label: "Total",
29
- country: "DE",
30
- }
31
- );
32
- button.load();
33
- ```
34
-
35
- ```javascript
36
- // ES2015 | TypeScript
37
- import { WalletButtons } from '@paydock/client-sdk';
38
-
39
- var button = new WalletButtons(
40
- '#widget',
41
- token,
42
- {
43
- amount_label: 'Total',
44
- country: 'DE',
45
- }
46
- );
47
- button.load();
48
- ```
49
-
50
- Flypay and Paypal wallets do not require any meta sent to the wallet, so the following is enough for initialization:
51
- ```javascript
52
- let button = new paydock.WalletButtons(
53
- "#widget",
54
- token,
55
- {}
56
- );
57
- button.load();
58
- ```
59
-
60
- ```javascript
61
- // ES2015 | TypeScript
62
- import { WalletButtons } from '@paydock/client-sdk';
63
-
64
- var button = new WalletButtons(
65
- '#widget',
66
- token,
67
- {}
68
- );
69
- button.load();
70
- ```
71
22
 
72
23
  For Afterpay wallet, the country code is required:
73
24
  ```javascript
@@ -168,14 +119,6 @@ If the customer's browser is not supported, or the customer does not have any ca
168
119
  button.onUnavailable(() => console.log("No wallet buttons available"));
169
120
  ```
170
121
 
171
- ### Forcibly closing the checkout
172
-
173
- 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.
174
-
175
- ```javascript
176
- button.close();
177
- ```
178
-
179
122
  ### Performing actions when the wallet button is clicked
180
123
 
181
124
  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.
@@ -186,7 +129,7 @@ button.onClick(() => console.log("Perform actions on button click"));
186
129
 
187
130
  ### Performing actions when shipping info is updated
188
131
 
189
- In Flypay, 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).
132
+ 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).
190
133
 
191
134
  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.
192
135
 
@@ -253,47 +196,11 @@ of the corresponding event names.
253
196
 
254
197
  ```javascript
255
198
  button.on(EVENT.UNAVAILABLE, () => console.log("No wallet buttons available"));
256
- button.on(EVENT.UPDATE, (data) => console.log("Updating amount via a backend to backend call to POST charges/:id");
199
+ button.on(EVENT.UPDATE, (data) => console.log("Updating amount via a backend to backend call to POST charges/:id"));
257
200
  button.on(EVENT.PAYMENT_SUCCESSFUL, (data) => console.log("The payment was successful"));
258
201
  button.on(EVENT.PAYMENT_ERROR, (data) => console.log("The payment was not successful"));
259
202
  ```
260
203
 
261
- This example shows how to use these functions for **Apple and Google Pay via Stripe**:
262
- _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `wallets`)_
263
- ### Apple and Google Pay via Stripe Full example
264
-
265
- ```html
266
- <!DOCTYPE html>
267
- <html lang="en">
268
- <head>
269
- <meta charset="UTF-8">
270
- <title>Title</title>
271
- </head>
272
- <body>
273
- <h2>Payment using PayDock Wallet Button!</h2>
274
- <div id="widget"></div>
275
- </body>
276
- <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
277
- <script>
278
- let button = new paydock.WalletButtons(
279
- "#widget",
280
- charge_token,
281
- {
282
- amount_label: "Total",
283
- country: "DE",
284
- wallets: ["google", "apple"],
285
- }
286
- );
287
- button.setEnv('sandbox');
288
- button.onUnavailable(() => console.log("No wallet buttons available"));
289
- button.onPaymentSuccessful((data) => console.log("The payment was successful"));
290
- button.onPaymentError((data) => console.log("The payment was not successful"));
291
- button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
292
- button.load();
293
- </script>
294
- </html>
295
- ```
296
-
297
204
  This example shows how to use these functions for **Paypal Smart Checkout Buttons**:
298
205
  _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_later`, `standalone`, `style`)_
299
206
  ### Paypal Smart Checkout Buttons Full example
@@ -361,44 +268,6 @@ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_l
361
268
  </html>
362
269
  ```
363
270
 
364
- This example shows how to use these functions for **Flypay v1 Wallet**.
365
- _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_later`, `style`)_
366
- ### Flypay Full example
367
- ```html
368
- <!DOCTYPE html>
369
- <html lang="en">
370
- <head>
371
- <meta charset="UTF-8">
372
- <title>Title</title>
373
- </head>
374
- <body>
375
- <h2>Payment using PayDock Wallet Button!</h2>
376
- <div id="widget"></div>
377
- </body>
378
- <script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
379
- <script>
380
- let button = new paydock.WalletButtons(
381
- "#widget",
382
- charge_token,
383
- {
384
- request_shipping: true
385
- }
386
- );
387
- button.setEnv('sandbox');
388
- button.onUnavailable(() => console.log("No wallet buttons available"));
389
- button.onUpdate((data) => {
390
- console.log("Updating amount via a backend to backend call to POST charges/:id");
391
- // call `POST charges/:id` to modify charge
392
- button.update({ success: true });
393
- });
394
- button.onPaymentSuccessful((data) => console.log("The payment was successful"));
395
- button.onPaymentError((data) => console.log("The payment was not successful"));
396
- button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
397
- button.load();
398
- </script>
399
- </html>
400
- ```
401
-
402
271
  This example shows how to use these functions for **Flypay v2 Wallet**.
403
272
  _(Required `meta` fields: - . Optional `meta` fields: -)_
404
273
  ### Flypay V2 Full example
@@ -2,7 +2,7 @@
2
2
 
3
3
  <dl>
4
4
  <dt><a href="#WalletButtons">WalletButtons</a></dt>
5
- <dd><p>Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay, Flypay V2, Paypal, Afterpay)</p>
5
+ <dd><p>Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay V2, Paypal, Afterpay)</p>
6
6
  </dd>
7
7
  </dl>
8
8
 
@@ -154,8 +154,8 @@ Interface of data used by the wallet checkout and payment proccess.
154
154
 
155
155
  | Param | Type | Description |
156
156
  | --- | --- | --- |
157
- | [amount_label] | <code>string</code> | Label shown next to the total amount to be paid. Required for [Stripe, ApplePay, GooglePay]. N/A for [FlyPay, Flypay V2, PayPal, Afterpay]. |
158
- | [country] | <code>string</code> | Country of the user. 2 letter ISO code format. Required for [Stripe, ApplePay, GooglePay, Afterpay]. N/A for [FlyPay, Flypay V2, PayPal]. |
157
+ | [amount_label] | <code>string</code> | Label shown next to the total amount to be paid. Required for [Stripe, ApplePay, GooglePay]. N/A for [Flypay V2, PayPal, Afterpay]. |
158
+ | [country] | <code>string</code> | Country of the user. 2 letter ISO code format. Required for [Stripe, ApplePay, GooglePay, Afterpay]. N/A for [Flypay V2, PayPal]. |
159
159
  | [pay_later] | <code>boolean</code> | Used to enable Pay Later feature in PayPal Smart Checkout WalletButton integration when available. Optional for [PayPal]. N/A for other wallets. |
160
160
  | [hide_message] | <code>boolean</code> | Used to hide Pay Later message in PayPal Smart Checkout WalletButton integration. Optional for [PayPal]. N/A for other wallets. |
161
161
  | [standalone] | <code>boolean</code> | Used to enable Standalone Buttons feature in PayPal Smart Checkout WalletButton integration. Used together with `pay_later`. Optional for [PayPal]. N/A for other wallets. |
@@ -165,17 +165,17 @@ Interface of data used by the wallet checkout and payment proccess.
165
165
  | [request_payer_phone] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
166
166
  | [access_token] | <code>string</code> | Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets. |
167
167
  | [refresh_token] | <code>string</code> | Used for Flypay V2 express flow. Optional for [Flypay V2]. N/A for other wallets. |
168
- | [request_shipping] | <code>boolean</code> | Used to request or not shipping address in the Wallet checkout, being able to handle amount changes via the `update` event. Optional for [FlyPay, PayPal, ApplePay, GooglePay]. N/A for [Flypay V2, Stripe, Afterpay]. |
168
+ | [request_shipping] | <code>boolean</code> | Used to request or not shipping address in the Wallet checkout, being able to handle amount changes via the `update` event. Optional for [PayPal, ApplePay, GooglePay]. N/A for [Flypay V2, Stripe, Afterpay]. |
169
169
  | [shipping_options] | [<code>Array.&lt;IApplePayShippingOption&gt;</code>](#IApplePayShippingOption) \| [<code>Array.&lt;IPayPalShippingOption&gt;</code>](#IPayPalShippingOption) | Used to provide available shipping options.(To use shipping_options the request_shipping flag should be true). Optional for [ApplePay]. N/A for the other wallets. |
170
170
  | [merchant_name] | <code>string</code> | Merchant Name used for GooglePay integration via MPGS. Required for [GooglePay]. N/A for other wallets. |
171
171
  | [raw_data_initialization] | <code>object</code> | Used to provide values to initialize wallet with raw data. Optional for [ApplePay]. N/A for the other wallets. |
172
- | [style] | <code>object</code> | For **Paypal**: used to style the buttons, check possible values in the [style guide](https://developer.paypal.com/docs/business/checkout/reference/style-guide). When `standalone` and `pay_later`, extra options can be provided in `style.messages` with the [messages style options](https://developer.paypal.com/docs/checkout/pay-later/us/integrate/reference/#stylelayout). Also used at **ApplePay**, **GooglePay** and **Afterpay** to select button type. Optional for [PayPal, ApplePay, GooglePay, Afterpay]. N/A for [Stripe, FlyPay, Flypay V2]. |
172
+ | [style] | <code>object</code> | For **Paypal**: used to style the buttons, check possible values in the [style guide](https://developer.paypal.com/docs/business/checkout/reference/style-guide). When `standalone` and `pay_later`, extra options can be provided in `style.messages` with the [messages style options](https://developer.paypal.com/docs/checkout/pay-later/us/integrate/reference/#stylelayout). Also used at **ApplePay**, **GooglePay** and **Afterpay** to select button type. Optional for [PayPal, ApplePay, GooglePay, Afterpay]. N/A for [Stripe, Flypay V2]. |
173
173
  | [style.button_type] | <code>object</code> | Used to select ApplePay button type (e.g: 'buy','donate', etc), check possible values [here](https://developer.apple.com/documentation/apple_pay_on_the_web/displaying_apple_pay_buttons_using_css). Also select button type for GooglePay (check GooglePayStyles) and Afterpay (check AfterpayStyles). Optional for [ApplePay, GooglePay, Afterpay]. N/A for other wallets. |
174
174
  | [style.button_style] | <code>object</code> | Used to select ApplePay button style (e.g: 'black', 'white', etc), check possible values [here](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaybuttonstyle). Optional for [ApplePay]. N/A for other wallets. |
175
175
  | [style.height] | <code>object</code> | Used to select Afterpay button height. Optional for [Afterpay]. N/A for other wallets. |
176
176
  | [wallets] | <code>array</code> | By default if this is not sent or empty, we will try to show either Apple Pay or Google Pay buttons. This can be limited sending the following array in this field: ['apple','google]. Optional for [Stripe, ApplePay, GooglePay]. N/A for other wallets. |
177
- | [client_id] | <code>string</code> | Client ID to be used in the provider system. Required for [Flypay V2]. N/A for [FlyPay, GooglePay, ApplePay, PayPal, Afterpay]. |
178
- | [apple_pay_capabilities] | <code>Array.&lt;(&#x27;credentials\_available&#x27;\|&#x27;credentials\_status\_unknown&#x27;\|&#x27;credentials\_unavailable&#x27;)&gt;</code> | Device capabilities needed for wallet button to be available. For further information about refer to [the documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/4440085-applepaycapabilities). If the recognized value is credentials_status_unknown, the payment most possibly cannot be finished on the web, and the buyer must complete it on a compatible device, like Iphone, via QR scan. Optional parameter for [ApplePay]. N/A for [FlyPay, GooglePay, Flypay V2, PayPal, Afterpay]. |
177
+ | [client_id] | <code>string</code> | Client ID to be used in the provider system. Required for [Flypay V2]. N/A for [GooglePay, ApplePay, PayPal, Afterpay]. |
178
+ | [apple_pay_capabilities] | <code>Array.&lt;(&#x27;credentials\_available&#x27;\|&#x27;credentials\_status\_unknown&#x27;\|&#x27;credentials\_unavailable&#x27;)&gt;</code> | Device capabilities needed for wallet button to be available. For further information about refer to [the documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/4440085-applepaycapabilities). If the recognized value is credentials_status_unknown, the payment most possibly cannot be finished on the web, and the buyer must complete it on a compatible device, like Iphone, via QR scan. Optional parameter for [ApplePay]. N/A for [GooglePay, Flypay V2, PayPal, Afterpay]. |
179
179
 
180
180
  <a name="IApplePayShippingOption" id="IApplePayShippingOption" href="#IApplePayShippingOption">&nbsp;</a>
181
181
 
@@ -224,7 +224,7 @@ Interface of Shipping Options for PayPal
224
224
  <a name="WalletButtons" id="WalletButtons" href="#WalletButtons">&nbsp;</a>
225
225
 
226
226
  ## WalletButtons
227
- Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay, Flypay V2, Paypal, Afterpay)
227
+ Class WalletButtons to work with different E-Wallets within html (currently supports Apple Pay, Google Pay, Google Pay™ and Apple Pay via Stripe, Flypay V2, Paypal, Afterpay)
228
228
 
229
229
  **Kind**: global class
230
230
 
@@ -284,7 +284,7 @@ var button = new WalletButtons(
284
284
 
285
285
  ### walletButtons.update()
286
286
  Triggers the update process of the wallet, if available.
287
- Currently supported by Flypay, Paypal and ApplePay/GooglePay via MPGS Wallets.
287
+ Currently supported by Paypal and ApplePay/GooglePay via MPGS Wallets.
288
288
 
289
289
  **Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
290
290
  **Example**
@@ -408,7 +408,7 @@ button.on('paymentSuccessful', function (data) {
408
408
  });
409
409
  // or
410
410
  button.on('unavailable').then(function () {
411
- console.log('No button is available);
411
+ console.log('No button is available');
412
412
  });
413
413
  ```
414
414
  <a name="WalletButtons+onUnavailable" id="WalletButtons+onUnavailable" href="#WalletButtons+onUnavailable">&nbsp;</a>
@@ -184,7 +184,7 @@ of the corresponding event names.
184
184
 
185
185
  ```javascript
186
186
  button.on(EVENT.UNAVAILABLE, () => console.log("No wallet buttons available"));
187
- button.on(EVENT.UPDATE, (data) => console.log("Updating amount via a backend to backend call to POST charges/:id");
187
+ button.on(EVENT.UPDATE, (data) => console.log("Updating amount via a backend to backend call to POST charges/:id"));
188
188
  button.on(EVENT.PAYMENT_SUCCESSFUL, (data) => console.log("The payment was successful"));
189
189
  button.on(EVENT.PAYMENT_ERROR, (data) => console.log("The payment was not successful"));
190
190
  ```
package/package.json CHANGED
@@ -104,7 +104,7 @@
104
104
  }
105
105
  },
106
106
  "name": "@paydock/client-sdk",
107
- "version": "1.127.0",
107
+ "version": "1.128.2",
108
108
  "scripts": {
109
109
  "build:doc": "node docs/html/marked.js",
110
110
  "build:js": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",