@paydock/client-sdk 1.116.0-beta → 1.116.6-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 +230 -74
- package/bundles/index.cjs +1713 -446
- package/bundles/index.cjs.d.ts +2376 -2046
- package/bundles/index.mjs +1709 -443
- package/bundles/index.mjs.d.ts +2376 -2046
- package/bundles/types/api/api-base.d.ts +3 -3
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/api/api-checkout-internal.d.ts +1 -0
- package/bundles/types/api/api-checkout-internal.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/instruction-module.d.ts +1 -1
- package/bundles/types/checkout/helpers/instruction-module.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/resource-helper.d.ts +4 -3
- package/bundles/types/checkout/helpers/resource-helper.d.ts.map +1 -1
- package/bundles/types/checkout/helpers/session-helper.d.ts +3 -0
- package/bundles/types/checkout/helpers/session-helper.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.afterpay_checkout_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.payment_methods.show.d.ts.map +1 -1
- package/bundles/types/checkout/instructions/v1/instruction.zip_checkout_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts +1 -1
- package/bundles/types/checkout/layout-widgets/additionals.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/payment-methods-template.d.ts.map +1 -1
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts +1 -1
- package/bundles/types/checkout/layout-widgets/payment-methods.d.ts.map +1 -1
- package/bundles/types/components/iframe-event.d.ts +39 -29
- package/bundles/types/components/iframe-event.d.ts.map +1 -1
- package/bundles/types/components/iframe.d.ts +2 -2
- package/bundles/types/components/iframe.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/configs/env/environment.cba.d.ts +8 -7
- package/bundles/types/configs/env/environment.cba.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.interface.d.ts +6 -6
- package/bundles/types/configs/env/environment.interface.d.ts.map +1 -1
- package/bundles/types/configs/env/environment.paydock.d.ts +8 -7
- package/bundles/types/configs/env/environment.paydock.d.ts.map +1 -1
- package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts +9 -0
- package/bundles/types/fraud-prevention/fraud-prevention.constants.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts +42 -0
- package/bundles/types/fraud-prevention/fraud-prevention.events.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts +163 -0
- package/bundles/types/fraud-prevention/fraud-prevention.service.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/index.d.ts +3 -0
- package/bundles/types/fraud-prevention/index.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts +79 -0
- package/bundles/types/fraud-prevention/providers/forter/forter-device-agent.service.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts +2 -0
- package/bundles/types/fraud-prevention/providers/forter/templates/forter-snippet-2025-02-06t14:19:34z.template.d.ts.map +1 -0
- package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts +20 -0
- package/bundles/types/fraud-prevention/resources/find-service-config.repository.d.ts.map +1 -0
- package/bundles/types/helper/access-token.d.ts +1 -0
- package/bundles/types/helper/access-token.d.ts.map +1 -1
- package/bundles/types/helper/browser.d.ts.map +1 -1
- package/bundles/types/helper/custom-error.d.ts +8 -0
- package/bundles/types/helper/custom-error.d.ts.map +1 -0
- package/bundles/types/index-cba.d.ts +3 -1
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +2 -1
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/paypal-data-collector/paypal-data-collector.d.ts +4 -4
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts +0 -1
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.interfaces.d.ts.map +1 -1
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts +0 -1
- package/bundles/types/paypal-save-payment-source/paypal-save-payment-source.service.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/click-to-pay-secure-remote-commerce.d.ts +1 -1
- 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 +2 -1
- package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/interfaces.d.ts +2 -5
- 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.map +1 -1
- package/bundles/types/shared/http/authorization-strategy.d.ts +41 -0
- package/bundles/types/shared/http/authorization-strategy.d.ts.map +1 -0
- package/bundles/types/shared/http/http-fetcher.d.ts +28 -0
- package/bundles/types/shared/http/http-fetcher.d.ts.map +1 -0
- package/bundles/types/shared/http/http-fetcher.factory.d.ts +17 -0
- package/bundles/types/shared/http/http-fetcher.factory.d.ts.map +1 -0
- package/bundles/types/shared/http/http-request.d.ts +1 -1
- package/bundles/types/shared/http/http-request.d.ts.map +1 -1
- package/bundles/types/shared/http/http-response.dto.d.ts +19 -0
- package/bundles/types/shared/http/http-response.dto.d.ts.map +1 -0
- package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts +12 -0
- package/bundles/types/shared/services/configuration-validation/configuration-validation.d.ts.map +1 -0
- package/bundles/types/shared/services/configuration-validation/types.d.ts +73 -0
- package/bundles/types/shared/services/configuration-validation/types.d.ts.map +1 -0
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts +1 -1
- package/bundles/types/shared/services/instrumentation/instrumentation.types.d.ts.map +1 -1
- package/bundles/types/shared/shared.constants.d.ts +2 -0
- package/bundles/types/shared/shared.constants.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/enums.d.ts +12 -0
- package/bundles/types/wallet-buttons/enums.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index.d.ts +2 -1
- package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +28 -15
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts +10 -10
- package/bundles/types/wallet-buttons-express/base.wallet-button-express.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/index.d.ts +1 -0
- package/bundles/types/wallet-buttons-express/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts +1 -0
- package/bundles/types/wallet-buttons-express/services/paypal/interfaces/paypal-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/widget/configuration.d.ts +13 -9
- package/bundles/types/widget/configuration.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts +1 -2
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/types/widget/html-widget.d.ts +15 -14
- package/bundles/types/widget/html-widget.d.ts.map +1 -1
- package/bundles/types/widget/multi-widget.d.ts +5 -1
- package/bundles/types/widget/multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +1713 -446
- package/bundles/widget.umd.js.d.ts +2376 -2046
- package/bundles/widget.umd.js.min.d.ts +2376 -2046
- package/bundles/widget.umd.min.js +1 -61
- package/docs/api-widget.md +25 -20
- package/docs/click-to-pay-examples.md +0 -36
- package/docs/click-to-pay.md +1 -3
- package/docs/fraud-prevention-examples.md +139 -0
- package/docs/fraud-prevention.md +0 -0
- package/docs/install/npm.example.md +1 -1
- package/docs/paypal-data-collector-examples.md +6 -5
- package/docs/paypal-data-collector.md +6 -6
- package/docs/wallet-buttons-express.md +1 -0
- package/docs/wallet-buttons.md +1 -0
- package/docs/widget-examples.md +48 -3
- package/examples/multi-html-widget/extend.html +5 -0
- package/package.json +15 -10
- package/slate.md +181 -32
- package/bundles/types/shared/http/index.d.ts +0 -2
- package/bundles/types/shared/http/index.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -59,7 +59,7 @@ const widget = new Paydock.HtmlWidget('#selector', 'publicKey', 'gatewayId');
|
|
|
59
59
|
```
|
|
60
60
|
|
|
61
61
|
```js
|
|
62
|
-
// default import -
|
|
62
|
+
// default import - Not officially supported . They are handled differently by different tools / settings!
|
|
63
63
|
❌
|
|
64
64
|
import paydock from '@paydock/client-sdk'
|
|
65
65
|
>>> "Uncaught SyntaxError: The requested module does not provide an export named 'default'"
|
|
@@ -199,6 +199,20 @@ widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported
|
|
|
199
199
|
|
|
200
200
|
This example shows how you can use a lot of other methods to settings your form
|
|
201
201
|
|
|
202
|
+
|
|
203
|
+
### Error handling
|
|
204
|
+
|
|
205
|
+
```javascript
|
|
206
|
+
widget.on('error', (error) => {
|
|
207
|
+
const errorDiv = document.getElementById('error');
|
|
208
|
+
const errorMessage = document.getElementById('error-message');
|
|
209
|
+
|
|
210
|
+
errorMessage.textContent = error.data.message;
|
|
211
|
+
errorDiv.style.display = 'block';
|
|
212
|
+
});
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
|
|
202
216
|
### Full example
|
|
203
217
|
|
|
204
218
|
```html
|
|
@@ -214,7 +228,34 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
214
228
|
<div id="widget"
|
|
215
229
|
widget-style="text-color: #FFFFAA; border-color: #yellow"
|
|
216
230
|
title="Payment form"
|
|
217
|
-
finish-text="Payment resource was successfully accepted"
|
|
231
|
+
finish-text="Payment resource was successfully accepted">
|
|
232
|
+
</div>
|
|
233
|
+
|
|
234
|
+
<div
|
|
235
|
+
id="error"
|
|
236
|
+
style="
|
|
237
|
+
display: none;
|
|
238
|
+
max-width: 600px;
|
|
239
|
+
margin: 16px auto;
|
|
240
|
+
padding: 16px 20px;
|
|
241
|
+
border-radius: 8px;
|
|
242
|
+
background-color: #FEF2F2;
|
|
243
|
+
border: 1px solid #FEE2E2;
|
|
244
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
245
|
+
font-family: system-ui, -apple-system, sans-serif;
|
|
246
|
+
color: #991B1B;
|
|
247
|
+
line-height: 1.5;
|
|
248
|
+
font-size: 14px;
|
|
249
|
+
"
|
|
250
|
+
title="error"
|
|
251
|
+
>
|
|
252
|
+
<div style="display: flex; align-items: flex-start; gap: 12px;">
|
|
253
|
+
<div>
|
|
254
|
+
<h4 style="margin: 0 0 4px 0; font-size: 14px; font-weight: 600;">Access Error</h4>
|
|
255
|
+
<div id="error-message"></div>
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
218
259
|
</form>
|
|
219
260
|
|
|
220
261
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.js" ></script>
|
|
@@ -224,11 +265,15 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
224
265
|
widget.setSupportedCardIcons(['mastercard', 'visa']);
|
|
225
266
|
widget.setFormFields(['phone', 'email']);
|
|
226
267
|
widget.setRefId('custom-ref-id');
|
|
227
|
-
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
|
268
|
+
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
|
228
269
|
|
|
270
|
+
widget.on('error', (error) => {
|
|
271
|
+
document.getElementById('error-message').textContent = error.data.message;
|
|
272
|
+
document.getElementById('error').style.display = 'block';
|
|
273
|
+
});
|
|
229
274
|
widget.load();
|
|
230
275
|
</script>
|
|
231
|
-
|
|
276
|
+
|
|
232
277
|
</body>
|
|
233
278
|
</html>
|
|
234
279
|
```
|
|
@@ -250,6 +295,14 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
250
295
|
</dd>
|
|
251
296
|
</dl>
|
|
252
297
|
|
|
298
|
+
## Members
|
|
299
|
+
|
|
300
|
+
<dl>
|
|
301
|
+
<dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
|
|
302
|
+
<dd><p>Purposes</p>
|
|
303
|
+
</dd>
|
|
304
|
+
</dl>
|
|
305
|
+
|
|
253
306
|
## Constants
|
|
254
307
|
|
|
255
308
|
<dl>
|
|
@@ -262,9 +315,6 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
262
315
|
<dt><a href="#user-content-w_PAYMENT_TYPE">PAYMENT_TYPE</a> : <code>object</code></dt>
|
|
263
316
|
<dd><p>List of available payment source types</p>
|
|
264
317
|
</dd>
|
|
265
|
-
<dt><a href="#user-content-w_PURPOSE">PURPOSE</a> : <code>object</code></dt>
|
|
266
|
-
<dd><p>Purposes</p>
|
|
267
|
-
</dd>
|
|
268
318
|
<dt><a href="#user-content-w_FORM_FIELD">FORM_FIELD</a> : <code>object</code></dt>
|
|
269
319
|
<dd><p>Current constant include available type of fields which can be included to widget</p>
|
|
270
320
|
</dd>
|
|
@@ -796,10 +846,10 @@ The method to set meta information for the checkout page
|
|
|
796
846
|
|
|
797
847
|
```javascript
|
|
798
848
|
config.setMeta({
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
849
|
+
brand_name: 'paydock',
|
|
850
|
+
reference: '15',
|
|
851
|
+
email: 'wault@paydock.com'
|
|
852
|
+
});
|
|
803
853
|
```
|
|
804
854
|
<a name="w_HtmlMultiWidget+load" id="w_HtmlMultiWidget+load" href="#user-content-w_HtmlMultiWidget+load"> </a>
|
|
805
855
|
|
|
@@ -2502,6 +2552,19 @@ Method for setting a custom language code
|
|
|
2502
2552
|
```javascript
|
|
2503
2553
|
config.setLanguage('en');
|
|
2504
2554
|
```
|
|
2555
|
+
<a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE"> </a>
|
|
2556
|
+
|
|
2557
|
+
## PURPOSE : <code>object</code>
|
|
2558
|
+
Purposes
|
|
2559
|
+
|
|
2560
|
+
**Kind**: global variable
|
|
2561
|
+
|
|
2562
|
+
| Param | Type | Default |
|
|
2563
|
+
| --- | --- | --- |
|
|
2564
|
+
| PAYMENT_SOURCE | <code>string</code> | <code>"payment_source"</code> |
|
|
2565
|
+
| CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>"card_payment_source_with_cvv"</code> |
|
|
2566
|
+
| CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>"card_payment_source_without_cvv"</code> |
|
|
2567
|
+
|
|
2505
2568
|
<a name="w_EVENT" id="w_EVENT" href="#user-content-w_EVENT"> </a>
|
|
2506
2569
|
|
|
2507
2570
|
## EVENT : <code>object</code>
|
|
@@ -2551,19 +2614,6 @@ List of available payment source types
|
|
|
2551
2614
|
| BANK_ACCOUNT | <code>string</code> | <code>"bank_account"</code> |
|
|
2552
2615
|
| CHECKOUT | <code>string</code> | <code>"checkout"</code> |
|
|
2553
2616
|
|
|
2554
|
-
<a name="w_PURPOSE" id="w_PURPOSE" href="#user-content-w_PURPOSE"> </a>
|
|
2555
|
-
|
|
2556
|
-
## PURPOSE : <code>object</code>
|
|
2557
|
-
Purposes
|
|
2558
|
-
|
|
2559
|
-
**Kind**: global constant
|
|
2560
|
-
|
|
2561
|
-
| Param | Type | Default |
|
|
2562
|
-
| --- | --- | --- |
|
|
2563
|
-
| PAYMENT_SOURCE | <code>string</code> | <code>"payment_source"</code> |
|
|
2564
|
-
| CARD_PAYMENT_SOURCE_WITH_CVV | <code>string</code> | <code>"card_payment_source_with_cvv"</code> |
|
|
2565
|
-
| CARD_PAYMENT_SOURCE_WITHOUT_CVV | <code>string</code> | <code>"card_payment_source_without_cvv"</code> |
|
|
2566
|
-
|
|
2567
2617
|
<a name="w_FORM_FIELD" id="w_FORM_FIELD" href="#user-content-w_FORM_FIELD"> </a>
|
|
2568
2618
|
|
|
2569
2619
|
## FORM\_FIELD : <code>object</code>
|
|
@@ -5944,6 +5994,7 @@ Interface of data used by the wallet checkout and payment proccess.
|
|
|
5944
5994
|
| [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]. |
|
|
5945
5995
|
| [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]. |
|
|
5946
5996
|
| [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. |
|
|
5997
|
+
| [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. |
|
|
5947
5998
|
| [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. |
|
|
5948
5999
|
| [show_billing_address] | <code>boolean</code> | Used to hide/show the billing address on ApplePay and GooglePay popups. Default value is false. Optional for [ApplePay, GooglePay]. N/A for other wallets. |
|
|
5949
6000
|
| [request_payer_name] | <code>boolean</code> | Used mainly for fraud purposes - recommended set to true. Optional for [Stripe]. N/A for other wallets. |
|
|
@@ -6723,6 +6774,7 @@ For in-depth information, please refer to the [Paypal documentation](https://dev
|
|
|
6723
6774
|
| amount | <code>number</code> | Total amount of the transaction. Represents the money to be charged. |
|
|
6724
6775
|
| currency | <code>string</code> | Currency of the transaction in ISO 4217 currency code format. |
|
|
6725
6776
|
| [pay_later] | <code>boolean</code> | Flag to enable Pay Later feature of PayPal, allowing Pay in 4. Default false. |
|
|
6777
|
+
| [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. |
|
|
6726
6778
|
| [standalone] | <code>boolean</code> | Flag to specify if the PayPal standalone button should be used. Default false. |
|
|
6727
6779
|
| [capture] | <code>boolean</code> | Flag to specify if the transaction amount should be captured immediately or authorized for later capture. Default false. |
|
|
6728
6780
|
| [style] | <code>object</code> | Styling configurations for the PayPal widget. |
|
|
@@ -7629,42 +7681,6 @@ src.setStyles({
|
|
|
7629
7681
|
});
|
|
7630
7682
|
```
|
|
7631
7683
|
|
|
7632
|
-
## Recognition token
|
|
7633
|
-
|
|
7634
|
-
In order to store user information for further payments, click to pay provides a recognition token that is used to load user information.
|
|
7635
|
-
If you already have a recognitionToken stored, you can use it in meta to load the user information.
|
|
7636
|
-
|
|
7637
|
-
### Storage suggestions
|
|
7638
|
-
Merchant can store the tokens by dropping the token as a 1st party cookie in the browser, and must ensure to manage all the security aspects around dropping/storing the cookie by following the security standards:
|
|
7639
|
-
|
|
7640
|
-
- `Expiration Date=` cookie should be set to expire at a max 180 days
|
|
7641
|
-
- `Secure` flag
|
|
7642
|
-
- `httpOnly` flag
|
|
7643
|
-
- `sameSite=` strict
|
|
7644
|
-
- `Value=` recognition token JWT
|
|
7645
|
-
|
|
7646
|
-
### Example code
|
|
7647
|
-
|
|
7648
|
-
```javascript
|
|
7649
|
-
var src = new paydock.ClickToPay(
|
|
7650
|
-
"#checkoutIframe",
|
|
7651
|
-
"service_id",
|
|
7652
|
-
"paydock_public_key",
|
|
7653
|
-
{
|
|
7654
|
-
"recognition_token": "eyJraWQiOiIy...",
|
|
7655
|
-
},
|
|
7656
|
-
);
|
|
7657
|
-
src.on('recognitionTokenRequested', (data) => {
|
|
7658
|
-
console.log('Recognition token was found: ' + data.data.recognitionToken);
|
|
7659
|
-
// Add recognition token to your store
|
|
7660
|
-
});
|
|
7661
|
-
|
|
7662
|
-
src.on('recognitionTokenDropped', () => {
|
|
7663
|
-
console.log('Recognition token was droped');
|
|
7664
|
-
// Delete recognition token from your store
|
|
7665
|
-
});
|
|
7666
|
-
```
|
|
7667
|
-
|
|
7668
7684
|
## Classes
|
|
7669
7685
|
|
|
7670
7686
|
<dl>
|
|
@@ -7745,7 +7761,6 @@ Interface of data used for the Mastercard Checkout. For further information refe
|
|
|
7745
7761
|
| [customer.phone.country_code] | <code>string</code> | Customer phone country code (example "1" for US). |
|
|
7746
7762
|
| [customer.phone.phone] | <code>string</code> | Customer phone number. |
|
|
7747
7763
|
| [unaccepted_card_type] | <code>string</code> | Used to block a specific card type. Options are 'CREDIT', 'DEBIT'. |
|
|
7748
|
-
| [recognition_token] | <code>string</code> | Used for Click to Pay to load user information and preferences. |
|
|
7749
7764
|
|
|
7750
7765
|
<a name="EventData" id="EventData" href="#EventData"> </a>
|
|
7751
7766
|
|
|
@@ -7771,6 +7786,7 @@ When the flow type is src, masked checkoutData available is also returned
|
|
|
7771
7786
|
| --- | --- | --- |
|
|
7772
7787
|
| type | <code>string</code> | type of the checkout, can be `src` or `manual`. |
|
|
7773
7788
|
| token | <code>string</code> | one time token value. |
|
|
7789
|
+
| token_type | <code>string</code> | one time token type value, can be `card` or `card_scheme_token`. |
|
|
7774
7790
|
| [checkoutData] | <code>object</code> | Optional checkout data related to the checkout information. Only available on src flow. |
|
|
7775
7791
|
| [checkoutData.card_number_bin] | <code>string</code> | The BIN of the card used for the transaction. |
|
|
7776
7792
|
| [checkoutData.card_number_last4] | <code>string</code> | The last four digits of the card number. |
|
|
@@ -7988,8 +8004,6 @@ List of available event's name in the Click To Pay checkout lifecycle
|
|
|
7988
8004
|
| CHECKOUT_POPUP_CLOSE | <code>string</code> | <code>"checkoutPopupClose"</code> | Event sent when Click To Pay checkout flow is closed, regardless of embedded or windowed mode. |
|
|
7989
8005
|
| CHECKOUT_COMPLETED | <code>string</code> | <code>"checkoutCompleted"</code> | Event sent on successful checkout by customer. Check [data](#EventDataCheckoutCompletedData) for more information. |
|
|
7990
8006
|
| CHECKOUT_ERROR | <code>string</code> | <code>"checkoutError"</code> | Event sent on error checkout by customer. Check [data](#EventData) for more information. |
|
|
7991
|
-
| RECOGNITION_TOKEN_REQUESTED | <code>string</code> | <code>"recognitionTokenRequested"</code> | Event sent when a recognition token was found on the mastercard SDK response. |
|
|
7992
|
-
| RECOGNITION_TOKEN_DROPPED | <code>string</code> | <code>"recognitionTokenDropped"</code> | Event sent when a recognition token needs to be dropped for user be no longer remembered. |
|
|
7993
8007
|
|
|
7994
8008
|
<a name="EVENT_DATA_TYPE" id="EVENT_DATA_TYPE" href="#EVENT_DATA_TYPE"> </a>
|
|
7995
8009
|
|
|
@@ -8005,6 +8019,147 @@ List of available event data types
|
|
|
8005
8019
|
| SUCCESS | <code>string</code> | <code>"Success"</code> | |
|
|
8006
8020
|
|
|
8007
8021
|
|
|
8022
|
+
# Fraud prevention
|
|
8023
|
+
|
|
8024
|
+
The Fraud Prevention module allows you to add security layers to your payment workflows
|
|
8025
|
+
by integrating with any of our underlying fraud prevention providers.
|
|
8026
|
+
|
|
8027
|
+
## Real time user behavior analysis
|
|
8028
|
+
|
|
8029
|
+
### Forter
|
|
8030
|
+
|
|
8031
|
+
One of Forter's key features is our ability to track the user's real-time behavior on
|
|
8032
|
+
the site and use it to separate fraudsters from legitimate buyers. To take advantage
|
|
8033
|
+
of Forter's technology, a JavaScript snippet needs to be placed on EVERY page
|
|
8034
|
+
of your commerce site beginning with the homepage and up to and including the final
|
|
8035
|
+
"Thank you for your purchase" page.
|
|
8036
|
+
|
|
8037
|
+
The integration is simple and straightforward - you only need to configure event
|
|
8038
|
+
listeners and then instantiate a FraudPreventionService with your site configuration.
|
|
8039
|
+
|
|
8040
|
+
Additional setup is required in case your website uses Content Security Policies (CSP)
|
|
8041
|
+
|
|
8042
|
+
#### Forter: Code snippet
|
|
8043
|
+
|
|
8044
|
+
```html
|
|
8045
|
+
<!doctype html>
|
|
8046
|
+
<html lang="en">
|
|
8047
|
+
|
|
8048
|
+
<head>
|
|
8049
|
+
<meta charset="utf-8">
|
|
8050
|
+
<title>Real time user behaviour anaylsis - Forter example</title>
|
|
8051
|
+
<base href="/">
|
|
8052
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8053
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico">
|
|
8054
|
+
<script src="../../../bundles/widget.umd.js"></script>
|
|
8055
|
+
</head>
|
|
8056
|
+
|
|
8057
|
+
<body>
|
|
8058
|
+
<main>
|
|
8059
|
+
<h1>Real time user behaviour anaylsis - Forter example</h1>
|
|
8060
|
+
<div class="forter-test">
|
|
8061
|
+
<h2>Forter Integration Test</h2>
|
|
8062
|
+
<div class="status-card">
|
|
8063
|
+
<p>
|
|
8064
|
+
<strong>Integration Status:</strong>
|
|
8065
|
+
<span data-fraud-prevention="status-indicator" class="status pending">
|
|
8066
|
+
Pending
|
|
8067
|
+
</span>
|
|
8068
|
+
</p>
|
|
8069
|
+
<p>
|
|
8070
|
+
<strong>Token Value:</strong>
|
|
8071
|
+
<code data-fraud-prevention="forter-token">Not available</code>
|
|
8072
|
+
</p>
|
|
8073
|
+
<p data-fraud-prevention="error-container" style="display: none;">
|
|
8074
|
+
<strong>Error Code:</strong>
|
|
8075
|
+
<span data-fraud-prevention="error-code" class="error"></span>
|
|
8076
|
+
</p>
|
|
8077
|
+
</div>
|
|
8078
|
+
</div>
|
|
8079
|
+
</main>
|
|
8080
|
+
<script>
|
|
8081
|
+
const { FRAUD_PREVENTION_EVENTS, FraudPreventionService } = window.paydock
|
|
8082
|
+
|
|
8083
|
+
let token = '';
|
|
8084
|
+
let errorCode = '';
|
|
8085
|
+
|
|
8086
|
+
const render = () => {
|
|
8087
|
+
const statusIndicator = document.querySelector('[data-fraud-prevention="status-indicator"]');
|
|
8088
|
+
const tokenValue = document.querySelector('[data-fraud-prevention="forter-token"]');
|
|
8089
|
+
const errorContainer = document.querySelector('[data-fraud-prevention="error-container"]');
|
|
8090
|
+
const errorCodeElement = document.querySelector('[data-fraud-prevention="error-code"]');
|
|
8091
|
+
|
|
8092
|
+
if (token) {
|
|
8093
|
+
statusIndicator.className = 'status success';
|
|
8094
|
+
statusIndicator.textContent = 'Active';
|
|
8095
|
+
tokenValue.textContent = token;
|
|
8096
|
+
} else {
|
|
8097
|
+
statusIndicator.className = 'status pending';
|
|
8098
|
+
statusIndicator.textContent = 'Pending';
|
|
8099
|
+
tokenValue.textContent = 'Not available';
|
|
8100
|
+
}
|
|
8101
|
+
|
|
8102
|
+
if (errorCode) {
|
|
8103
|
+
errorCodeElement.textContent = errorCode;
|
|
8104
|
+
errorContainer.style.display = 'block';
|
|
8105
|
+
} else {
|
|
8106
|
+
errorContainer.style.display = 'none';
|
|
8107
|
+
}
|
|
8108
|
+
};
|
|
8109
|
+
|
|
8110
|
+
document.addEventListener(FRAUD_PREVENTION_EVENTS.NAMESPACE, (event) => {
|
|
8111
|
+
switch (event.detail.type) {
|
|
8112
|
+
case FRAUD_PREVENTION_EVENTS.TYPES.FINGERPRINT_TOKEN_READY: {
|
|
8113
|
+
token = event.detail.payload.token;
|
|
8114
|
+
break;
|
|
8115
|
+
}
|
|
8116
|
+
case FRAUD_PREVENTION_EVENTS.TYPES.FINGERPRINT_TOKEN_READY: {
|
|
8117
|
+
errorCode = event.detail.payload.code;
|
|
8118
|
+
break;
|
|
8119
|
+
}
|
|
8120
|
+
default: {
|
|
8121
|
+
throw new Error(
|
|
8122
|
+
`${FRAUD_PREVENTION_EVENTS.NAMESPACE} emitted an unsupported event: ${JSON.stringify(event.detail)}.`,
|
|
8123
|
+
);
|
|
8124
|
+
}
|
|
8125
|
+
}
|
|
8126
|
+
|
|
8127
|
+
render();
|
|
8128
|
+
});
|
|
8129
|
+
|
|
8130
|
+
// Bring your own site ID
|
|
8131
|
+
new FraudPreventionService().withForter({
|
|
8132
|
+
siteId: 'YOUR_SITE_ID_OR_SUBSITE_ID',
|
|
8133
|
+
mode: 'test',
|
|
8134
|
+
csp: false, // Set to csp to true if your website uses Content-Security-Policies
|
|
8135
|
+
});
|
|
8136
|
+
|
|
8137
|
+
// Use paydock integrated registration
|
|
8138
|
+
new FraudPreventionService().withAuthorization('pk_example_...').withForter({
|
|
8139
|
+
providerId: 'YOUR_PAYDOCK_FORTER_SERVICE_ID',
|
|
8140
|
+
mode: 'test',
|
|
8141
|
+
csp: false, // Set to csp to true if your website uses Content-Security-Policies
|
|
8142
|
+
});
|
|
8143
|
+
</script>
|
|
8144
|
+
</body>
|
|
8145
|
+
|
|
8146
|
+
</html>
|
|
8147
|
+
```
|
|
8148
|
+
|
|
8149
|
+
#### Forter: Content Security Policies
|
|
8150
|
+
|
|
8151
|
+
If your site enforces Content Security Policies (CSP), make sure to:
|
|
8152
|
+
|
|
8153
|
+
1. Set the `csp` option to `true` when invoking `withForter` on your `FraudPreventionService` instance.
|
|
8154
|
+
2. Allowlist Forter's domains on `connect-src`, `script-src` and `worker-src` as shown below.
|
|
8155
|
+
|
|
8156
|
+
```bash
|
|
8157
|
+
connect-src https://*.forter.com wss://cdn0.forter.com https://d2o5idwacg3gyw.cloudfront.net https://dz8rit8v72mig.cloudfront.net https://db7q4jg5rkhk8.cloudfront.net https://1.1.1.1 https://d94qwxh6czci4.cloudfront.net https://dr6vcclmzwk74.cloudfront.net https://d6rak4b14t5gp.cloudfront.net https://d3k4bt74u9esq1.cloudfront.net https://d1ezzflfzltk6e.cloudfront.net https://d3nocrch4qti4v.cloudfront.net https://duuytoqss3gu4.cloudfront.net https://df45ay5pw60dy.cloudfront.net
|
|
8158
|
+
script-src https://*.forter.com https://dlthst9q2beh8.cloudfront.net https://d2nww8zpyj5pk0.cloudfront.net https://d2w2nqfk3z9hdt.cloudfront.net
|
|
8159
|
+
worker-src blob:
|
|
8160
|
+
```
|
|
8161
|
+
|
|
8162
|
+
|
|
8008
8163
|
## PayPalSavePaymentSource Widget
|
|
8009
8164
|
|
|
8010
8165
|
PayPalSavePaymentSource Widget allows to obtain a Paydock one time token linked with a Paypal payment source from the customer.
|
|
@@ -8365,7 +8520,7 @@ A full description of the config parameters for [PayPalDataCollector](#PayPalDat
|
|
|
8365
8520
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
8366
8521
|
<script>
|
|
8367
8522
|
let payPalDataCollector = new paydock.PayPalDataCollector(
|
|
8368
|
-
|
|
8523
|
+
'FLOW_ID',
|
|
8369
8524
|
{
|
|
8370
8525
|
mouse_movement: true
|
|
8371
8526
|
}
|
|
@@ -8377,10 +8532,11 @@ A full description of the config parameters for [PayPalDataCollector](#PayPalDat
|
|
|
8377
8532
|
console.log("On Error Callback", error);
|
|
8378
8533
|
});
|
|
8379
8534
|
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8535
|
+
payPalDataCollector.collectDeviceData().then(function(collectedDeviceData) {
|
|
8536
|
+
//Here when the promise is resolved, it should be able to see the correlation_id.
|
|
8537
|
+
const correlationId = collectedDeviceData.correlation_id;
|
|
8538
|
+
console.log("On Success", correlationId);
|
|
8539
|
+
});
|
|
8384
8540
|
</script>
|
|
8385
8541
|
</html>
|
|
8386
8542
|
```
|
|
@@ -8456,19 +8612,19 @@ PayPal Data Collector Widget constructor
|
|
|
8456
8612
|
**Kind**: global class
|
|
8457
8613
|
|
|
8458
8614
|
* [PayPalDataCollector](#PayPalDataCollector)
|
|
8459
|
-
* [new PayPalDataCollector(flowId, config)](#new_PayPalDataCollector_new)
|
|
8615
|
+
* [new PayPalDataCollector([flowId], [config])](#new_PayPalDataCollector_new)
|
|
8460
8616
|
* [.collectDeviceData()](#PayPalDataCollector+collectDeviceData) ⇒ [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData)
|
|
8461
8617
|
* [.onError([callback])](#PayPalDataCollector+onError)
|
|
8462
8618
|
* [.setEnv(env)](#PayPalDataCollector+setEnv)
|
|
8463
8619
|
|
|
8464
8620
|
<a name="new_PayPalDataCollector_new" id="new_PayPalDataCollector_new" href="#new_PayPalDataCollector_new"> </a>
|
|
8465
8621
|
|
|
8466
|
-
### new PayPalDataCollector(flowId, config)
|
|
8622
|
+
### new PayPalDataCollector([flowId], [config])
|
|
8467
8623
|
|
|
8468
8624
|
| Param | Type | Description |
|
|
8469
8625
|
| --- | --- | --- |
|
|
8470
|
-
| flowId | <code>string</code> | This string identifies the source website of the FraudNet request. |
|
|
8471
|
-
| config | [<code>PayPalDataCollectorConfig</code>](#PayPalDataCollectorConfig) | Extra configuration for the widget. |
|
|
8626
|
+
| [flowId] | <code>string</code> | This string identifies the source website of the FraudNet request. |
|
|
8627
|
+
| [config] | [<code>PayPalDataCollectorConfig</code>](#PayPalDataCollectorConfig) | Extra configuration for the widget. |
|
|
8472
8628
|
|
|
8473
8629
|
**Example**
|
|
8474
8630
|
```js
|
|
@@ -8478,10 +8634,10 @@ var payPalDataCollector = new PayPalDataCollector('FLOW_ID', {});
|
|
|
8478
8634
|
|
|
8479
8635
|
### payPalDataCollector.collectDeviceData() ⇒ [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData)
|
|
8480
8636
|
After configuring the PayPalDataCollector Widget, starts the process and returns
|
|
8481
|
-
the correlation id used among the requests.
|
|
8637
|
+
the correlation id used among the requests asynchronously.
|
|
8482
8638
|
|
|
8483
8639
|
**Kind**: instance method of [<code>PayPalDataCollector</code>](#PayPalDataCollector)
|
|
8484
|
-
**Returns**: [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData) - Promise when resolved,
|
|
8640
|
+
**Returns**: [<code>Promise.<CollectedDeviceData></code>](#CollectedDeviceData) - Promise when resolved, returns an object
|
|
8485
8641
|
that contains the `correlation_id` key.
|
|
8486
8642
|
**Example**
|
|
8487
8643
|
```js
|