@paydock/client-sdk 1.104.1-beta → 1.104.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 +732 -409
- package/bundles/index.cjs +1689 -1907
- package/bundles/index.cjs.d.ts +420 -377
- package/bundles/index.cjs.map +1 -1
- package/bundles/index.mjs +1689 -1907
- package/bundles/index.mjs.d.ts +420 -377
- package/bundles/index.mjs.map +1 -1
- package/bundles/types/api/api-service-internal.d.ts +2 -1
- package/bundles/types/api/api-service-internal.d.ts.map +1 -1
- package/bundles/types/api/api.d.ts +1 -1
- package/bundles/types/api/api.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts +1 -1
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -1
- package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts +1 -1
- package/bundles/types/checkout-button/afterpay/afterpay-checkout-button.d.ts.map +1 -1
- package/bundles/types/checkout-button/checkout-button.d.ts +1 -1
- package/bundles/types/checkout-button/checkout-button.d.ts.map +1 -1
- package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts +1 -1
- package/bundles/types/checkout-button/paypal/paypal-checkout-button.d.ts.map +1 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts +1 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney-checkout-button.d.ts.map +1 -1
- package/bundles/types/components/container.d.ts +1 -0
- package/bundles/types/components/container.d.ts.map +1 -1
- package/bundles/types/components/{form-Interceptor.d.ts → form-interceptor.d.ts} +1 -1
- package/bundles/types/components/{form-Interceptor.d.ts.map → form-interceptor.d.ts.map} +1 -1
- package/bundles/types/components/iframe-event.d.ts +17 -11
- package/bundles/types/components/iframe-event.d.ts.map +1 -1
- package/bundles/types/components/link.d.ts +3 -2
- package/bundles/types/components/link.d.ts.map +1 -1
- package/bundles/types/components/param.d.ts +6 -8
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/components/wallet-background.d.ts +2 -1
- package/bundles/types/components/wallet-background.d.ts.map +1 -1
- package/bundles/types/constants/validators.d.ts +45 -0
- package/bundles/types/constants/validators.d.ts.map +1 -0
- package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts +17 -13
- package/bundles/types/payment-source-widget/html-payment-source-widget.d.ts.map +1 -1
- package/bundles/types/payment-source-widget/payment-source-widget.d.ts +1 -1
- package/bundles/types/payment-source-widget/payment-source-widget.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/index.d.ts +102 -1
- package/bundles/types/secure-remote-commerce/index.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/interfaces.d.ts +109 -32
- package/bundles/types/secure-remote-commerce/interfaces.d.ts.map +1 -1
- package/bundles/types/secure-remote-commerce/mastercard-secure-remote-commerce.d.ts +31 -0
- package/bundles/types/secure-remote-commerce/mastercard-secure-remote-commerce.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/index.d.ts +2 -0
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/index.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/providers/{visa-src/visa-src.d.ts → mastercard-src/mastercard-src.d.ts} +5 -8
- package/bundles/types/secure-remote-commerce/providers/mastercard-src/mastercard-src.d.ts.map +1 -0
- package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts +13 -91
- package/bundles/types/secure-remote-commerce/secure-remote-commerce.d.ts.map +1 -1
- package/bundles/types/vault-display-widget/vault-display-widget.d.ts +1 -1
- package/bundles/types/vault-display-widget/vault-display-widget.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/apple.wallet-service.d.ts +2 -0
- package/bundles/types/wallet-buttons/apple.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts +8 -1
- package/bundles/types/wallet-buttons/flypay-v2.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/google.wallet-service.d.ts +3 -0
- package/bundles/types/wallet-buttons/google.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/helpers/flypay-v2.helper.d.ts +4 -0
- package/bundles/types/wallet-buttons/helpers/flypay-v2.helper.d.ts.map +1 -0
- package/bundles/types/wallet-buttons/index.d.ts +126 -0
- package/bundles/types/wallet-buttons/index.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/interfaces.d.ts +3 -0
- package/bundles/types/wallet-buttons/interfaces.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/paypal.wallet-service.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts +63 -121
- package/bundles/types/wallet-buttons/wallet-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts +1 -1
- package/bundles/types/wallet-buttons/wallet-cba-buttons.d.ts.map +1 -1
- package/bundles/types/wallet-buttons/wallet-service.d.ts +7 -0
- package/bundles/types/wallet-buttons/wallet-service.d.ts.map +1 -1
- package/bundles/types/widget/configuration.d.ts +1 -1
- package/bundles/types/widget/configuration.d.ts.map +1 -1
- package/bundles/types/widget/html-multi-widget.d.ts +146 -75
- package/bundles/types/widget/html-multi-widget.d.ts.map +1 -1
- package/bundles/types/widget/html-widget.d.ts +1 -1
- package/bundles/types/widget/html-widget.d.ts.map +1 -1
- package/bundles/types/widget/multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +1689 -1907
- package/bundles/widget.umd.js.d.ts +420 -377
- package/bundles/widget.umd.js.map +1 -1
- package/bundles/widget.umd.js.min.d.ts +420 -377
- package/bundles/widget.umd.min.js +1 -1
- package/bundles/widget.umd.min.js.map +1 -1
- package/docs/api-ps-widget.md +12 -12
- package/docs/api-widget.md +211 -156
- package/docs/install/umd.content.md +3 -4
- package/docs/install.md +4 -14
- package/docs/license.md +1 -1
- package/docs/secure-remote-commerce-examples.md +75 -101
- package/docs/secure-remote-commerce.md +185 -114
- package/docs/wallet-buttons-examples.md +48 -19
- package/docs/wallet-buttons.md +197 -2
- package/package.json +1 -1
- package/slate.md +126 -124
- package/bundles/types/secure-remote-commerce/providers/visa-src/helper.d.ts +0 -8
- package/bundles/types/secure-remote-commerce/providers/visa-src/helper.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/providers/visa-src/index.d.ts +0 -2
- package/bundles/types/secure-remote-commerce/providers/visa-src/index.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/providers/visa-src/visa-src.d.ts.map +0 -1
- package/bundles/types/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +0 -9
- package/bundles/types/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -69,10 +69,9 @@ import paydock from '@paydock/client-sdk'
|
|
|
69
69
|
### Download from CDN
|
|
70
70
|
|
|
71
71
|
For browser environments, you can import the Client SDK directly from our CDN to
|
|
72
|
-
your project's HTML. To accomplish this
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
variable `paydock`.
|
|
72
|
+
your project's HTML. To accomplish this, include the Client SDK in your page
|
|
73
|
+
using one and only of the two script tags below. After this step you will be
|
|
74
|
+
able to access the Client SDK features via the global variable `paydock`.
|
|
76
75
|
|
|
77
76
|
For production we recommend using the compressed version (`.min.js`) since
|
|
78
77
|
it will result in faster loading times for your end users.
|
|
@@ -287,6 +286,12 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
287
286
|
<dt><a href="#user-content-w_STYLABLE_ELEMENT_STATE">STYLABLE_ELEMENT_STATE</a> : <code>object</code></dt>
|
|
288
287
|
<dd><p>Current constant include available states of element for styling</p>
|
|
289
288
|
</dd>
|
|
289
|
+
<dt><a href="#user-content-w_CARD_VALIDATORS">CARD_VALIDATORS</a> : <code>Record.<string, string></code></dt>
|
|
290
|
+
<dd><p>List of available form field validators dedicated to cards and their definition</p>
|
|
291
|
+
</dd>
|
|
292
|
+
<dt><a href="#user-content-w_GENERIC_VALIDATORS">GENERIC_VALIDATORS</a> : <code>Record.<string, string></code></dt>
|
|
293
|
+
<dd><p>List of available generic form field validators and their definition</p>
|
|
294
|
+
</dd>
|
|
290
295
|
<dt><a href="#user-content-w_TRIGGER">TRIGGER</a> : <code>object</code></dt>
|
|
291
296
|
<dd><p>List of available triggers</p>
|
|
292
297
|
</dd>
|
|
@@ -299,7 +304,8 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
299
304
|
<dd><p>Interface of data from validation event.</p>
|
|
300
305
|
</dd>
|
|
301
306
|
<dt><a href="#user-content-w_IEventMetaData">IEventMetaData</a></dt>
|
|
302
|
-
<dd><p>
|
|
307
|
+
<dd><p>Contains basic information associated with the event and additional meta data
|
|
308
|
+
specific to the event. E.g., card info, gateway info, etc.</p>
|
|
303
309
|
</dd>
|
|
304
310
|
<dt><a href="#user-content-w_IEventAfterLoadData">IEventAfterLoadData</a></dt>
|
|
305
311
|
<dd><p>Interface of data from event.</p>
|
|
@@ -348,33 +354,34 @@ Interface of data from validation event.
|
|
|
348
354
|
|
|
349
355
|
| Param | Type | Description |
|
|
350
356
|
| --- | --- | --- |
|
|
351
|
-
| event | <code>string</code> |
|
|
352
|
-
|
|
|
353
|
-
|
|
|
354
|
-
| [ref_id] | <code>string</code> | Custom value
|
|
355
|
-
| [form_valid] | <code>boolean</code> |
|
|
356
|
-
| [invalid_fields] | <code>
|
|
357
|
-
| [invalid_showed_fields] | <code>
|
|
358
|
-
| [validators] | <code>
|
|
357
|
+
| event | <code>string</code> | The name of the event. |
|
|
358
|
+
| message_source | <code>string</code> | A system variable that identifies the event source. |
|
|
359
|
+
| purpose | <code>string</code> | A system variable that states the purpose of the event. |
|
|
360
|
+
| [ref_id] | <code>string</code> | Custom unique value that identifies result of processed operation. |
|
|
361
|
+
| [form_valid] | <code>boolean</code> | Indicates wether or not the form is valid. |
|
|
362
|
+
| [invalid_fields] | <code>Array.<string></code> | Names of form fields with invalid data. |
|
|
363
|
+
| [invalid_showed_fields] | <code>Array.<string></code> | Names of invalid form fields which are already displaying the error. |
|
|
364
|
+
| [validators] | <code>Partial.<Record.<(CardValidatorValue\|GenericValidatorValue), Array.<string>>></code> | Object containing validator identifiers as keys and the fields subject to that validator as an array of form field names. See list of available [Generic Vallidators](#user-content-w_GENERIC_VALIDATORS) and [Card Validators](#user-content-w_CARD_VALIDATORS), |
|
|
359
365
|
|
|
360
366
|
<a name="w_IEventMetaData" id="w_IEventMetaData" href="#user-content-w_IEventMetaData"> </a>
|
|
361
367
|
|
|
362
368
|
## IEventMetaData
|
|
363
|
-
|
|
369
|
+
Contains basic information associated with the event and additional meta data
|
|
370
|
+
specific to the event. E.g., card info, gateway info, etc.
|
|
364
371
|
|
|
365
372
|
**Kind**: global interface
|
|
366
373
|
|
|
367
374
|
| Param | Type | Description |
|
|
368
375
|
| --- | --- | --- |
|
|
369
|
-
| event | <code>string</code> |
|
|
370
|
-
| purpose | <code>string</code> |
|
|
371
|
-
| message_source | <code>string</code> |
|
|
372
|
-
| [ref_id] | <code>string</code> | Custom value
|
|
376
|
+
| event | <code>string</code> | The name of the event. |
|
|
377
|
+
| purpose | <code>string</code> | A system variable that states the purpose of the event. |
|
|
378
|
+
| message_source | <code>string</code> | A system variable that identifies the event source. |
|
|
379
|
+
| [ref_id] | <code>string</code> | Custom unique value that identifies result of processed operation. |
|
|
373
380
|
| configuration_token | <code>string</code> | Token received from our API with widget data |
|
|
374
381
|
| type | <code>string</code> | Payment type 'card', 'bank_account' |
|
|
375
382
|
| gateway_type | <code>string</code> | Gateway type |
|
|
376
383
|
| [card_number_last4] | <code>string</code> | Last 4 digit of your card |
|
|
377
|
-
| [card_scheme] | <code>string</code> | Card scheme |
|
|
384
|
+
| [card_scheme] | <code>string</code> | Card scheme, e.g., (Visa, Mastercard and American Express (AmEx)) |
|
|
378
385
|
| [card_number_length] | <code>number</code> | Card number length |
|
|
379
386
|
| [account_name] | <code>string</code> | Bank account account name |
|
|
380
387
|
| [account_number] | <code>string</code> | Bank account account number |
|
|
@@ -388,10 +395,10 @@ Interface of data from event.
|
|
|
388
395
|
|
|
389
396
|
| Param | Type | Description |
|
|
390
397
|
| --- | --- | --- |
|
|
391
|
-
| event | <code>string</code> |
|
|
392
|
-
| purpose | <code>string</code> |
|
|
393
|
-
| message_source | <code>string</code> |
|
|
394
|
-
| [ref_id] | <code>string</code> | Custom value
|
|
398
|
+
| event | <code>string</code> | The name of the event. |
|
|
399
|
+
| purpose | <code>string</code> | A system variable that states the purpose of the event. |
|
|
400
|
+
| message_source | <code>string</code> | A system variable that identifies the event source. |
|
|
401
|
+
| [ref_id] | <code>string</code> | Custom unique value that identifies result of processed operation. |
|
|
395
402
|
|
|
396
403
|
<a name="w_IEventFinishData" id="w_IEventFinishData" href="#user-content-w_IEventFinishData"> </a>
|
|
397
404
|
|
|
@@ -402,10 +409,10 @@ Interface of data from event.
|
|
|
402
409
|
|
|
403
410
|
| Param | Type | Description |
|
|
404
411
|
| --- | --- | --- |
|
|
405
|
-
| event | <code>string</code> |
|
|
406
|
-
| purpose | <code>string</code> |
|
|
407
|
-
| message_source | <code>string</code> |
|
|
408
|
-
| [ref_id] | <code>string</code> | Custom value
|
|
412
|
+
| event | <code>string</code> | The name of the event. |
|
|
413
|
+
| purpose | <code>string</code> | A system variable that states the purpose of the event. |
|
|
414
|
+
| message_source | <code>string</code> | A system variable that identifies the event source. |
|
|
415
|
+
| [ref_id] | <code>string</code> | Custom unique value that identifies result of processed operation. |
|
|
409
416
|
| payment_source | <code>string</code> | One time token. Result from this endpoint [API docs](https://docs.paydock.com/#tokens) |
|
|
410
417
|
|
|
411
418
|
<a name="w_IPayPalMeta" id="w_IPayPalMeta" href="#user-content-w_IPayPalMeta"> </a>
|
|
@@ -619,7 +626,7 @@ Class Widget include method for working on html and include extended by HtmlMult
|
|
|
619
626
|
* [.setFormElements(elements)](#user-content-w_HtmlWidget+setFormElements)
|
|
620
627
|
* [.setMeta(object)](#user-content-w_HtmlWidget+setMeta)
|
|
621
628
|
* [.load()](#user-content-w_HtmlMultiWidget+load)
|
|
622
|
-
* [.
|
|
629
|
+
* [.afterLoad()](#user-content-w_HtmlMultiWidget+afterLoad)
|
|
623
630
|
* [.trigger(triggers, data)](#user-content-w_HtmlMultiWidget+trigger)
|
|
624
631
|
* [.getValidationState()](#user-content-w_HtmlMultiWidget+getValidationState) ⇒ [<code>IFormValidation</code>](#user-content-w_IFormValidation)
|
|
625
632
|
* [.isValidForm()](#user-content-w_HtmlMultiWidget+isValidForm) ⇒ <code>boolean</code>
|
|
@@ -632,6 +639,7 @@ Class Widget include method for working on html and include extended by HtmlMult
|
|
|
632
639
|
* [.hideElements(elements)](#user-content-w_HtmlMultiWidget+hideElements)
|
|
633
640
|
* [.showElements(elements)](#user-content-w_HtmlMultiWidget+showElements)
|
|
634
641
|
* [.updateFormValues(fieldValues)](#user-content-w_HtmlMultiWidget+updateFormValues)
|
|
642
|
+
* [.updateFormValue(key, value)](#user-content-w_HtmlMultiWidget+updateFormValue)
|
|
635
643
|
* [.onFinishInsert(selector, dataType)](#user-content-w_HtmlMultiWidget+onFinishInsert)
|
|
636
644
|
* [.interceptSubmitForm(selector)](#user-content-w_HtmlMultiWidget+interceptSubmitForm)
|
|
637
645
|
* [.useCheckoutAutoSubmit()](#user-content-w_HtmlMultiWidget+useCheckoutAutoSubmit)
|
|
@@ -796,51 +804,38 @@ config.setMeta({
|
|
|
796
804
|
<a name="w_HtmlMultiWidget+load" id="w_HtmlMultiWidget+load" href="#user-content-w_HtmlMultiWidget+load"> </a>
|
|
797
805
|
|
|
798
806
|
### htmlWidget.load()
|
|
799
|
-
|
|
807
|
+
Loads the widget.
|
|
808
|
+
|
|
809
|
+
Calling this method results in an iframe element being inserted and rendered in the DOM.
|
|
800
810
|
|
|
801
811
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
802
812
|
**Overrides**: [<code>load</code>](#user-content-w_HtmlMultiWidget+load)
|
|
803
|
-
<a name="w_HtmlMultiWidget+
|
|
813
|
+
<a name="w_HtmlMultiWidget+afterLoad" id="w_HtmlMultiWidget+afterLoad" href="#user-content-w_HtmlMultiWidget+afterLoad"> </a>
|
|
804
814
|
|
|
805
|
-
### htmlWidget.
|
|
806
|
-
|
|
815
|
+
### htmlWidget.afterLoad()
|
|
816
|
+
Registers a form validation callback for validation events.
|
|
807
817
|
|
|
808
818
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
809
|
-
**Overrides**: [<code>
|
|
810
|
-
|
|
811
|
-
| Param | Type | Description |
|
|
812
|
-
| --- | --- | --- |
|
|
813
|
-
| eventName | <code>string</code> | Available event names [EVENT](#user-content-w_EVENT) |
|
|
814
|
-
| [cb] | <code>listener</code> | |
|
|
815
|
-
|
|
816
|
-
**Example**
|
|
817
|
-
|
|
818
|
-
```javascript
|
|
819
|
-
widget.on('form_submit', function (data) {
|
|
820
|
-
console.log(data);
|
|
821
|
-
});
|
|
822
|
-
// or
|
|
823
|
-
widget.on('form_submit').then(function (data) {
|
|
824
|
-
console.log(data);
|
|
825
|
-
});
|
|
826
|
-
```
|
|
819
|
+
**Overrides**: [<code>afterLoad</code>](#user-content-w_HtmlMultiWidget+afterLoad)
|
|
827
820
|
<a name="w_HtmlMultiWidget+trigger" id="w_HtmlMultiWidget+trigger" href="#user-content-w_HtmlMultiWidget+trigger"> </a>
|
|
828
821
|
|
|
829
822
|
### htmlWidget.trigger(triggers, data)
|
|
830
|
-
|
|
823
|
+
Registers callback that will be invoked for every trigger.
|
|
831
824
|
|
|
832
825
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
833
826
|
**Overrides**: [<code>trigger</code>](#user-content-w_HtmlMultiWidget+trigger)
|
|
834
827
|
|
|
835
828
|
| Param | Type | Description |
|
|
836
829
|
| --- | --- | --- |
|
|
837
|
-
| triggers | <code>
|
|
838
|
-
| data | [<code>ITriggerData</code>](#user-content-w_ITriggerData) |
|
|
830
|
+
| triggers | <code>'submit\_form'</code> \| <code>'tab'</code> | The Widget element identifier that caused the trigger. |
|
|
831
|
+
| data | [<code>ITriggerData</code>](#user-content-w_ITriggerData) | Data that will be sent to the widget when the trigger occurs. |
|
|
839
832
|
|
|
840
833
|
<a name="w_HtmlMultiWidget+getValidationState" id="w_HtmlMultiWidget+getValidationState" href="#user-content-w_HtmlMultiWidget+getValidationState"> </a>
|
|
841
834
|
|
|
842
835
|
### htmlWidget.getValidationState() ⇒ [<code>IFormValidation</code>](#user-content-w_IFormValidation)
|
|
843
|
-
|
|
836
|
+
Gets a reference to the form current validation state.
|
|
837
|
+
|
|
838
|
+
!Warning: do not directly modify the values of the returned object.
|
|
844
839
|
|
|
845
840
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
846
841
|
**Overrides**: [<code>getValidationState</code>](#user-content-w_HtmlMultiWidget+getValidationState)
|
|
@@ -848,11 +843,13 @@ Using this method you can get validation state information
|
|
|
848
843
|
<a name="w_HtmlMultiWidget+isValidForm" id="w_HtmlMultiWidget+isValidForm" href="#user-content-w_HtmlMultiWidget+isValidForm"> </a>
|
|
849
844
|
|
|
850
845
|
### htmlWidget.isValidForm() ⇒ <code>boolean</code>
|
|
851
|
-
|
|
846
|
+
Checks if a given form is valid.
|
|
847
|
+
|
|
848
|
+
A form is valid if all form fields are valid.
|
|
852
849
|
|
|
853
850
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
854
851
|
**Overrides**: [<code>isValidForm</code>](#user-content-w_HtmlMultiWidget+isValidForm)
|
|
855
|
-
**Returns**: <code>boolean</code> -
|
|
852
|
+
**Returns**: <code>boolean</code> - Indicates wether or not form is valid.
|
|
856
853
|
<a name="w_HtmlMultiWidget+isInvalidField" id="w_HtmlMultiWidget+isInvalidField" href="#user-content-w_HtmlMultiWidget+isInvalidField"> </a>
|
|
857
854
|
|
|
858
855
|
### htmlWidget.isInvalidField(field) ⇒ <code>boolean</code>
|
|
@@ -869,92 +866,96 @@ Using this method you can check if a specific form field is invalid
|
|
|
869
866
|
<a name="w_HtmlMultiWidget+isFieldErrorShowed" id="w_HtmlMultiWidget+isFieldErrorShowed" href="#user-content-w_HtmlMultiWidget+isFieldErrorShowed"> </a>
|
|
870
867
|
|
|
871
868
|
### htmlWidget.isFieldErrorShowed(field) ⇒ <code>boolean</code>
|
|
872
|
-
|
|
869
|
+
Checks if a given form field is displaying an error.
|
|
873
870
|
|
|
874
871
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
875
872
|
**Overrides**: [<code>isFieldErrorShowed</code>](#user-content-w_HtmlMultiWidget+isFieldErrorShowed)
|
|
876
|
-
**Returns**: <code>boolean</code> - Error is
|
|
873
|
+
**Returns**: <code>boolean</code> - Indicates wether or not the Error message is being displayed on the associated field.
|
|
877
874
|
|
|
878
875
|
| Param | Type | Description |
|
|
879
876
|
| --- | --- | --- |
|
|
880
|
-
| field | <code>string</code> |
|
|
877
|
+
| field | <code>string</code> | The form field name |
|
|
881
878
|
|
|
882
879
|
<a name="w_HtmlMultiWidget+isInvalidFieldByValidator" id="w_HtmlMultiWidget+isInvalidFieldByValidator" href="#user-content-w_HtmlMultiWidget+isInvalidFieldByValidator"> </a>
|
|
883
880
|
|
|
884
881
|
### htmlWidget.isInvalidFieldByValidator(field, validator) ⇒ <code>boolean</code>
|
|
885
|
-
|
|
882
|
+
Checks if a given form field is valid or invalid by name.
|
|
886
883
|
|
|
887
884
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
888
885
|
**Overrides**: [<code>isInvalidFieldByValidator</code>](#user-content-w_HtmlMultiWidget+isInvalidFieldByValidator)
|
|
889
|
-
**Returns**: <code>boolean</code> -
|
|
886
|
+
**Returns**: <code>boolean</code> - Indicates wether or not the field is invalid based on validator intepretation.
|
|
890
887
|
|
|
891
888
|
| Param | Type | Description |
|
|
892
889
|
| --- | --- | --- |
|
|
893
|
-
| field | <code>string</code> |
|
|
894
|
-
| validator |
|
|
890
|
+
| field | <code>string</code> | The form field name |
|
|
891
|
+
| validator | | The name of the validator. |
|
|
895
892
|
|
|
896
893
|
<a name="w_HtmlMultiWidget+hide" id="w_HtmlMultiWidget+hide" href="#user-content-w_HtmlMultiWidget+hide"> </a>
|
|
897
894
|
|
|
898
895
|
### htmlWidget.hide([saveSize])
|
|
899
|
-
|
|
896
|
+
Hides the widget.
|
|
897
|
+
|
|
898
|
+
E.g., use this method to hide the widget after it loads.
|
|
900
899
|
|
|
901
900
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
902
901
|
**Overrides**: [<code>hide</code>](#user-content-w_HtmlMultiWidget+hide)
|
|
903
902
|
|
|
904
903
|
| Param | Type | Default | Description |
|
|
905
904
|
| --- | --- | --- | --- |
|
|
906
|
-
| [saveSize] | <code>boolean</code> | <code>false</code> |
|
|
905
|
+
| [saveSize] | <code>boolean</code> | <code>false</code> | Wether the original iframe element size should be saved before being hidden. |
|
|
907
906
|
|
|
908
907
|
<a name="w_HtmlMultiWidget+show" id="w_HtmlMultiWidget+show" href="#user-content-w_HtmlMultiWidget+show"> </a>
|
|
909
908
|
|
|
910
909
|
### htmlWidget.show()
|
|
911
|
-
|
|
910
|
+
Shows the widget.
|
|
911
|
+
|
|
912
|
+
E.g., use this method to show the widget after it was explicitly hidden.
|
|
912
913
|
|
|
913
914
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
914
915
|
**Overrides**: [<code>show</code>](#user-content-w_HtmlMultiWidget+show)
|
|
915
916
|
<a name="w_HtmlMultiWidget+reload" id="w_HtmlMultiWidget+reload" href="#user-content-w_HtmlMultiWidget+reload"> </a>
|
|
916
917
|
|
|
917
918
|
### htmlWidget.reload()
|
|
918
|
-
|
|
919
|
+
Reloads the widget.
|
|
919
920
|
|
|
920
921
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
921
922
|
**Overrides**: [<code>reload</code>](#user-content-w_HtmlMultiWidget+reload)
|
|
922
923
|
<a name="w_HtmlMultiWidget+hideElements" id="w_HtmlMultiWidget+hideElements" href="#user-content-w_HtmlMultiWidget+hideElements"> </a>
|
|
923
924
|
|
|
924
925
|
### htmlWidget.hideElements(elements)
|
|
925
|
-
|
|
926
|
+
Hides the specified Widget elements by their identifier.
|
|
926
927
|
|
|
927
928
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
928
929
|
**Overrides**: [<code>hideElements</code>](#user-content-w_HtmlMultiWidget+hideElements)
|
|
929
930
|
|
|
930
931
|
| Param | Type | Description |
|
|
931
932
|
| --- | --- | --- |
|
|
932
|
-
| elements | <code>Array.<string></code> |
|
|
933
|
+
| elements | <code>Array.<string></code> | List of element which can be hidden [ELEMENT](#user-content-w_ELEMENT) || [FORM_FIELD](#user-content-w_FORM_FIELD) |
|
|
933
934
|
|
|
934
935
|
**Example**
|
|
935
|
-
|
|
936
936
|
```javascript
|
|
937
937
|
widget.hideElements(['submit_button', 'email']);
|
|
938
938
|
```
|
|
939
939
|
<a name="w_HtmlMultiWidget+showElements" id="w_HtmlMultiWidget+showElements" href="#user-content-w_HtmlMultiWidget+showElements"> </a>
|
|
940
940
|
|
|
941
941
|
### htmlWidget.showElements(elements)
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
* @example
|
|
945
|
-
widget.showElements(['submit_button', 'email']);
|
|
942
|
+
Shows the specified Widget elements by their identifier.
|
|
946
943
|
|
|
947
944
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
948
945
|
**Overrides**: [<code>showElements</code>](#user-content-w_HtmlMultiWidget+showElements)
|
|
949
946
|
|
|
950
947
|
| Param | Type | Description |
|
|
951
948
|
| --- | --- | --- |
|
|
952
|
-
| elements | <code>Array.<string></code> |
|
|
949
|
+
| elements | <code>Array.<string></code> | List of elements which can be showed [ELEMENT](#user-content-w_ELEMENT) || [FORM_FIELD](#user-content-w_FORM_FIELD) |
|
|
953
950
|
|
|
951
|
+
**Example**
|
|
952
|
+
```javascript
|
|
953
|
+
widget.showElements(['submit_button', 'email']);
|
|
954
|
+
```
|
|
954
955
|
<a name="w_HtmlMultiWidget+updateFormValues" id="w_HtmlMultiWidget+updateFormValues" href="#user-content-w_HtmlMultiWidget+updateFormValues"> </a>
|
|
955
956
|
|
|
956
957
|
### htmlWidget.updateFormValues(fieldValues)
|
|
957
|
-
|
|
958
|
+
Updates the form field values inside the widget.
|
|
958
959
|
|
|
959
960
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
960
961
|
**Overrides**: [<code>updateFormValues</code>](#user-content-w_HtmlMultiWidget+updateFormValues)
|
|
@@ -964,53 +965,71 @@ Method for update values for form fields inside the widget
|
|
|
964
965
|
| fieldValues | <code>IFormValues</code> | Fields with values |
|
|
965
966
|
|
|
966
967
|
**Example**
|
|
967
|
-
|
|
968
968
|
```javascript
|
|
969
969
|
widget.updateFormValues({
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
970
|
+
email: 'predefined@email.com',
|
|
971
|
+
card_name: 'Houston'
|
|
972
|
+
});
|
|
973
|
+
```
|
|
974
|
+
<a name="w_HtmlMultiWidget+updateFormValue" id="w_HtmlMultiWidget+updateFormValue" href="#user-content-w_HtmlMultiWidget+updateFormValue"> </a>
|
|
975
|
+
|
|
976
|
+
### htmlWidget.updateFormValue(key, value)
|
|
977
|
+
Updates a single form field values inside the widget by the form field name.
|
|
978
|
+
|
|
979
|
+
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
980
|
+
**Overrides**: [<code>updateFormValue</code>](#user-content-w_HtmlMultiWidget+updateFormValue)
|
|
981
|
+
|
|
982
|
+
| Param | Type | Description |
|
|
983
|
+
| --- | --- | --- |
|
|
984
|
+
| key | <code>string</code> | The form field name |
|
|
985
|
+
| value | <code>string</code> | The form field value |
|
|
986
|
+
|
|
987
|
+
**Example**
|
|
988
|
+
```javascript
|
|
989
|
+
widget.updateFormValue("card_name", "John Doe");
|
|
973
990
|
```
|
|
974
991
|
<a name="w_HtmlMultiWidget+onFinishInsert" id="w_HtmlMultiWidget+onFinishInsert" href="#user-content-w_HtmlMultiWidget+onFinishInsert"> </a>
|
|
975
992
|
|
|
976
993
|
### htmlWidget.onFinishInsert(selector, dataType)
|
|
977
|
-
|
|
994
|
+
Inserts the event data (after finish event) onto the input field associated with the provided CSS selector.
|
|
978
995
|
|
|
979
996
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
980
997
|
**Overrides**: [<code>onFinishInsert</code>](#user-content-w_HtmlMultiWidget+onFinishInsert)
|
|
981
998
|
|
|
982
999
|
| Param | Type | Description |
|
|
983
1000
|
| --- | --- | --- |
|
|
984
|
-
| selector | <code>string</code> |
|
|
985
|
-
| dataType | <code>string</code> | data type of IEventData object. |
|
|
1001
|
+
| selector | <code>string</code> | A CSS selector. E.g., ".my-class", "#my-id", or others |
|
|
1002
|
+
| dataType | <code>string</code> | The data type of IEventData object. |
|
|
986
1003
|
|
|
987
1004
|
<a name="w_HtmlMultiWidget+interceptSubmitForm" id="w_HtmlMultiWidget+interceptSubmitForm" href="#user-content-w_HtmlMultiWidget+interceptSubmitForm"> </a>
|
|
988
1005
|
|
|
989
1006
|
### htmlWidget.interceptSubmitForm(selector)
|
|
990
|
-
|
|
1007
|
+
Intercepts a form submission and delegates processing to the widget.
|
|
991
1008
|
|
|
992
|
-
|
|
1009
|
+
An simplified example of the process:
|
|
1010
|
+
- User clicks submit button in your form
|
|
1011
|
+
- This implicitly triggers a submission to the widget
|
|
1012
|
+
- The widget submits your form
|
|
993
1013
|
|
|
994
1014
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
995
1015
|
**Overrides**: [<code>interceptSubmitForm</code>](#user-content-w_HtmlMultiWidget+interceptSubmitForm)
|
|
996
|
-
**Note**: submit button
|
|
1016
|
+
**Note**: The widget's submit button will be hidden.
|
|
997
1017
|
|
|
998
1018
|
| Param | Type | Description |
|
|
999
1019
|
| --- | --- | --- |
|
|
1000
1020
|
| selector | <code>string</code> | css selector of your form |
|
|
1001
1021
|
|
|
1002
1022
|
**Example**
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
<form id="myForm">
|
|
1023
|
+
```html
|
|
1024
|
+
<body>
|
|
1025
|
+
<form id="myForm">
|
|
1006
1026
|
<input name="amount">
|
|
1007
1027
|
<button type="submit">Submit</button>
|
|
1008
1028
|
</form>
|
|
1009
|
-
|
|
1010
|
-
-->
|
|
1011
|
-
<script>
|
|
1029
|
+
<script>
|
|
1012
1030
|
widget.interceptSubmitForm('#myForm');
|
|
1013
|
-
</script>
|
|
1031
|
+
</script>
|
|
1032
|
+
</body>
|
|
1014
1033
|
```
|
|
1015
1034
|
<a name="w_HtmlMultiWidget+useCheckoutAutoSubmit" id="w_HtmlMultiWidget+useCheckoutAutoSubmit" href="#user-content-w_HtmlMultiWidget+useCheckoutAutoSubmit"> </a>
|
|
1016
1035
|
|
|
@@ -1027,7 +1046,6 @@ Use this method for resize iFrame according content height
|
|
|
1027
1046
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
1028
1047
|
**Overrides**: [<code>useAutoResize</code>](#user-content-w_HtmlMultiWidget+useAutoResize)
|
|
1029
1048
|
**Example**
|
|
1030
|
-
|
|
1031
1049
|
```javascript
|
|
1032
1050
|
widget.useAutoResize();
|
|
1033
1051
|
```
|
|
@@ -1332,7 +1350,7 @@ Class HtmlMultiWidget include method for working with html
|
|
|
1332
1350
|
* [HtmlMultiWidget](#user-content-w_HtmlMultiWidget) ⇐ [<code>MultiWidget</code>](#user-content-w_MultiWidget)
|
|
1333
1351
|
* [new HtmlMultiWidget(selector, publicKey, conf)](#user-content-w_new_HtmlMultiWidget_new)
|
|
1334
1352
|
* [.load()](#user-content-w_HtmlMultiWidget+load)
|
|
1335
|
-
* [.
|
|
1353
|
+
* [.afterLoad()](#user-content-w_HtmlMultiWidget+afterLoad)
|
|
1336
1354
|
* [.trigger(triggers, data)](#user-content-w_HtmlMultiWidget+trigger)
|
|
1337
1355
|
* [.getValidationState()](#user-content-w_HtmlMultiWidget+getValidationState) ⇒ [<code>IFormValidation</code>](#user-content-w_IFormValidation)
|
|
1338
1356
|
* [.isValidForm()](#user-content-w_HtmlMultiWidget+isValidForm) ⇒ <code>boolean</code>
|
|
@@ -1345,6 +1363,7 @@ Class HtmlMultiWidget include method for working with html
|
|
|
1345
1363
|
* [.hideElements(elements)](#user-content-w_HtmlMultiWidget+hideElements)
|
|
1346
1364
|
* [.showElements(elements)](#user-content-w_HtmlMultiWidget+showElements)
|
|
1347
1365
|
* [.updateFormValues(fieldValues)](#user-content-w_HtmlMultiWidget+updateFormValues)
|
|
1366
|
+
* [.updateFormValue(key, value)](#user-content-w_HtmlMultiWidget+updateFormValue)
|
|
1348
1367
|
* [.onFinishInsert(selector, dataType)](#user-content-w_HtmlMultiWidget+onFinishInsert)
|
|
1349
1368
|
* [.interceptSubmitForm(selector)](#user-content-w_HtmlMultiWidget+interceptSubmitForm)
|
|
1350
1369
|
* [.useCheckoutAutoSubmit()](#user-content-w_HtmlMultiWidget+useCheckoutAutoSubmit)
|
|
@@ -1395,58 +1414,47 @@ var widget = new MultiWidget('#widget', 'publicKey',[ With Configurations
|
|
|
1395
1414
|
<a name="w_HtmlMultiWidget+load" id="w_HtmlMultiWidget+load" href="#user-content-w_HtmlMultiWidget+load"> </a>
|
|
1396
1415
|
|
|
1397
1416
|
### htmlMultiWidget.load()
|
|
1398
|
-
|
|
1417
|
+
Loads the widget.
|
|
1399
1418
|
|
|
1400
|
-
|
|
1401
|
-
<a name="w_HtmlMultiWidget+on" id="w_HtmlMultiWidget+on" href="#user-content-w_HtmlMultiWidget+on"> </a>
|
|
1402
|
-
|
|
1403
|
-
### htmlMultiWidget.on(eventName, [cb]) ⇒ <code>Promise.<(IEventData\|IEventMetaData\|IEventFinishData\|IFormValidation)></code> \| <code>void</code>
|
|
1404
|
-
Listen to events of widget
|
|
1419
|
+
Calling this method results in an iframe element being inserted and rendered in the DOM.
|
|
1405
1420
|
|
|
1406
1421
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1422
|
+
<a name="w_HtmlMultiWidget+afterLoad" id="w_HtmlMultiWidget+afterLoad" href="#user-content-w_HtmlMultiWidget+afterLoad"> </a>
|
|
1407
1423
|
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
| eventName | <code>string</code> | Available event names [EVENT](#user-content-w_EVENT) |
|
|
1411
|
-
| [cb] | <code>listener</code> | |
|
|
1412
|
-
|
|
1413
|
-
**Example**
|
|
1424
|
+
### htmlMultiWidget.afterLoad()
|
|
1425
|
+
Registers a form validation callback for validation events.
|
|
1414
1426
|
|
|
1415
|
-
|
|
1416
|
-
widget.on('form_submit', function (data) {
|
|
1417
|
-
console.log(data);
|
|
1418
|
-
});
|
|
1419
|
-
// or
|
|
1420
|
-
widget.on('form_submit').then(function (data) {
|
|
1421
|
-
console.log(data);
|
|
1422
|
-
});
|
|
1423
|
-
```
|
|
1427
|
+
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1424
1428
|
<a name="w_HtmlMultiWidget+trigger" id="w_HtmlMultiWidget+trigger" href="#user-content-w_HtmlMultiWidget+trigger"> </a>
|
|
1425
1429
|
|
|
1426
1430
|
### htmlMultiWidget.trigger(triggers, data)
|
|
1427
|
-
|
|
1431
|
+
Registers callback that will be invoked for every trigger.
|
|
1428
1432
|
|
|
1429
1433
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1430
1434
|
|
|
1431
1435
|
| Param | Type | Description |
|
|
1432
1436
|
| --- | --- | --- |
|
|
1433
|
-
| triggers | <code>
|
|
1434
|
-
| data | [<code>ITriggerData</code>](#user-content-w_ITriggerData) |
|
|
1437
|
+
| triggers | <code>'submit\_form'</code> \| <code>'tab'</code> | The Widget element identifier that caused the trigger. |
|
|
1438
|
+
| data | [<code>ITriggerData</code>](#user-content-w_ITriggerData) | Data that will be sent to the widget when the trigger occurs. |
|
|
1435
1439
|
|
|
1436
1440
|
<a name="w_HtmlMultiWidget+getValidationState" id="w_HtmlMultiWidget+getValidationState" href="#user-content-w_HtmlMultiWidget+getValidationState"> </a>
|
|
1437
1441
|
|
|
1438
1442
|
### htmlMultiWidget.getValidationState() ⇒ [<code>IFormValidation</code>](#user-content-w_IFormValidation)
|
|
1439
|
-
|
|
1443
|
+
Gets a reference to the form current validation state.
|
|
1444
|
+
|
|
1445
|
+
!Warning: do not directly modify the values of the returned object.
|
|
1440
1446
|
|
|
1441
1447
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1442
1448
|
**Returns**: [<code>IFormValidation</code>](#user-content-w_IFormValidation) - Form validation object
|
|
1443
1449
|
<a name="w_HtmlMultiWidget+isValidForm" id="w_HtmlMultiWidget+isValidForm" href="#user-content-w_HtmlMultiWidget+isValidForm"> </a>
|
|
1444
1450
|
|
|
1445
1451
|
### htmlMultiWidget.isValidForm() ⇒ <code>boolean</code>
|
|
1446
|
-
|
|
1452
|
+
Checks if a given form is valid.
|
|
1453
|
+
|
|
1454
|
+
A form is valid if all form fields are valid.
|
|
1447
1455
|
|
|
1448
1456
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1449
|
-
**Returns**: <code>boolean</code> -
|
|
1457
|
+
**Returns**: <code>boolean</code> - Indicates wether or not form is valid.
|
|
1450
1458
|
<a name="w_HtmlMultiWidget+isInvalidField" id="w_HtmlMultiWidget+isInvalidField" href="#user-content-w_HtmlMultiWidget+isInvalidField"> </a>
|
|
1451
1459
|
|
|
1452
1460
|
### htmlMultiWidget.isInvalidField(field) ⇒ <code>boolean</code>
|
|
@@ -1462,85 +1470,89 @@ Using this method you can check if a specific form field is invalid
|
|
|
1462
1470
|
<a name="w_HtmlMultiWidget+isFieldErrorShowed" id="w_HtmlMultiWidget+isFieldErrorShowed" href="#user-content-w_HtmlMultiWidget+isFieldErrorShowed"> </a>
|
|
1463
1471
|
|
|
1464
1472
|
### htmlMultiWidget.isFieldErrorShowed(field) ⇒ <code>boolean</code>
|
|
1465
|
-
|
|
1473
|
+
Checks if a given form field is displaying an error.
|
|
1466
1474
|
|
|
1467
1475
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1468
|
-
**Returns**: <code>boolean</code> - Error is
|
|
1476
|
+
**Returns**: <code>boolean</code> - Indicates wether or not the Error message is being displayed on the associated field.
|
|
1469
1477
|
|
|
1470
1478
|
| Param | Type | Description |
|
|
1471
1479
|
| --- | --- | --- |
|
|
1472
|
-
| field | <code>string</code> |
|
|
1480
|
+
| field | <code>string</code> | The form field name |
|
|
1473
1481
|
|
|
1474
1482
|
<a name="w_HtmlMultiWidget+isInvalidFieldByValidator" id="w_HtmlMultiWidget+isInvalidFieldByValidator" href="#user-content-w_HtmlMultiWidget+isInvalidFieldByValidator"> </a>
|
|
1475
1483
|
|
|
1476
1484
|
### htmlMultiWidget.isInvalidFieldByValidator(field, validator) ⇒ <code>boolean</code>
|
|
1477
|
-
|
|
1485
|
+
Checks if a given form field is valid or invalid by name.
|
|
1478
1486
|
|
|
1479
1487
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1480
|
-
**Returns**: <code>boolean</code> -
|
|
1488
|
+
**Returns**: <code>boolean</code> - Indicates wether or not the field is invalid based on validator intepretation.
|
|
1481
1489
|
|
|
1482
1490
|
| Param | Type | Description |
|
|
1483
1491
|
| --- | --- | --- |
|
|
1484
|
-
| field | <code>string</code> |
|
|
1485
|
-
| validator |
|
|
1492
|
+
| field | <code>string</code> | The form field name |
|
|
1493
|
+
| validator | | The name of the validator. |
|
|
1486
1494
|
|
|
1487
1495
|
<a name="w_HtmlMultiWidget+hide" id="w_HtmlMultiWidget+hide" href="#user-content-w_HtmlMultiWidget+hide"> </a>
|
|
1488
1496
|
|
|
1489
1497
|
### htmlMultiWidget.hide([saveSize])
|
|
1490
|
-
|
|
1498
|
+
Hides the widget.
|
|
1499
|
+
|
|
1500
|
+
E.g., use this method to hide the widget after it loads.
|
|
1491
1501
|
|
|
1492
1502
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1493
1503
|
|
|
1494
1504
|
| Param | Type | Default | Description |
|
|
1495
1505
|
| --- | --- | --- | --- |
|
|
1496
|
-
| [saveSize] | <code>boolean</code> | <code>false</code> |
|
|
1506
|
+
| [saveSize] | <code>boolean</code> | <code>false</code> | Wether the original iframe element size should be saved before being hidden. |
|
|
1497
1507
|
|
|
1498
1508
|
<a name="w_HtmlMultiWidget+show" id="w_HtmlMultiWidget+show" href="#user-content-w_HtmlMultiWidget+show"> </a>
|
|
1499
1509
|
|
|
1500
1510
|
### htmlMultiWidget.show()
|
|
1501
|
-
|
|
1511
|
+
Shows the widget.
|
|
1512
|
+
|
|
1513
|
+
E.g., use this method to show the widget after it was explicitly hidden.
|
|
1502
1514
|
|
|
1503
1515
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1504
1516
|
<a name="w_HtmlMultiWidget+reload" id="w_HtmlMultiWidget+reload" href="#user-content-w_HtmlMultiWidget+reload"> </a>
|
|
1505
1517
|
|
|
1506
1518
|
### htmlMultiWidget.reload()
|
|
1507
|
-
|
|
1519
|
+
Reloads the widget.
|
|
1508
1520
|
|
|
1509
1521
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1510
1522
|
<a name="w_HtmlMultiWidget+hideElements" id="w_HtmlMultiWidget+hideElements" href="#user-content-w_HtmlMultiWidget+hideElements"> </a>
|
|
1511
1523
|
|
|
1512
1524
|
### htmlMultiWidget.hideElements(elements)
|
|
1513
|
-
|
|
1525
|
+
Hides the specified Widget elements by their identifier.
|
|
1514
1526
|
|
|
1515
1527
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1516
1528
|
|
|
1517
1529
|
| Param | Type | Description |
|
|
1518
1530
|
| --- | --- | --- |
|
|
1519
|
-
| elements | <code>Array.<string></code> |
|
|
1531
|
+
| elements | <code>Array.<string></code> | List of element which can be hidden [ELEMENT](#user-content-w_ELEMENT) || [FORM_FIELD](#user-content-w_FORM_FIELD) |
|
|
1520
1532
|
|
|
1521
1533
|
**Example**
|
|
1522
|
-
|
|
1523
1534
|
```javascript
|
|
1524
1535
|
widget.hideElements(['submit_button', 'email']);
|
|
1525
1536
|
```
|
|
1526
1537
|
<a name="w_HtmlMultiWidget+showElements" id="w_HtmlMultiWidget+showElements" href="#user-content-w_HtmlMultiWidget+showElements"> </a>
|
|
1527
1538
|
|
|
1528
1539
|
### htmlMultiWidget.showElements(elements)
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
* @example
|
|
1532
|
-
widget.showElements(['submit_button', 'email']);
|
|
1540
|
+
Shows the specified Widget elements by their identifier.
|
|
1533
1541
|
|
|
1534
1542
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1535
1543
|
|
|
1536
1544
|
| Param | Type | Description |
|
|
1537
1545
|
| --- | --- | --- |
|
|
1538
|
-
| elements | <code>Array.<string></code> |
|
|
1546
|
+
| elements | <code>Array.<string></code> | List of elements which can be showed [ELEMENT](#user-content-w_ELEMENT) || [FORM_FIELD](#user-content-w_FORM_FIELD) |
|
|
1539
1547
|
|
|
1548
|
+
**Example**
|
|
1549
|
+
```javascript
|
|
1550
|
+
widget.showElements(['submit_button', 'email']);
|
|
1551
|
+
```
|
|
1540
1552
|
<a name="w_HtmlMultiWidget+updateFormValues" id="w_HtmlMultiWidget+updateFormValues" href="#user-content-w_HtmlMultiWidget+updateFormValues"> </a>
|
|
1541
1553
|
|
|
1542
1554
|
### htmlMultiWidget.updateFormValues(fieldValues)
|
|
1543
|
-
|
|
1555
|
+
Updates the form field values inside the widget.
|
|
1544
1556
|
|
|
1545
1557
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1546
1558
|
|
|
@@ -1549,51 +1561,68 @@ Method for update values for form fields inside the widget
|
|
|
1549
1561
|
| fieldValues | <code>IFormValues</code> | Fields with values |
|
|
1550
1562
|
|
|
1551
1563
|
**Example**
|
|
1552
|
-
|
|
1553
1564
|
```javascript
|
|
1554
1565
|
widget.updateFormValues({
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1566
|
+
email: 'predefined@email.com',
|
|
1567
|
+
card_name: 'Houston'
|
|
1568
|
+
});
|
|
1569
|
+
```
|
|
1570
|
+
<a name="w_HtmlMultiWidget+updateFormValue" id="w_HtmlMultiWidget+updateFormValue" href="#user-content-w_HtmlMultiWidget+updateFormValue"> </a>
|
|
1571
|
+
|
|
1572
|
+
### htmlMultiWidget.updateFormValue(key, value)
|
|
1573
|
+
Updates a single form field values inside the widget by the form field name.
|
|
1574
|
+
|
|
1575
|
+
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1576
|
+
|
|
1577
|
+
| Param | Type | Description |
|
|
1578
|
+
| --- | --- | --- |
|
|
1579
|
+
| key | <code>string</code> | The form field name |
|
|
1580
|
+
| value | <code>string</code> | The form field value |
|
|
1581
|
+
|
|
1582
|
+
**Example**
|
|
1583
|
+
```javascript
|
|
1584
|
+
widget.updateFormValue("card_name", "John Doe");
|
|
1558
1585
|
```
|
|
1559
1586
|
<a name="w_HtmlMultiWidget+onFinishInsert" id="w_HtmlMultiWidget+onFinishInsert" href="#user-content-w_HtmlMultiWidget+onFinishInsert"> </a>
|
|
1560
1587
|
|
|
1561
1588
|
### htmlMultiWidget.onFinishInsert(selector, dataType)
|
|
1562
|
-
|
|
1589
|
+
Inserts the event data (after finish event) onto the input field associated with the provided CSS selector.
|
|
1563
1590
|
|
|
1564
1591
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1565
1592
|
|
|
1566
1593
|
| Param | Type | Description |
|
|
1567
1594
|
| --- | --- | --- |
|
|
1568
|
-
| selector | <code>string</code> |
|
|
1569
|
-
| dataType | <code>string</code> | data type of IEventData object. |
|
|
1595
|
+
| selector | <code>string</code> | A CSS selector. E.g., ".my-class", "#my-id", or others |
|
|
1596
|
+
| dataType | <code>string</code> | The data type of IEventData object. |
|
|
1570
1597
|
|
|
1571
1598
|
<a name="w_HtmlMultiWidget+interceptSubmitForm" id="w_HtmlMultiWidget+interceptSubmitForm" href="#user-content-w_HtmlMultiWidget+interceptSubmitForm"> </a>
|
|
1572
1599
|
|
|
1573
1600
|
### htmlMultiWidget.interceptSubmitForm(selector)
|
|
1574
|
-
|
|
1601
|
+
Intercepts a form submission and delegates processing to the widget.
|
|
1575
1602
|
|
|
1576
|
-
|
|
1603
|
+
An simplified example of the process:
|
|
1604
|
+
- User clicks submit button in your form
|
|
1605
|
+
- This implicitly triggers a submission to the widget
|
|
1606
|
+
- The widget submits your form
|
|
1577
1607
|
|
|
1578
1608
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1579
|
-
**Note**: submit button
|
|
1609
|
+
**Note**: The widget's submit button will be hidden.
|
|
1580
1610
|
|
|
1581
1611
|
| Param | Type | Description |
|
|
1582
1612
|
| --- | --- | --- |
|
|
1583
1613
|
| selector | <code>string</code> | css selector of your form |
|
|
1584
1614
|
|
|
1585
1615
|
**Example**
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
<form id="myForm">
|
|
1616
|
+
```html
|
|
1617
|
+
<body>
|
|
1618
|
+
<form id="myForm">
|
|
1589
1619
|
<input name="amount">
|
|
1590
1620
|
<button type="submit">Submit</button>
|
|
1591
1621
|
</form>
|
|
1592
|
-
|
|
1593
|
-
-->
|
|
1594
|
-
<script>
|
|
1622
|
+
<script>
|
|
1595
1623
|
widget.interceptSubmitForm('#myForm');
|
|
1596
|
-
</script>
|
|
1624
|
+
</script>
|
|
1625
|
+
</body>
|
|
1597
1626
|
```
|
|
1598
1627
|
<a name="w_HtmlMultiWidget+useCheckoutAutoSubmit" id="w_HtmlMultiWidget+useCheckoutAutoSubmit" href="#user-content-w_HtmlMultiWidget+useCheckoutAutoSubmit"> </a>
|
|
1599
1628
|
|
|
@@ -1608,7 +1637,6 @@ Use this method for resize iFrame according content height
|
|
|
1608
1637
|
|
|
1609
1638
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1610
1639
|
**Example**
|
|
1611
|
-
|
|
1612
1640
|
```javascript
|
|
1613
1641
|
widget.useAutoResize();
|
|
1614
1642
|
```
|
|
@@ -2661,6 +2689,32 @@ Current constant include available states of element for styling
|
|
|
2661
2689
|
| FOCUS | <code>string</code> | <code>"focus"</code> | focus. This state applies to: input |
|
|
2662
2690
|
| HOVER | <code>string</code> | <code>"hover"</code> | focus. This state applies to: submit_button |
|
|
2663
2691
|
|
|
2692
|
+
<a name="w_CARD_VALIDATORS" id="w_CARD_VALIDATORS" href="#user-content-w_CARD_VALIDATORS"> </a>
|
|
2693
|
+
|
|
2694
|
+
## CARD\_VALIDATORS : <code>Record.<string, string></code>
|
|
2695
|
+
List of available form field validators dedicated to cards and their definition
|
|
2696
|
+
|
|
2697
|
+
**Kind**: global constant
|
|
2698
|
+
|
|
2699
|
+
| Param | Type | Default | Description |
|
|
2700
|
+
| --- | --- | --- | --- |
|
|
2701
|
+
| CVV | <code>string</code> | <code>"cardCvvValidation"</code> | Asserts that CVV contains zero or more digits and is a number |
|
|
2702
|
+
| EXPIRY_DATE | <code>string</code> | <code>"expireDateValidation"</code> | Asserts value is a date in the future with format MM/YY |
|
|
2703
|
+
| HOLDER_NAME | <code>string</code> | <code>"cardHoldernameValidation"</code> | Asserts value is a name that respects the ITU-T T.50 standard (@see https://www.itu.int/rec/T-REC-T.50/en) |
|
|
2704
|
+
| NUMBER | <code>string</code> | <code>"cardNumberValidation"</code> | Asserts the value matches a known card scheme and as a the correct length. E.g., matches a 13, 16 or 19 digit bank card, **or**, a 13 to 25 digit Vii Gift card |
|
|
2705
|
+
| PIN | <code>string</code> | <code>"cardPinValidation"</code> | Asserts the value is a number with exactly 4 digits |
|
|
2706
|
+
|
|
2707
|
+
<a name="w_GENERIC_VALIDATORS" id="w_GENERIC_VALIDATORS" href="#user-content-w_GENERIC_VALIDATORS"> </a>
|
|
2708
|
+
|
|
2709
|
+
## GENERIC\_VALIDATORS : <code>Record.<string, string></code>
|
|
2710
|
+
List of available generic form field validators and their definition
|
|
2711
|
+
|
|
2712
|
+
**Kind**: global constant
|
|
2713
|
+
|
|
2714
|
+
| Param | Type | Default | Description |
|
|
2715
|
+
| --- | --- | --- | --- |
|
|
2716
|
+
| REQUIRED | <code>string</code> | <code>"required"</code> | Asserts the input or form field has a value defined truthy value |
|
|
2717
|
+
|
|
2664
2718
|
<a name="w_TRIGGER" id="w_TRIGGER" href="#user-content-w_TRIGGER"> </a>
|
|
2665
2719
|
|
|
2666
2720
|
## TRIGGER : <code>object</code>
|
|
@@ -2917,10 +2971,10 @@ Interface of data from event.
|
|
|
2917
2971
|
|
|
2918
2972
|
| Param | Type | Description |
|
|
2919
2973
|
| --- | --- | --- |
|
|
2920
|
-
| event | <code>string</code> |
|
|
2921
|
-
| purpose | <code>string</code> |
|
|
2922
|
-
| message_source | <code>string</code> |
|
|
2923
|
-
| [ref_id] | <code>string</code> | Custom value
|
|
2974
|
+
| event | <code>string</code> | The name of the event. |
|
|
2975
|
+
| purpose | <code>string</code> | A system variable that states the purpose of the event. |
|
|
2976
|
+
| message_source | <code>string</code> | A system variable that identifies the event source. |
|
|
2977
|
+
| [ref_id] | <code>string</code> | Custom unique value that identifies result of processed operation. |
|
|
2924
2978
|
| total_item | <code>number</code> | Pagination param. Total item count |
|
|
2925
2979
|
| skip | <code>number</code> | Pagination param. Skip items from first item |
|
|
2926
2980
|
| limit | <code>number</code> | Pagination param. Query limit |
|
|
@@ -2934,10 +2988,10 @@ Interface of data from event.
|
|
|
2934
2988
|
|
|
2935
2989
|
| Param | Type | Description |
|
|
2936
2990
|
| --- | --- | --- |
|
|
2937
|
-
| event | <code>string</code> |
|
|
2938
|
-
| purpose | <code>string</code> |
|
|
2939
|
-
| message_source | <code>string</code> |
|
|
2940
|
-
| [ref_id] | <code>string</code> | Custom value
|
|
2991
|
+
| event | <code>string</code> | The name of the event. |
|
|
2992
|
+
| purpose | <code>string</code> | A system variable that states the purpose of the event. |
|
|
2993
|
+
| message_source | <code>string</code> | A system variable that identifies the event source. |
|
|
2994
|
+
| [ref_id] | <code>string</code> | Custom unique value that identifies result of processed operation. |
|
|
2941
2995
|
|
|
2942
2996
|
<a name="psw_IEventSizeData" id="psw_IEventSizeData" href="#user-content-psw_IEventSizeData"> </a>
|
|
2943
2997
|
|
|
@@ -2948,10 +3002,10 @@ Interface of data from event.
|
|
|
2948
3002
|
|
|
2949
3003
|
| Param | Type | Description |
|
|
2950
3004
|
| --- | --- | --- |
|
|
2951
|
-
| event | <code>number</code> |
|
|
2952
|
-
| purpose | <code>number</code> |
|
|
2953
|
-
| message_source | <code>string</code> |
|
|
2954
|
-
| [ref_id] | <code>string</code> | Custom value
|
|
3005
|
+
| event | <code>number</code> | The name of the event. |
|
|
3006
|
+
| purpose | <code>number</code> | A system variable that states the purpose of the event. |
|
|
3007
|
+
| message_source | <code>string</code> | A system variable that identifies the event source. |
|
|
3008
|
+
| [ref_id] | <code>string</code> | Custom unique value that identifies result of processed operation. |
|
|
2955
3009
|
| height | <code>number</code> | Height of iFrame |
|
|
2956
3010
|
| width | <code>number</code> | Width of iFrame |
|
|
2957
3011
|
|
|
@@ -5246,6 +5300,14 @@ In some situations you may want to forcibly close the checkout so that your user
|
|
|
5246
5300
|
button.close();
|
|
5247
5301
|
```
|
|
5248
5302
|
|
|
5303
|
+
### Performing actions when the wallet button is clicked
|
|
5304
|
+
|
|
5305
|
+
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.
|
|
5306
|
+
|
|
5307
|
+
```javascript
|
|
5308
|
+
button.onClick(() => console.log("Perform actions on button click"));
|
|
5309
|
+
```
|
|
5310
|
+
|
|
5249
5311
|
### Performing actions when shipping info is updated
|
|
5250
5312
|
|
|
5251
5313
|
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).
|
|
@@ -5373,30 +5435,51 @@ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_l
|
|
|
5373
5435
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
5374
5436
|
<script>
|
|
5375
5437
|
let button = new paydock.WalletButtons(
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
5389
|
-
|
|
5438
|
+
"#widget",
|
|
5439
|
+
charge_token,
|
|
5440
|
+
{
|
|
5441
|
+
request_shipping: true,
|
|
5442
|
+
pay_later: true,
|
|
5443
|
+
standalone: false,
|
|
5444
|
+
style: {
|
|
5445
|
+
layout: 'horizontal',
|
|
5446
|
+
color: 'blue',
|
|
5447
|
+
shape: 'rect',
|
|
5448
|
+
label: 'paypal',
|
|
5449
|
+
},
|
|
5450
|
+
}
|
|
5451
|
+
);
|
|
5390
5452
|
button.setEnv('sandbox');
|
|
5391
5453
|
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
5392
5454
|
button.onUpdate((data) => {
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
5396
|
-
|
|
5455
|
+
console.log("Updating amount via a backend to backend call to POST charges/:id");
|
|
5456
|
+
// call `POST charges/:id` to modify charge
|
|
5457
|
+
button.update({ success: true });
|
|
5458
|
+
});
|
|
5397
5459
|
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
5398
5460
|
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
5399
5461
|
button.onPaymentInReview((data) => console.log("The payment is on fraud review"));
|
|
5462
|
+
|
|
5463
|
+
// Example 1: Asynchronous onClick handler
|
|
5464
|
+
const asyncLogic = async () => {
|
|
5465
|
+
// Perform asynchronous logic. Expectation is that a Promise is returned and attached to response via `attachResult`,
|
|
5466
|
+
// and resolve or reject of it will dictate how wallet behaves.
|
|
5467
|
+
}
|
|
5468
|
+
|
|
5469
|
+
button.onClick(({ data: { attachResult } }) => {
|
|
5470
|
+
// Promise is attached to the result. On Paypal, when promise is resolved, the user Journey will continue.
|
|
5471
|
+
// If no promise is attached then the Paypal journey will not depend on the promise being resolved or rejected
|
|
5472
|
+
attachResult(asyncLogic());
|
|
5473
|
+
});
|
|
5474
|
+
|
|
5475
|
+
// Example 2: Synchronous onClick handler
|
|
5476
|
+
// button.onClick(({ data: { attachResult } }) => {
|
|
5477
|
+
// // Perform synchronous logic
|
|
5478
|
+
// console.log("Synchronous onClick: Button clicked");
|
|
5479
|
+
// // Optionally return a boolean flag to halt the operation
|
|
5480
|
+
// attachResult(false);
|
|
5481
|
+
// });
|
|
5482
|
+
|
|
5400
5483
|
button.load();
|
|
5401
5484
|
</script>
|
|
5402
5485
|
</html>
|
|
@@ -5530,6 +5613,7 @@ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `ra
|
|
|
5530
5613
|
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
5531
5614
|
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
5532
5615
|
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
5616
|
+
button.onClick(() => console.log("On WalletButton Click"));
|
|
5533
5617
|
button.onUpdate((data) => {
|
|
5534
5618
|
console.log("Updating amount via a backend to backend call to POST charges/:id");
|
|
5535
5619
|
// call `POST charges/:id` to modify charge
|
|
@@ -5562,7 +5646,6 @@ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `ra
|
|
|
5562
5646
|
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.
|
|
5563
5647
|
|
|
5564
5648
|
Similarly, for **GooglePay via MPGS** you can initialize the `PaymentMethodSpecification` with your own values instead of using the default ones. Below you can see an example on how to initialize the `PaymentMethodSpecification` with the `raw_data_initialization` meta field.
|
|
5565
|
-
|
|
5566
5649
|
### ApplePay and GooglePay via MPGS Raw data initialization example
|
|
5567
5650
|
|
|
5568
5651
|
```html
|
|
@@ -5694,6 +5777,24 @@ Similarly, for **GooglePay via MPGS** you can initialize the `PaymentMethodSpeci
|
|
|
5694
5777
|
## Interfaces
|
|
5695
5778
|
|
|
5696
5779
|
<dl>
|
|
5780
|
+
<dt><a href="#IEventData">IEventData</a></dt>
|
|
5781
|
+
<dd><p>Interface of data from events.</p>
|
|
5782
|
+
</dd>
|
|
5783
|
+
<dt><a href="#IWalletPaymentSuccessful">IWalletPaymentSuccessful</a></dt>
|
|
5784
|
+
<dd><p>Interface of data from a successful payment result.</p>
|
|
5785
|
+
</dd>
|
|
5786
|
+
<dt><a href="#IWalletUpdate">IWalletUpdate</a></dt>
|
|
5787
|
+
<dd><p>Interface of data from an update event.</p>
|
|
5788
|
+
</dd>
|
|
5789
|
+
<dt><a href="#IWalletOnClick">IWalletOnClick</a></dt>
|
|
5790
|
+
<dd><p>Interface of data from a wallet onClick event.</p>
|
|
5791
|
+
</dd>
|
|
5792
|
+
<dt><a href="#IWalletUnavailable">IWalletUnavailable</a></dt>
|
|
5793
|
+
<dd><p>Interface of data from an unavailable event.</p>
|
|
5794
|
+
</dd>
|
|
5795
|
+
<dt><a href="#IWalletUpdateData">IWalletUpdateData</a></dt>
|
|
5796
|
+
<dd><p>Interface of data for wallet button <code>update</code> call.</p>
|
|
5797
|
+
</dd>
|
|
5697
5798
|
<dt><a href="#IWalletMeta">IWalletMeta</a> : <code>object</code></dt>
|
|
5698
5799
|
<dd><p>Interface of data used by the wallet checkout and payment proccess.</p>
|
|
5699
5800
|
</dd>
|
|
@@ -5708,6 +5809,100 @@ Similarly, for **GooglePay via MPGS** you can initialize the `PaymentMethodSpeci
|
|
|
5708
5809
|
</dd>
|
|
5709
5810
|
</dl>
|
|
5710
5811
|
|
|
5812
|
+
<a name="IEventData" id="IEventData" href="#IEventData"> </a>
|
|
5813
|
+
|
|
5814
|
+
## IEventData
|
|
5815
|
+
Interface of data from events.
|
|
5816
|
+
|
|
5817
|
+
**Kind**: global interface
|
|
5818
|
+
|
|
5819
|
+
| Param | Type |
|
|
5820
|
+
| --- | --- |
|
|
5821
|
+
| event | <code>string</code> |
|
|
5822
|
+
| data | <code>void</code> \| [<code>IWalletPaymentSuccessful</code>](#IWalletPaymentSuccessful) \| [<code>IWalletUpdate</code>](#IWalletUpdate) \| [<code>IWalletUnavailable</code>](#IWalletUnavailable) \| [<code>IWalletOnClick</code>](#IWalletOnClick) \| <code>any</code> |
|
|
5823
|
+
|
|
5824
|
+
<a name="IWalletPaymentSuccessful" id="IWalletPaymentSuccessful" href="#IWalletPaymentSuccessful"> </a>
|
|
5825
|
+
|
|
5826
|
+
## IWalletPaymentSuccessful
|
|
5827
|
+
Interface of data from a successful payment result.
|
|
5828
|
+
|
|
5829
|
+
**Kind**: global interface
|
|
5830
|
+
|
|
5831
|
+
| Param | Type |
|
|
5832
|
+
| --- | --- |
|
|
5833
|
+
| id | <code>string</code> |
|
|
5834
|
+
| amount | <code>number</code> |
|
|
5835
|
+
| currency | <code>string</code> |
|
|
5836
|
+
| status | <code>string</code> |
|
|
5837
|
+
| [payer_name] | <code>string</code> |
|
|
5838
|
+
| [payer_email] | <code>string</code> |
|
|
5839
|
+
| [payer_phone] | <code>string</code> |
|
|
5840
|
+
|
|
5841
|
+
<a name="IWalletUpdate" id="IWalletUpdate" href="#IWalletUpdate"> </a>
|
|
5842
|
+
|
|
5843
|
+
## IWalletUpdate
|
|
5844
|
+
Interface of data from an update event.
|
|
5845
|
+
|
|
5846
|
+
**Kind**: global interface
|
|
5847
|
+
|
|
5848
|
+
| Param | Type |
|
|
5849
|
+
| --- | --- |
|
|
5850
|
+
| [wallet_response_code] | <code>string</code> |
|
|
5851
|
+
| [wallet_session_id] | <code>string</code> |
|
|
5852
|
+
| [payment_source] | <code>object</code> |
|
|
5853
|
+
| [payment_source.wallet_payment_method_id] | <code>string</code> |
|
|
5854
|
+
| [payment_source.card_number_last4] | <code>string</code> |
|
|
5855
|
+
| [payment_source.card_scheme] | <code>string</code> |
|
|
5856
|
+
| [wallet_loyalty_account] | <code>object</code> |
|
|
5857
|
+
| [wallet_loyalty_account.id] | <code>string</code> |
|
|
5858
|
+
| [wallet_loyalty_account.barcode] | <code>string</code> |
|
|
5859
|
+
| [shipping] | <code>object</code> |
|
|
5860
|
+
| [shipping.address_line1] | <code>string</code> |
|
|
5861
|
+
| [shipping.address_line2] | <code>string</code> |
|
|
5862
|
+
| [shipping.address_postcode] | <code>string</code> |
|
|
5863
|
+
| [shipping.address_city] | <code>string</code> |
|
|
5864
|
+
| [shipping.address_state] | <code>string</code> |
|
|
5865
|
+
| [shipping.address_country] | <code>string</code> |
|
|
5866
|
+
| [shipping.address_company] | <code>string</code> |
|
|
5867
|
+
| [shipping.post_office_box_number] | <code>string</code> |
|
|
5868
|
+
| [shipping.wallet_address_id] | <code>string</code> |
|
|
5869
|
+
| [shipping.wallet_address_name] | <code>string</code> |
|
|
5870
|
+
| [shipping.wallet_address_created_timestamp] | <code>string</code> |
|
|
5871
|
+
| [shipping.wallet_address_updated_timestamp] | <code>string</code> |
|
|
5872
|
+
|
|
5873
|
+
<a name="IWalletOnClick" id="IWalletOnClick" href="#IWalletOnClick"> </a>
|
|
5874
|
+
|
|
5875
|
+
## IWalletOnClick
|
|
5876
|
+
Interface of data from a wallet onClick event.
|
|
5877
|
+
|
|
5878
|
+
**Kind**: global interface
|
|
5879
|
+
|
|
5880
|
+
| Param | Description |
|
|
5881
|
+
| --- | --- |
|
|
5882
|
+
| attachResult | Method to be called that attaches a result to the wallet onClick operation. When handler is synchronous, this method is optionally called with a boolean flag indicating validation result. When handler executes asynchronous operations, this method must be called with the Promise to have the wallet process wait for its completion or rejection. |
|
|
5883
|
+
|
|
5884
|
+
<a name="IWalletUnavailable" id="IWalletUnavailable" href="#IWalletUnavailable"> </a>
|
|
5885
|
+
|
|
5886
|
+
## IWalletUnavailable
|
|
5887
|
+
Interface of data from an unavailable event.
|
|
5888
|
+
|
|
5889
|
+
**Kind**: global interface
|
|
5890
|
+
|
|
5891
|
+
| Param | Type | Description |
|
|
5892
|
+
| --- | --- | --- |
|
|
5893
|
+
| [wallet] | <code>string</code> | For gateways with more than one wallet button available (e.g: MPGS with ApplePay and GooglePay). Possible values for wallet are 'apple' or 'google'. |
|
|
5894
|
+
|
|
5895
|
+
<a name="IWalletUpdateData" id="IWalletUpdateData" href="#IWalletUpdateData"> </a>
|
|
5896
|
+
|
|
5897
|
+
## IWalletUpdateData
|
|
5898
|
+
Interface of data for wallet button `update` call.
|
|
5899
|
+
|
|
5900
|
+
**Kind**: global interface
|
|
5901
|
+
|
|
5902
|
+
| Param | Type |
|
|
5903
|
+
| --- | --- |
|
|
5904
|
+
| success | <code>boolean</code> |
|
|
5905
|
+
|
|
5711
5906
|
<a name="IWalletMeta" id="IWalletMeta" href="#IWalletMeta"> </a>
|
|
5712
5907
|
|
|
5713
5908
|
## IWalletMeta : <code>object</code>
|
|
@@ -5792,14 +5987,19 @@ Class WalletButtons to work with different E-Wallets within html (currently supp
|
|
|
5792
5987
|
* [.load()](#WalletButtons+load)
|
|
5793
5988
|
* [.update()](#WalletButtons+update)
|
|
5794
5989
|
* [.setEnv(env, [alias])](#WalletButtons+setEnv)
|
|
5990
|
+
* [.enable()](#WalletButtons+enable)
|
|
5991
|
+
* [.disable()](#WalletButtons+disable)
|
|
5795
5992
|
* [.close()](#WalletButtons+close)
|
|
5796
|
-
* [.on(eventName, [cb])](#WalletButtons+on) ⇒ <code>Promise.<IEventData></code> \| <code>void</code>
|
|
5993
|
+
* [.on(eventName, [cb])](#WalletButtons+on) ⇒ [<code>Promise.<IEventData></code>](#IEventData) \| <code>void</code>
|
|
5797
5994
|
* [.onUnavailable([handler])](#WalletButtons+onUnavailable)
|
|
5798
5995
|
* [.onUpdate([handler])](#WalletButtons+onUpdate)
|
|
5799
5996
|
* [.onPaymentSuccessful([handler])](#WalletButtons+onPaymentSuccessful)
|
|
5800
5997
|
* [.onPaymentInReview([handler])](#WalletButtons+onPaymentInReview)
|
|
5801
5998
|
* [.onPaymentError([handler])](#WalletButtons+onPaymentError)
|
|
5802
5999
|
* [.onAuthTokensChanged([handler])](#WalletButtons+onAuthTokensChanged)
|
|
6000
|
+
* [.onClick(handler)](#WalletButtons+onClick)
|
|
6001
|
+
* [.onCheckoutOpen(handler)](#WalletButtons+onCheckoutOpen)
|
|
6002
|
+
* [.onCheckoutClose(handler)](#WalletButtons+onCheckoutClose)
|
|
5803
6003
|
|
|
5804
6004
|
<a name="new_WalletButtons_new" id="new_WalletButtons_new" href="#new_WalletButtons_new"> </a>
|
|
5805
6005
|
|
|
@@ -5910,6 +6110,26 @@ Bear in mind that you must set an environment before calling `button.load()`.
|
|
|
5910
6110
|
```js
|
|
5911
6111
|
button.setEnv('production', 'paydock.com');
|
|
5912
6112
|
```
|
|
6113
|
+
<a name="WalletButtons+enable" id="WalletButtons+enable" href="#WalletButtons+enable"> </a>
|
|
6114
|
+
|
|
6115
|
+
### walletButtons.enable()
|
|
6116
|
+
Current method can enable the payment button. This method is only supported for Flypay V2.
|
|
6117
|
+
|
|
6118
|
+
**Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
|
|
6119
|
+
**Example**
|
|
6120
|
+
```js
|
|
6121
|
+
button.enable();
|
|
6122
|
+
```
|
|
6123
|
+
<a name="WalletButtons+disable" id="WalletButtons+disable" href="#WalletButtons+disable"> </a>
|
|
6124
|
+
|
|
6125
|
+
### walletButtons.disable()
|
|
6126
|
+
Current method can disable the payment button. This method is only supported for Flypay V2.
|
|
6127
|
+
|
|
6128
|
+
**Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
|
|
6129
|
+
**Example**
|
|
6130
|
+
```js
|
|
6131
|
+
button.disable('production', 'paydock.com');
|
|
6132
|
+
```
|
|
5913
6133
|
<a name="WalletButtons+close" id="WalletButtons+close" href="#WalletButtons+close"> </a>
|
|
5914
6134
|
|
|
5915
6135
|
### walletButtons.close()
|
|
@@ -5922,7 +6142,7 @@ button.close();
|
|
|
5922
6142
|
```
|
|
5923
6143
|
<a name="WalletButtons+on" id="WalletButtons+on" href="#WalletButtons+on"> </a>
|
|
5924
6144
|
|
|
5925
|
-
### walletButtons.on(eventName, [cb]) ⇒ <code>Promise.<IEventData></code> \| <code>void</code>
|
|
6145
|
+
### walletButtons.on(eventName, [cb]) ⇒ [<code>Promise.<IEventData></code>](#IEventData) \| <code>void</code>
|
|
5926
6146
|
Listen to events of button. `unavailable` returns no data, `paymentSuccessful` returns IWalletPaymentSuccessful
|
|
5927
6147
|
for Stripe or full response for Flypay, and `paymentError` an error.
|
|
5928
6148
|
|
|
@@ -6085,6 +6305,63 @@ button.onAuthTokensChanged().then((eventData) => {
|
|
|
6085
6305
|
console.log('Authentication tokens changed:', eventData);
|
|
6086
6306
|
});
|
|
6087
6307
|
```
|
|
6308
|
+
<a name="WalletButtons+onClick" id="WalletButtons+onClick" href="#WalletButtons+onClick"> </a>
|
|
6309
|
+
|
|
6310
|
+
### walletButtons.onClick(handler)
|
|
6311
|
+
Registers a callback function to be invoked when the wallet button gets clicked.
|
|
6312
|
+
There are two operational modes supported, Synchronous and Asynchronous.
|
|
6313
|
+
When asynchronous operations need to occur on the callback handler, attaching the Promise via `attachResult` is required to have the wallet wait for a result.
|
|
6314
|
+
When synchronous operations occur on the callback handler, attaching a boolean result via `attachResult` is optional to control the execution flow.
|
|
6315
|
+
Note this is supported for Paypal, GooglePay and ApplePay wallet buttons at the moment.
|
|
6316
|
+
|
|
6317
|
+
**Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
|
|
6318
|
+
|
|
6319
|
+
| Param | Type | Description |
|
|
6320
|
+
| --- | --- | --- |
|
|
6321
|
+
| handler | <code>listener</code> | Function to be called when the wallet button is clicked. |
|
|
6322
|
+
|
|
6323
|
+
**Example**
|
|
6324
|
+
```js
|
|
6325
|
+
button.onClick((data) => {
|
|
6326
|
+
performValidationLogic();
|
|
6327
|
+
});
|
|
6328
|
+
```
|
|
6329
|
+
<a name="WalletButtons+onCheckoutOpen" id="WalletButtons+onCheckoutOpen" href="#WalletButtons+onCheckoutOpen"> </a>
|
|
6330
|
+
|
|
6331
|
+
### walletButtons.onCheckoutOpen(handler)
|
|
6332
|
+
Registers a callback function to be invoked when the wallet checkout opens.
|
|
6333
|
+
Note this is supported for FlypayV2 wallet button at the moment.
|
|
6334
|
+
|
|
6335
|
+
**Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
|
|
6336
|
+
|
|
6337
|
+
| Param | Type | Description |
|
|
6338
|
+
| --- | --- | --- |
|
|
6339
|
+
| handler | <code>listener</code> | Function to be called when the wallet checkout opens. |
|
|
6340
|
+
|
|
6341
|
+
**Example**
|
|
6342
|
+
```js
|
|
6343
|
+
button.onCheckoutOpen((data) => {
|
|
6344
|
+
console.log('Checkout opens');
|
|
6345
|
+
});
|
|
6346
|
+
```
|
|
6347
|
+
<a name="WalletButtons+onCheckoutClose" id="WalletButtons+onCheckoutClose" href="#WalletButtons+onCheckoutClose"> </a>
|
|
6348
|
+
|
|
6349
|
+
### walletButtons.onCheckoutClose(handler)
|
|
6350
|
+
Registers a callback function to be invoked when the wallet checkout closes.
|
|
6351
|
+
Note this is supported for FlypayV2 wallet button at the moment.
|
|
6352
|
+
|
|
6353
|
+
**Kind**: instance method of [<code>WalletButtons</code>](#WalletButtons)
|
|
6354
|
+
|
|
6355
|
+
| Param | Type | Description |
|
|
6356
|
+
| --- | --- | --- |
|
|
6357
|
+
| handler | <code>listener</code> | Function to be called when the wallet checkout closes. |
|
|
6358
|
+
|
|
6359
|
+
**Example**
|
|
6360
|
+
```js
|
|
6361
|
+
button.onCheckoutClose(() => {
|
|
6362
|
+
console.log('Wallet checkout closes');
|
|
6363
|
+
});
|
|
6364
|
+
```
|
|
6088
6365
|
<a name="EVENT" id="EVENT" href="#EVENT"> </a>
|
|
6089
6366
|
|
|
6090
6367
|
## EVENT : <code>object</code>
|
|
@@ -6098,31 +6375,36 @@ List of available event's name in the wallet button lifecycle
|
|
|
6098
6375
|
| UPDATE | <code>string</code> | <code>"update"</code> |
|
|
6099
6376
|
| PAYMENT_SUCCESSFUL | <code>string</code> | <code>"paymentSuccessful"</code> |
|
|
6100
6377
|
| PAYMENT_ERROR | <code>string</code> | <code>"paymentError"</code> |
|
|
6378
|
+
| ON_CLICK | <code>string</code> | <code>"onClick"</code> |
|
|
6379
|
+
|
|
6101
6380
|
|
|
6381
|
+
# Secure Remote Commerce
|
|
6102
6382
|
|
|
6103
|
-
##
|
|
6104
|
-
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#SRC).
|
|
6383
|
+
## Overview
|
|
6105
6384
|
|
|
6106
|
-
|
|
6385
|
+
Integrate with Mastercard SRC using Paydock's Mastercard SRC widget.
|
|
6386
|
+
For a full description of the methods and parameters, reference the [README file](https://www.npmjs.com/package/@paydock/client-sdk#SRC).
|
|
6107
6387
|
|
|
6108
6388
|
## SRC simple example
|
|
6109
6389
|
|
|
6110
|
-
|
|
6390
|
+
The following section provides an example use case and integration for the widget.
|
|
6391
|
+
|
|
6392
|
+
### Create a Container
|
|
6393
|
+
|
|
6394
|
+
To integrate the SRC checkout iFrame, create a container in your HTML code. This container serves as the placeholder for the iFrame.
|
|
6111
6395
|
|
|
6112
6396
|
```html
|
|
6113
|
-
<div id="checkoutButton"></div>
|
|
6114
6397
|
<div id="checkoutIframe"></div>
|
|
6115
6398
|
```
|
|
6116
6399
|
|
|
6117
|
-
|
|
6400
|
+
### Initialize the Widget
|
|
6118
6401
|
|
|
6402
|
+
Use the following code to initialize your widget:
|
|
6119
6403
|
|
|
6120
|
-
### Initialization
|
|
6121
6404
|
```javascript
|
|
6122
|
-
var src = new paydock.
|
|
6123
|
-
"#checkoutButton",
|
|
6405
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6124
6406
|
"#checkoutIframe",
|
|
6125
|
-
"
|
|
6407
|
+
"service_id",
|
|
6126
6408
|
"paydock_public_key_or_access_token",
|
|
6127
6409
|
{}, // meta
|
|
6128
6410
|
);
|
|
@@ -6131,23 +6413,22 @@ src.load();
|
|
|
6131
6413
|
|
|
6132
6414
|
```javascript
|
|
6133
6415
|
// ES2015 | TypeScript
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
var src = new SRC(
|
|
6138
|
-
"#checkoutButton",
|
|
6416
|
+
import { MastercardSRCClickToPay } from '@paydock/client-sdk';
|
|
6417
|
+
var src = new MastercardSRCClickToPay(
|
|
6139
6418
|
"#checkoutIframe",
|
|
6140
|
-
"
|
|
6419
|
+
"service_id",
|
|
6141
6420
|
"paydock_public_key_or_access_token",
|
|
6142
6421
|
{}, // meta
|
|
6143
6422
|
);
|
|
6144
6423
|
src.load();
|
|
6145
6424
|
```
|
|
6146
6425
|
|
|
6147
|
-
*NOTE:*
|
|
6426
|
+
*NOTE:* Paydock recommends that you use a Paydock Access Token instead of a public key for security reasons in production environments. When creating your access token, you must enable the `Secure Remote Commerce` and add a whitelist for the domain of your checkout screen.
|
|
6148
6427
|
|
|
6149
6428
|
### Full example
|
|
6150
6429
|
|
|
6430
|
+
A full example of the container and the initialized widget is as follows:
|
|
6431
|
+
|
|
6151
6432
|
```html
|
|
6152
6433
|
<!DOCTYPE html>
|
|
6153
6434
|
<html lang="en">
|
|
@@ -6157,14 +6438,12 @@ src.load();
|
|
|
6157
6438
|
<style>iframe {border: 0;width: 40%;height: 300px;}</style>
|
|
6158
6439
|
</head>
|
|
6159
6440
|
<body>
|
|
6160
|
-
<div id="checkoutButton"></div>
|
|
6161
6441
|
<div id="checkoutIframe"></div>
|
|
6162
6442
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
6163
6443
|
<script>
|
|
6164
|
-
var src = new paydock.
|
|
6165
|
-
"#checkoutButton",
|
|
6444
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6166
6445
|
"#checkoutIframe",
|
|
6167
|
-
"
|
|
6446
|
+
"service_id",
|
|
6168
6447
|
"paydock_public_key_or_access_token",
|
|
6169
6448
|
{},
|
|
6170
6449
|
);
|
|
@@ -6174,50 +6453,30 @@ src.load();
|
|
|
6174
6453
|
</html>
|
|
6175
6454
|
```
|
|
6176
6455
|
|
|
6456
|
+
## Customize your SRC Checkout
|
|
6177
6457
|
|
|
6178
|
-
|
|
6458
|
+
The following is an advanced example that includes customization. You can use these methods to enhance your checkout experience.
|
|
6179
6459
|
|
|
6180
6460
|
### Settings
|
|
6181
6461
|
|
|
6182
6462
|
```javascript
|
|
6183
|
-
|
|
6184
|
-
src.setEnv('sandbox'); // set enviroment
|
|
6185
|
-
|
|
6186
|
-
src.hideButton(); // hide button
|
|
6187
|
-
|
|
6188
|
-
src.showButton(); // show button
|
|
6189
|
-
|
|
6463
|
+
src.setEnv('sandbox'); // set environment
|
|
6190
6464
|
src.hideCheckout(); // hide checkout iframe
|
|
6191
|
-
|
|
6192
6465
|
src.showCheckout(); // show checkout iframe
|
|
6193
|
-
|
|
6194
|
-
src.on('checkoutButtonLoaded', () => {
|
|
6195
|
-
console.log("Button loaded");
|
|
6196
|
-
});
|
|
6197
|
-
|
|
6198
|
-
src.on('checkoutButtonClicked', () => {
|
|
6199
|
-
console.log("Button clicked");
|
|
6200
|
-
});
|
|
6201
|
-
|
|
6202
6466
|
src.on('iframeLoaded', () => {
|
|
6203
6467
|
console.log("Initial iframe loaded");
|
|
6204
6468
|
});
|
|
6205
|
-
|
|
6206
6469
|
src.on('checkoutReady', () => {
|
|
6207
6470
|
console.log("Checkout ready to be used");
|
|
6208
6471
|
});
|
|
6209
|
-
|
|
6210
6472
|
src.on('checkoutCompleted', (token) => {
|
|
6211
6473
|
console.log(token);
|
|
6212
6474
|
});
|
|
6213
|
-
|
|
6214
6475
|
src.on('checkoutError', (error) => {
|
|
6215
6476
|
console.log(error);
|
|
6216
6477
|
});
|
|
6217
6478
|
```
|
|
6218
6479
|
|
|
6219
|
-
Here you can see how you can use this methods to customize your checkout experience
|
|
6220
|
-
|
|
6221
6480
|
### Full example
|
|
6222
6481
|
|
|
6223
6482
|
```html
|
|
@@ -6229,64 +6488,73 @@ Here you can see how you can use this methods to customize your checkout experie
|
|
|
6229
6488
|
<style>iframe {border: 0;width: 40%;height: 450px;}</style>
|
|
6230
6489
|
</head>
|
|
6231
6490
|
<body>
|
|
6232
|
-
<div id="checkoutButton"></div>
|
|
6233
6491
|
<div id="checkoutIframe"></div>
|
|
6234
6492
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
6235
6493
|
<script>
|
|
6236
|
-
var src = new paydock.
|
|
6237
|
-
"#checkoutButton",
|
|
6494
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6238
6495
|
"#checkoutIframe",
|
|
6239
|
-
"
|
|
6496
|
+
"service_id",
|
|
6240
6497
|
"paydock_public_key_or_access_token",
|
|
6241
6498
|
{},
|
|
6242
6499
|
);
|
|
6243
|
-
|
|
6500
|
+
src.on('iframeLoaded', () => {
|
|
6501
|
+
console.log("Initial iframe loaded");
|
|
6502
|
+
});
|
|
6244
6503
|
src.on('checkoutReady', () => {
|
|
6245
6504
|
console.log("Checkout ready to be used");
|
|
6246
6505
|
});
|
|
6247
|
-
|
|
6248
6506
|
src.on('checkoutCompleted', (token) => {
|
|
6249
6507
|
console.log(token);
|
|
6250
6508
|
});
|
|
6509
|
+
src.on('checkoutError', (error) => {
|
|
6510
|
+
console.log(error);
|
|
6511
|
+
});
|
|
6251
6512
|
src.load();
|
|
6252
6513
|
</script>
|
|
6253
6514
|
</body>
|
|
6254
6515
|
</html>
|
|
6255
6516
|
```
|
|
6256
6517
|
|
|
6257
|
-
##
|
|
6258
|
-
### Shipping address:
|
|
6518
|
+
## Customize your billing address fields
|
|
6259
6519
|
|
|
6260
|
-
To customize
|
|
6520
|
+
To customize your billing address experience, Paydock uses a flag that manages whether a customer's billing address is mandatory.
|
|
6521
|
+
The options for this customization are NONE (default option), and POSTAL_COUNTRY or FULL.
|
|
6261
6522
|
|
|
6262
6523
|
```
|
|
6263
|
-
var src = new paydock.
|
|
6264
|
-
"#checkoutButton",
|
|
6524
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6265
6525
|
"#checkoutIframe",
|
|
6266
|
-
"
|
|
6526
|
+
"service_id",
|
|
6267
6527
|
"paydock_public_key_or_access_token",
|
|
6268
6528
|
{
|
|
6269
6529
|
"dpa_transaction_options": {
|
|
6270
|
-
"
|
|
6530
|
+
"dpa_billing_preference": "FULL"
|
|
6271
6531
|
}
|
|
6272
6532
|
},
|
|
6273
6533
|
);
|
|
6274
6534
|
```
|
|
6275
6535
|
|
|
6276
|
-
|
|
6536
|
+
The SRC checkout in the example requires the billing address from the customer, which is then returned as a part of the checkout data. The data is then stored and leveraged in the Paydock charge.
|
|
6537
|
+
You can also provide the billing address at the time of creating the charge. For example, if you have a different method for collecting the billing address, such as outside of the SRC checkout, you can provide it alongside other information at the charge creation step:
|
|
6277
6538
|
|
|
6278
|
-
|
|
6539
|
+
1. Disable the billing address in Paydock's SRC widget.
|
|
6540
|
+
2. Get your One Time Token from the SRC widget alongside other details that may have been collected outside the SRC checkout as the shipping address.
|
|
6541
|
+
3. Send the billing address when creating the charge.
|
|
6279
6542
|
|
|
6280
6543
|
```
|
|
6281
6544
|
POST v1/charges
|
|
6282
|
-
|
|
6283
6545
|
{
|
|
6284
6546
|
"amount": "10.00",
|
|
6285
6547
|
"currency": "AUD",
|
|
6286
|
-
"token": "
|
|
6548
|
+
"token": "one_time_token",
|
|
6287
6549
|
"customer": {
|
|
6288
6550
|
"payment_source": {
|
|
6289
|
-
"gateway_id": "gateway_id"
|
|
6551
|
+
"gateway_id": "gateway_id",
|
|
6552
|
+
"address_line1": "address_line1",
|
|
6553
|
+
"address_line2": "address_line2",
|
|
6554
|
+
"address_city": "address_city",
|
|
6555
|
+
"address_postcode": "address_postcode",
|
|
6556
|
+
"address_state": "address_state",
|
|
6557
|
+
"address_country": "address_country"
|
|
6290
6558
|
}
|
|
6291
6559
|
},
|
|
6292
6560
|
"shipping": {
|
|
@@ -6301,201 +6569,262 @@ POST v1/charges
|
|
|
6301
6569
|
}
|
|
6302
6570
|
```
|
|
6303
6571
|
|
|
6304
|
-
|
|
6572
|
+
## How to customize accepted cards
|
|
6305
6573
|
|
|
6306
|
-
|
|
6574
|
+
You can send a flag `unaccepted_card_type` to block the usage of a specific card type. The available options are 'DEBIT' and 'CREDIT'.
|
|
6575
|
+
|
|
6576
|
+
### Example code
|
|
6577
|
+
|
|
6578
|
+
The following example demonstrates how to block the card:
|
|
6307
6579
|
|
|
6308
6580
|
```
|
|
6309
|
-
var src = new paydock.
|
|
6310
|
-
"#checkoutButton",
|
|
6581
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6311
6582
|
"#checkoutIframe",
|
|
6312
|
-
"
|
|
6313
|
-
"
|
|
6583
|
+
"service_id",
|
|
6584
|
+
"paydock_public_key",
|
|
6314
6585
|
{
|
|
6315
|
-
|
|
6316
|
-
"email": "test@email.com",
|
|
6317
|
-
"first_name": "Name",
|
|
6318
|
-
"last_name": "Surname",
|
|
6319
|
-
"phone": {
|
|
6320
|
-
"country_code": "1",
|
|
6321
|
-
"phone": "2124567890"
|
|
6322
|
-
},
|
|
6323
|
-
"payment_source": {
|
|
6324
|
-
"address_line1": "Line 1",
|
|
6325
|
-
"address_line2": "Line 2",
|
|
6326
|
-
"address_city": "Miami",
|
|
6327
|
-
"address_postcode": "33126",
|
|
6328
|
-
"address_state": "FL",
|
|
6329
|
-
"address_country": "US"
|
|
6330
|
-
}
|
|
6331
|
-
}
|
|
6586
|
+
unaccepted_card_type: 'DEBIT'
|
|
6332
6587
|
},
|
|
6333
6588
|
);
|
|
6334
6589
|
```
|
|
6335
6590
|
|
|
6336
|
-
##
|
|
6591
|
+
## Personalize the Style
|
|
6337
6592
|
|
|
6338
|
-
|
|
6593
|
+
Customize the look and feel of your UI. The following example demonstrates changes in the styling of the buttons.
|
|
6339
6594
|
|
|
6340
6595
|
### Example code
|
|
6341
6596
|
|
|
6342
6597
|
```
|
|
6343
|
-
var src = new paydock.
|
|
6344
|
-
"#checkoutButton",
|
|
6598
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6345
6599
|
"#checkoutIframe",
|
|
6346
|
-
"
|
|
6600
|
+
"service_id",
|
|
6347
6601
|
"paydock_public_key",
|
|
6602
|
+
{},
|
|
6348
6603
|
);
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6604
|
+
src.setStyles({
|
|
6605
|
+
enable_src_popup: true,
|
|
6606
|
+
primary_button_color: 'red',
|
|
6607
|
+
secondary_button_color: 'red',
|
|
6608
|
+
primary_button_text_color: 'red',
|
|
6609
|
+
secondary_button_text_color: 'red',
|
|
6610
|
+
font_family: 'Arial',
|
|
6611
|
+
});
|
|
6352
6612
|
```
|
|
6353
|
-
## Event and Values
|
|
6354
|
-
|
|
6355
|
-
| Event Value | Type | Description |
|
|
6356
|
-
| ------------------- | ------------------- | -------------------------------------------------------------- |
|
|
6357
|
-
| primary_color | <code>string</code> | HEX color for the principal buttons, example : #32a852 |
|
|
6358
|
-
| button_text_color | <code>string</code> | HEX color for the text of the buttons, example : #32a852|
|
|
6359
|
-
| font_family | <code>string</code> | Look more [mozilla.org/color](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family)|
|
|
6360
|
-
| card_schemes | <code>[string] - array of string</code> | Possible values "visa", "mastercard", "amex" and "discover" - Default show all logos
|
|
6361
6613
|
|
|
6362
6614
|
## Classes
|
|
6363
6615
|
|
|
6364
6616
|
<dl>
|
|
6365
|
-
<dt><a href="#
|
|
6366
|
-
<dd><p>Class
|
|
6617
|
+
<dt><a href="#MastercardSRCClickToPay">MastercardSRCClickToPay</a> ⇐ <code>SRC</code></dt>
|
|
6618
|
+
<dd><p>Class MastercardSRCClickToPay include methods for interacting with the MastercardSRC checkout and Manual Card option</p>
|
|
6367
6619
|
</dd>
|
|
6368
6620
|
</dl>
|
|
6369
6621
|
|
|
6370
6622
|
## Interfaces
|
|
6371
6623
|
|
|
6372
6624
|
<dl>
|
|
6373
|
-
<dt><a href="#
|
|
6374
|
-
<dd><p>Interface of data used for the
|
|
6625
|
+
<dt><a href="#IMastercardSRCMeta">IMastercardSRCMeta</a> : <code>object</code></dt>
|
|
6626
|
+
<dd><p>Interface of data used for the Mastercard Checkout. For further information refer to <a href="https://developer.mastercard.com/unified-checkout-solutions/documentation/sdk-reference/init">the documentation</a>.</p>
|
|
6627
|
+
</dd>
|
|
6628
|
+
<dt><a href="#EventData">EventData</a> : <code>object</code></dt>
|
|
6629
|
+
<dd><p>Interface for data returned in callbacks</p>
|
|
6630
|
+
</dd>
|
|
6631
|
+
<dt><a href="#EventDataCheckoutCompletedData">EventDataCheckoutCompletedData</a> : <code>object</code></dt>
|
|
6632
|
+
<dd><p>Event data returned for checkoutCompleted callback, holding the One Time Token and the flow type completed.
|
|
6633
|
+
When the flow type is src, masked checkoutData available is also returned</p>
|
|
6634
|
+
</dd>
|
|
6635
|
+
<dt><a href="#IStyles">IStyles</a> : <code>object</code></dt>
|
|
6636
|
+
<dd><p>Interface for style configs inyected to the SRC checkout</p>
|
|
6375
6637
|
</dd>
|
|
6376
6638
|
</dl>
|
|
6377
6639
|
|
|
6378
|
-
<a name="
|
|
6640
|
+
<a name="IMastercardSRCMeta" id="IMastercardSRCMeta" href="#IMastercardSRCMeta"> </a>
|
|
6379
6641
|
|
|
6380
|
-
##
|
|
6381
|
-
Interface of data used for the
|
|
6642
|
+
## IMastercardSRCMeta : <code>object</code>
|
|
6643
|
+
Interface of data used for the Mastercard Checkout. For further information refer to [the documentation](https://developer.mastercard.com/unified-checkout-solutions/documentation/sdk-reference/init).
|
|
6382
6644
|
|
|
6383
6645
|
**Kind**: global interface
|
|
6384
6646
|
|
|
6385
6647
|
| Param | Type | Description |
|
|
6386
6648
|
| --- | --- | --- |
|
|
6387
|
-
| [
|
|
6649
|
+
| [disable_summary_screen] | <code>boolean</code> | Boolean flag that controls if a final summary screen is presented in the checkout flow. |
|
|
6388
6650
|
| [dpa_data] | <code>object</code> | Object where the DPA creation data is stored. |
|
|
6389
|
-
| [dpa_data.dpa_presentation_name] | <code>string</code> | Name in which the DPA is presented
|
|
6651
|
+
| [dpa_data.dpa_presentation_name] | <code>string</code> | Name in which the DPA is presented. |
|
|
6390
6652
|
| [dpa_data.dpa_uri] | <code>string</code> | Used for indicating the DPA URI. |
|
|
6391
|
-
| [
|
|
6653
|
+
| [dpa_data.dpa_address] | <code>string</code> | Address associated with the DPA. |
|
|
6654
|
+
| [dpa_data.dpa_email_address] | <code>string</code> | Email address for DPA communication. |
|
|
6655
|
+
| [dpa_data.dpa_phone_number] | <code>object</code> | Phone number structure for DPA communication. |
|
|
6656
|
+
| [dpa_data.dpa_phone_number.country_code] | <code>string</code> | The country code of the phone number. |
|
|
6657
|
+
| [dpa_data.dpa_phone_number.phone_number] | <code>string</code> | The phone number part of the phone number. |
|
|
6658
|
+
| [dpa_data.dpa_logo_uri] | <code>string</code> | URI for the DPA logo. |
|
|
6659
|
+
| [dpa_data.dpa_supported_email_address] | <code>string</code> | Supported email address for DPA support. |
|
|
6660
|
+
| [dpa_data.dpa_supported_phone_number] | <code>object</code> | Supported phone number for DPA support. |
|
|
6661
|
+
| [dpa_data.dpa_supported_phone_number.country_code] | <code>string</code> | The country code of the phone number. |
|
|
6662
|
+
| [dpa_data.dpa_supported_phone_number.phone_number] | <code>string</code> | The phone number part of the phone number. |
|
|
6663
|
+
| [dpa_data.dpa_support_uri] | <code>string</code> | URI for DPA support. |
|
|
6664
|
+
| [dpa_data.application_type] | <code>string</code> | Application type, either 'WEB_BROWSER' or 'MOBILE_APP'. |
|
|
6665
|
+
| [co_brand_names] | <code>Array.<string></code> | List of co-brand names associated with the SRC experience. |
|
|
6666
|
+
| [checkout_experience] | <code>string</code> | Checkout experience type, either 'WITHIN_CHECKOUT' or 'PAYMENT_SETTINGS'. |
|
|
6667
|
+
| [services] | <code>string</code> | Services offered, such as 'INLINE_CHECKOUT' or 'INLINE_INSTALLMENTS'. |
|
|
6668
|
+
| [dpa_transaction_options] | <code>object</code> | Object that stores options for creating a transaction with DPA. |
|
|
6392
6669
|
| [dpa_transaction_options.dpa_locale] | <code>string</code> | DPA’s preferred locale, example en_US. |
|
|
6393
|
-
| [dpa_transaction_options.dpa_accepted_billing_countries] | <code>Array
|
|
6394
|
-
| [dpa_transaction_options.
|
|
6395
|
-
| [dpa_transaction_options.
|
|
6396
|
-
| [dpa_transaction_options.
|
|
6397
|
-
| [dpa_transaction_options.
|
|
6398
|
-
| [dpa_transaction_options.
|
|
6399
|
-
| [dpa_transaction_options.
|
|
6400
|
-
| [dpa_transaction_options.
|
|
6401
|
-
| [dpa_transaction_options.
|
|
6402
|
-
| [dpa_transaction_options.
|
|
6403
|
-
| [dpa_transaction_options.
|
|
6404
|
-
| [dpa_transaction_options.
|
|
6405
|
-
| [dpa_transaction_options.
|
|
6406
|
-
| [dpa_transaction_options.
|
|
6407
|
-
| [dpa_transaction_options.
|
|
6408
|
-
| [dpa_transaction_options.
|
|
6409
|
-
| [dpa_transaction_options.transaction_amount.transaction_amount] | <code>number</code> | Used to indicate the amount of the transaction. |
|
|
6410
|
-
| [dpa_transaction_options.transaction_amount.transaction_currency_code] | <code>string</code> | Used to indicate the currency code of the transaction. 3 letter ISO code format. |
|
|
6411
|
-
| [dpa_transaction_options.merchant_order_id] | <code>string</code> | Used to indicate the merchants order Id. |
|
|
6412
|
-
| [dpa_transaction_options.merchant_category_code] | <code>string</code> | Used to indicate the merchants category code. |
|
|
6413
|
-
| [dpa_transaction_options.merchant_country_code] | <code>string</code> | Used to indicate the merchants country code. 2 letter ISO code format. |
|
|
6670
|
+
| [dpa_transaction_options.dpa_accepted_billing_countries] | <code>Array.<string></code> | List of accepted billing countries for DPA in ISO 3166-1 alpha-2 format. |
|
|
6671
|
+
| [dpa_transaction_options.dpa_billing_preference] | <code>string</code> | Billing preferences for DPA, options are 'FULL', 'POSTAL_COUNTRY', 'NONE'. |
|
|
6672
|
+
| [dpa_transaction_options.payment_options] | <code>Array.<object></code> | Payment options included in the transaction. |
|
|
6673
|
+
| [dpa_transaction_options.payment_options.dynamic_data_type] | <code>string</code> | Dynamic data types. |
|
|
6674
|
+
| [dpa_transaction_options.order_type] | <code>string</code> | Type of the order, options are 'SPLIT_SHIPMENT', 'PREFERRED_CARD'. |
|
|
6675
|
+
| [dpa_transaction_options.three_ds_preference] | <code>string</code> | Preference for 3DS usage in the transaction. |
|
|
6676
|
+
| [dpa_transaction_options.confirm_payment] | <code>boolean</code> | Indicates if payment confirmation is required. |
|
|
6677
|
+
| [dpa_transaction_options.consumer_name_requested] | <code>boolean</code> | Indicates if consumer name is requested. |
|
|
6678
|
+
| [dpa_transaction_options.consumer_email_address_requested] | <code>boolean</code> | Indicates if consumer email address is requested. |
|
|
6679
|
+
| [dpa_transaction_options.consumer_phone_number_requested] | <code>boolean</code> | Indicates if consumer phone number is requested. |
|
|
6680
|
+
| [dpa_transaction_options.transaction_amount] | <code>object</code> | Details of the transaction amount. |
|
|
6681
|
+
| [dpa_transaction_options.transaction_amount.transaction_amount] | <code>number</code> | Amount of the transaction. |
|
|
6682
|
+
| [dpa_transaction_options.transaction_amount.transaction_currency_code] | <code>string</code> | Currency code of the transaction in 3 letter ISO code format. |
|
|
6683
|
+
| [dpa_transaction_options.merchant_order_id] | <code>string</code> | Merchant's order ID. |
|
|
6684
|
+
| [dpa_transaction_options.merchant_category_code] | <code>string</code> | Merchant's category code. |
|
|
6685
|
+
| [dpa_transaction_options.merchant_country_code] | <code>string</code> | Merchant's country code in ISO 3166-1 alpha-2 format. |
|
|
6414
6686
|
| [customer] | <code>object</code> | Object where the customer data is stored to prefill in the checkout. |
|
|
6415
6687
|
| [customer.email] | <code>string</code> | Customer email. |
|
|
6416
6688
|
| [customer.first_name] | <code>string</code> | Customer first name. |
|
|
6417
6689
|
| [customer.last_name] | <code>string</code> | Customer last name. |
|
|
6418
6690
|
| [customer.phone] | <code>object</code> | Object where the customer phone is stored. |
|
|
6419
|
-
| [customer.phone.country_code] | <code>string</code> | Customer phone country code (example "1" for US). |
|
|
6691
|
+
| [customer.phone.country_code] | <code>string</code> | Customer phone country code (example "1" for US). // TODO: Confirm if it can be removed! |
|
|
6420
6692
|
| [customer.phone.phone] | <code>string</code> | Customer phone number. |
|
|
6421
|
-
| [
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
| [customer.payment_source.address_country] | <code>string</code> | Customer billing address country code (example "US"). |
|
|
6693
|
+
| [unaccepted_card_type] | <code>string</code> | Used to block a specific card type. Options are 'CREDIT', 'DEBIT'. |
|
|
6694
|
+
|
|
6695
|
+
<a name="EventData" id="EventData" href="#EventData"> </a>
|
|
6696
|
+
|
|
6697
|
+
## EventData : <code>object</code>
|
|
6698
|
+
Interface for data returned in callbacks
|
|
6428
6699
|
|
|
6429
|
-
|
|
6700
|
+
**Kind**: global interface
|
|
6430
6701
|
|
|
6431
|
-
|
|
6432
|
-
|
|
6702
|
+
| Param | Type | Description |
|
|
6703
|
+
| --- | --- | --- |
|
|
6704
|
+
| type | [<code>EVENT\_DATA\_TYPE</code>](#EVENT_DATA_TYPE) | Event type of type [EVENT_DATA_TYPE](#EVENT_DATA_TYPE) |
|
|
6705
|
+
| data | <code>string</code> \| [<code>EventDataCheckoutCompletedData</code>](#EventDataCheckoutCompletedData) | optional data returning a string for checkoutError event or [EventDataCheckoutCompletedData](#EventDataCheckoutCompletedData) for checkoutCompleted |
|
|
6706
|
+
|
|
6707
|
+
<a name="EventDataCheckoutCompletedData" id="EventDataCheckoutCompletedData" href="#EventDataCheckoutCompletedData"> </a>
|
|
6708
|
+
|
|
6709
|
+
## EventDataCheckoutCompletedData : <code>object</code>
|
|
6710
|
+
Event data returned for checkoutCompleted callback, holding the One Time Token and the flow type completed.
|
|
6711
|
+
When the flow type is src, masked checkoutData available is also returned
|
|
6712
|
+
|
|
6713
|
+
**Kind**: global interface
|
|
6714
|
+
|
|
6715
|
+
| Param | Type | Description |
|
|
6716
|
+
| --- | --- | --- |
|
|
6717
|
+
| type | <code>string</code> | type of the checkout, can be `src` or `manual`. |
|
|
6718
|
+
| token | <code>string</code> | one time token value. |
|
|
6719
|
+
| [checkoutData] | <code>object</code> | Optional checkout data related to the checkout information. Only available on src flow. |
|
|
6720
|
+
| [checkoutData.card_number_bin] | <code>string</code> | The BIN of the card used for the transaction. |
|
|
6721
|
+
| [checkoutData.card_number_last4] | <code>string</code> | The last four digits of the card number. |
|
|
6722
|
+
| [checkoutData.card_scheme] | <code>string</code> | The card scheme. Values: visa, mastercard, amex, diners, discover. |
|
|
6723
|
+
| [checkoutData.card_type] | <code>string</code> | The type of card. Values: credit, debit, prepaid, combo, flex. |
|
|
6724
|
+
| [checkoutData.address_line1] | <code>string</code> | Address line 1 for billing address. |
|
|
6725
|
+
| [checkoutData.address_line2] | <code>string</code> | Address line 2 for billing address. |
|
|
6726
|
+
| [checkoutData.address_line3] | <code>string</code> | Address line 3 for billing address. |
|
|
6727
|
+
| [checkoutData.address_city] | <code>string</code> | City for billing address. |
|
|
6728
|
+
| [checkoutData.address_postcode] | <code>string</code> | Postal code for billing address. |
|
|
6729
|
+
| [checkoutData.address_state] | <code>string</code> | State or province for billing address. |
|
|
6730
|
+
| [checkoutData.address_country] | <code>string</code> | Country for billing address. |
|
|
6731
|
+
| [checkoutData.shipping] | <code>object</code> | Optional shipping information. |
|
|
6732
|
+
| [checkoutData.shipping.address_line1] | <code>string</code> | Address line 1 for shipping address. |
|
|
6733
|
+
| [checkoutData.shipping.address_line2] | <code>string</code> | Address line 2 for shipping address. |
|
|
6734
|
+
| [checkoutData.shipping.address_line3] | <code>string</code> | Address line 3 for shipping address. |
|
|
6735
|
+
| [checkoutData.shipping.address_city] | <code>string</code> | City for shipping address. |
|
|
6736
|
+
| [checkoutData.shipping.address_postcode] | <code>string</code> | Postal code for shipping address. |
|
|
6737
|
+
| [checkoutData.shipping.address_state] | <code>string</code> | State or province for shipping address. |
|
|
6738
|
+
| [checkoutData.shipping.address_country] | <code>string</code> | Country for shipping address. |
|
|
6739
|
+
|
|
6740
|
+
<a name="IStyles" id="IStyles" href="#IStyles"> </a>
|
|
6741
|
+
|
|
6742
|
+
## IStyles : <code>object</code>
|
|
6743
|
+
Interface for style configs inyected to the SRC checkout
|
|
6744
|
+
|
|
6745
|
+
**Kind**: global interface
|
|
6746
|
+
|
|
6747
|
+
| Param | Type | Description |
|
|
6748
|
+
| --- | --- | --- |
|
|
6749
|
+
| [primary_button_color] | <code>string</code> | Color Code for primary button. |
|
|
6750
|
+
| [primary_button_text_color] | <code>string</code> | Color Code for primary button text. |
|
|
6751
|
+
| [secondary_button_color] | <code>string</code> | Color Code for secondary button. |
|
|
6752
|
+
| [secondary_button_text_color] | <code>string</code> | Color Code for secondary button text. |
|
|
6753
|
+
| [font_family] | <code>string</code> | Font family to be used. |
|
|
6754
|
+
| [enable_src_popup] | <code>boolean</code> | Boolean flag to make the SRC checkout show in a popup window instead of embedded in iframe. |
|
|
6755
|
+
|
|
6756
|
+
<a name="MastercardSRCClickToPay" id="MastercardSRCClickToPay" href="#MastercardSRCClickToPay"> </a>
|
|
6757
|
+
|
|
6758
|
+
## MastercardSRCClickToPay ⇐ <code>SRC</code>
|
|
6759
|
+
Class MastercardSRCClickToPay include methods for interacting with the MastercardSRC checkout and Manual Card option
|
|
6433
6760
|
|
|
6434
6761
|
**Kind**: global class
|
|
6762
|
+
**Extends**: <code>SRC</code>
|
|
6435
6763
|
|
|
6436
|
-
* [
|
|
6437
|
-
* [new
|
|
6764
|
+
* [MastercardSRCClickToPay](#MastercardSRCClickToPay) ⇐ <code>SRC</code>
|
|
6765
|
+
* [new MastercardSRCClickToPay(iframe_selector, service_id, public_key_or_access_token, meta)](#new_MastercardSRCClickToPay_new)
|
|
6766
|
+
* [.load()](#MastercardSRCClickToPay+load)
|
|
6438
6767
|
* [.setStyles(fields)](#SRC+setStyles)
|
|
6439
|
-
* [.load()](#SRC+load)
|
|
6440
6768
|
* [.setEnv(env, [alias])](#SRC+setEnv)
|
|
6441
6769
|
* [.getEnv()](#SRC+getEnv)
|
|
6442
6770
|
* [.on(eventName, [cb])](#SRC+on) ⇒ <code>Promise.<any></code> \| <code>void</code>
|
|
6443
|
-
* [.hideButton([saveSize])](#SRC+hideButton)
|
|
6444
|
-
* [.showButton()](#SRC+showButton)
|
|
6445
6771
|
* [.hideCheckout([saveSize])](#SRC+hideCheckout)
|
|
6446
6772
|
* [.showCheckout()](#SRC+showCheckout)
|
|
6447
6773
|
* [.reload()](#SRC+reload)
|
|
6448
6774
|
* [.useAutoResize()](#SRC+useAutoResize)
|
|
6449
6775
|
|
|
6450
|
-
<a name="
|
|
6776
|
+
<a name="new_MastercardSRCClickToPay_new" id="new_MastercardSRCClickToPay_new" href="#new_MastercardSRCClickToPay_new"> </a>
|
|
6451
6777
|
|
|
6452
|
-
### new
|
|
6778
|
+
### new MastercardSRCClickToPay(iframe_selector, service_id, public_key_or_access_token, meta)
|
|
6453
6779
|
|
|
6454
6780
|
| Param | Type | Description |
|
|
6455
6781
|
| --- | --- | --- |
|
|
6456
|
-
| button_selector | <code>string</code> | Selector of html element. Container for SRC checkout button. |
|
|
6457
6782
|
| iframe_selector | <code>string</code> | Selector of html element. Container for SRC checkout iFrame. |
|
|
6458
6783
|
| service_id | <code>string</code> | Card Scheme Service ID |
|
|
6459
6784
|
| public_key_or_access_token | <code>string</code> | Paydock public key or Access Token |
|
|
6460
|
-
| meta | [<code>
|
|
6785
|
+
| meta | [<code>IMastercardSRCMeta</code>](#IMastercardSRCMeta) | Data that configures the SRC checkout |
|
|
6461
6786
|
|
|
6462
6787
|
**Example**
|
|
6463
6788
|
```js
|
|
6464
|
-
var
|
|
6789
|
+
var mastercardSRC = new MastercardSRCClickToPay('#checkoutIframe', 'service_id', 'public_key', {});
|
|
6465
6790
|
```
|
|
6791
|
+
<a name="MastercardSRCClickToPay+load" id="MastercardSRCClickToPay+load" href="#MastercardSRCClickToPay+load"> </a>
|
|
6792
|
+
|
|
6793
|
+
### mastercardSRCClickToPay.load()
|
|
6794
|
+
The final method after configuring the SRC to start the load process of SRC checkout
|
|
6795
|
+
|
|
6796
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6466
6797
|
<a name="SRC+setStyles" id="SRC+setStyles" href="#SRC+setStyles"> </a>
|
|
6467
6798
|
|
|
6468
|
-
###
|
|
6799
|
+
### mastercardSRCClickToPay.setStyles(fields)
|
|
6469
6800
|
Object contain styles for widget - call before `.load()`.
|
|
6470
6801
|
|
|
6471
|
-
**Kind**: instance method of [<code>
|
|
6802
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6803
|
+
**Overrides**: [<code>setStyles</code>](#SRC+setStyles)
|
|
6472
6804
|
|
|
6473
6805
|
| Param | Type | Description |
|
|
6474
6806
|
| --- | --- | --- |
|
|
6475
|
-
| fields | <code>IStyles</code> | name of styles which can be shown in widget [STYLE](STYLE) |
|
|
6807
|
+
| fields | [<code>IStyles</code>](#IStyles) | name of styles which can be shown in widget [STYLE](STYLE) |
|
|
6476
6808
|
|
|
6477
6809
|
**Example**
|
|
6478
6810
|
```js
|
|
6479
6811
|
widget.setStyles({
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
6484
|
-
|
|
6812
|
+
enable_src_popup: true
|
|
6813
|
+
primary_button_color: 'red',
|
|
6814
|
+
secondary_button_color: 'blue',
|
|
6815
|
+
primary_button_text_color: 'white',
|
|
6816
|
+
secondary_button_text_color: 'white',
|
|
6817
|
+
font_family: 'Arial',
|
|
6818
|
+
});
|
|
6485
6819
|
```
|
|
6486
|
-
<a name="SRC+load" id="SRC+load" href="#SRC+load"> </a>
|
|
6487
|
-
|
|
6488
|
-
### srC.load()
|
|
6489
|
-
The final method after configuring the SRC to start the load process of SRC checkout
|
|
6490
|
-
|
|
6491
|
-
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
6492
6820
|
<a name="SRC+setEnv" id="SRC+setEnv" href="#SRC+setEnv"> </a>
|
|
6493
6821
|
|
|
6494
|
-
###
|
|
6822
|
+
### mastercardSRCClickToPay.setEnv(env, [alias])
|
|
6495
6823
|
Current method can change environment. By default environment = sandbox.
|
|
6496
6824
|
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
6497
6825
|
|
|
6498
|
-
**Kind**: instance method of [<code>
|
|
6826
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6827
|
+
**Overrides**: [<code>setEnv</code>](#SRC+setEnv)
|
|
6499
6828
|
|
|
6500
6829
|
| Param | Type | Description |
|
|
6501
6830
|
| --- | --- | --- |
|
|
@@ -6508,25 +6837,27 @@ SRC.setEnv('production');
|
|
|
6508
6837
|
```
|
|
6509
6838
|
<a name="SRC+getEnv" id="SRC+getEnv" href="#SRC+getEnv"> </a>
|
|
6510
6839
|
|
|
6511
|
-
###
|
|
6840
|
+
### mastercardSRCClickToPay.getEnv()
|
|
6512
6841
|
Method to read the current environment
|
|
6513
6842
|
|
|
6514
|
-
**Kind**: instance method of [<code>
|
|
6843
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6844
|
+
**Overrides**: [<code>getEnv</code>](#SRC+getEnv)
|
|
6515
6845
|
**Example**
|
|
6516
6846
|
```js
|
|
6517
6847
|
SRC.getEnv();
|
|
6518
6848
|
```
|
|
6519
6849
|
<a name="SRC+on" id="SRC+on" href="#SRC+on"> </a>
|
|
6520
6850
|
|
|
6521
|
-
###
|
|
6851
|
+
### mastercardSRCClickToPay.on(eventName, [cb]) ⇒ <code>Promise.<any></code> \| <code>void</code>
|
|
6522
6852
|
Listen to events of SRC
|
|
6523
6853
|
|
|
6524
|
-
**Kind**: instance method of [<code>
|
|
6854
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6855
|
+
**Overrides**: [<code>on</code>](#SRC+on)
|
|
6525
6856
|
|
|
6526
6857
|
| Param | Type | Description |
|
|
6527
6858
|
| --- | --- | --- |
|
|
6528
6859
|
| eventName | <code>string</code> | Available event names [EVENT](#EVENT) |
|
|
6529
|
-
| [cb] | <code>listener</code> |
|
|
6860
|
+
| [cb] | <code>listener</code> | The callback to handle the event. When available, it will send back data of type [EventData](#EventData) |
|
|
6530
6861
|
|
|
6531
6862
|
**Example**
|
|
6532
6863
|
```js
|
|
@@ -6538,37 +6869,13 @@ SRC.on('checkoutCompleted').then(function (token) {
|
|
|
6538
6869
|
console.log(token);
|
|
6539
6870
|
});
|
|
6540
6871
|
```
|
|
6541
|
-
<a name="SRC+hideButton" id="SRC+hideButton" href="#SRC+hideButton"> </a>
|
|
6542
|
-
|
|
6543
|
-
### srC.hideButton([saveSize])
|
|
6544
|
-
Using this method you can hide button
|
|
6545
|
-
|
|
6546
|
-
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
6547
|
-
|
|
6548
|
-
| Param | Type | Default | Description |
|
|
6549
|
-
| --- | --- | --- | --- |
|
|
6550
|
-
| [saveSize] | <code>boolean</code> | <code>false</code> | using this param you can save iframe's size (if applicable) |
|
|
6551
|
-
|
|
6552
|
-
**Example**
|
|
6553
|
-
```js
|
|
6554
|
-
SRC.hideButton();
|
|
6555
|
-
```
|
|
6556
|
-
<a name="SRC+showButton" id="SRC+showButton" href="#SRC+showButton"> </a>
|
|
6557
|
-
|
|
6558
|
-
### srC.showButton()
|
|
6559
|
-
Using this method you can show the SRC button after using hideButton method
|
|
6560
|
-
|
|
6561
|
-
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
6562
|
-
**Example**
|
|
6563
|
-
```js
|
|
6564
|
-
SRC.showButton();
|
|
6565
|
-
```
|
|
6566
6872
|
<a name="SRC+hideCheckout" id="SRC+hideCheckout" href="#SRC+hideCheckout"> </a>
|
|
6567
6873
|
|
|
6568
|
-
###
|
|
6874
|
+
### mastercardSRCClickToPay.hideCheckout([saveSize])
|
|
6569
6875
|
Using this method you can hide checkout after load and button click
|
|
6570
6876
|
|
|
6571
|
-
**Kind**: instance method of [<code>
|
|
6877
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6878
|
+
**Overrides**: [<code>hideCheckout</code>](#SRC+hideCheckout)
|
|
6572
6879
|
|
|
6573
6880
|
| Param | Type | Default | Description |
|
|
6574
6881
|
| --- | --- | --- | --- |
|
|
@@ -6580,30 +6887,33 @@ SRC.hideCheckout();
|
|
|
6580
6887
|
```
|
|
6581
6888
|
<a name="SRC+showCheckout" id="SRC+showCheckout" href="#SRC+showCheckout"> </a>
|
|
6582
6889
|
|
|
6583
|
-
###
|
|
6890
|
+
### mastercardSRCClickToPay.showCheckout()
|
|
6584
6891
|
Using this method you can show checkout after using hideCheckout method
|
|
6585
6892
|
|
|
6586
|
-
**Kind**: instance method of [<code>
|
|
6893
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6894
|
+
**Overrides**: [<code>showCheckout</code>](#SRC+showCheckout)
|
|
6587
6895
|
**Example**
|
|
6588
6896
|
```js
|
|
6589
6897
|
SRC.showCheckout()
|
|
6590
6898
|
```
|
|
6591
6899
|
<a name="SRC+reload" id="SRC+reload" href="#SRC+reload"> </a>
|
|
6592
6900
|
|
|
6593
|
-
###
|
|
6901
|
+
### mastercardSRCClickToPay.reload()
|
|
6594
6902
|
Using this method you can reload the whole checkout
|
|
6595
6903
|
|
|
6596
|
-
**Kind**: instance method of [<code>
|
|
6904
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6905
|
+
**Overrides**: [<code>reload</code>](#SRC+reload)
|
|
6597
6906
|
**Example**
|
|
6598
6907
|
```js
|
|
6599
6908
|
SRC.reload()
|
|
6600
6909
|
```
|
|
6601
6910
|
<a name="SRC+useAutoResize" id="SRC+useAutoResize" href="#SRC+useAutoResize"> </a>
|
|
6602
6911
|
|
|
6603
|
-
###
|
|
6912
|
+
### mastercardSRCClickToPay.useAutoResize()
|
|
6604
6913
|
Use this method for resize checkout iFrame according to content height, if applicable
|
|
6605
6914
|
|
|
6606
|
-
**Kind**: instance method of [<code>
|
|
6915
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6916
|
+
**Overrides**: [<code>useAutoResize</code>](#SRC+useAutoResize)
|
|
6607
6917
|
**Example**
|
|
6608
6918
|
```js
|
|
6609
6919
|
SRC.useAutoResize();
|
|
@@ -6615,15 +6925,28 @@ List of available event's name in the SRC checkout lifecycle
|
|
|
6615
6925
|
|
|
6616
6926
|
**Kind**: global enum
|
|
6617
6927
|
|
|
6618
|
-
| Param | Type | Default |
|
|
6619
|
-
| --- | --- | --- |
|
|
6620
|
-
|
|
|
6621
|
-
|
|
|
6622
|
-
|
|
|
6623
|
-
|
|
|
6624
|
-
| CHECKOUT_COMPLETED | <code>string</code> | <code>"checkoutCompleted"</code> |
|
|
6625
|
-
| CHECKOUT_ERROR | <code>string</code> | <code>"checkoutError"</code> |
|
|
6928
|
+
| Param | Type | Default | Description |
|
|
6929
|
+
| --- | --- | --- | --- |
|
|
6930
|
+
| IFRAME_LOADED | <code>string</code> | <code>"iframeLoaded"</code> | Initial event sent when IFrame is initially loaded. |
|
|
6931
|
+
| CHECKOUT_READY | <code>string</code> | <code>"checkoutReady"</code> | Event sent when checkout is loaded and ready to be used by customer. Leverage alongside [showCheckout](#SRC+showCheckout) and [hideCheckout](#SRC+hideCheckout). |
|
|
6932
|
+
| CHECKOUT_POPUP_OPEN | <code>string</code> | <code>"checkoutPopupOpen"</code> | Event sent when SRC Checkout flow is started, regardless of embedded or windowed mode. |
|
|
6933
|
+
| CHECKOUT_POPUP_CLOSE | <code>string</code> | <code>"checkoutPopupClose"</code> | Event sent when SRC Checkout flow is closed, regardless of embedded or windowed mode. |
|
|
6934
|
+
| CHECKOUT_COMPLETED | <code>string</code> | <code>"checkoutCompleted"</code> | Event sent on successful checkout by customer. Check [data](#EventDataCheckoutCompletedData) for more information. |
|
|
6935
|
+
| CHECKOUT_ERROR | <code>string</code> | <code>"checkoutError"</code> | Event sent on error checkout by customer. Check [data](#EventData) for more information. |
|
|
6936
|
+
|
|
6937
|
+
<a name="EVENT_DATA_TYPE" id="EVENT_DATA_TYPE" href="#EVENT_DATA_TYPE"> </a>
|
|
6938
|
+
|
|
6939
|
+
## EVENT\_DATA\_TYPE : <code>enum</code>
|
|
6940
|
+
List of available event data types
|
|
6941
|
+
|
|
6942
|
+
**Kind**: global enum
|
|
6943
|
+
|
|
6944
|
+
| Param | Type | Default | Description |
|
|
6945
|
+
| --- | --- | --- | --- |
|
|
6946
|
+
| CRITICAL_ERROR | <code>string</code> | <code>"CriticalError"</code> | in this error scenario the checkout is understood to be in a non-recoverable state and should be closed by the merchant and give alternate payment options to the user |
|
|
6947
|
+
| USER_ERROR | <code>string</code> | <code>"UserError"</code> | in this error scenario the error in likely a user input error and the checkout is in a recoverable state, so the user will be kept within the checkout and can retry the flow |
|
|
6948
|
+
| SUCCESS | <code>string</code> | <code>"Success"</code> | |
|
|
6626
6949
|
|
|
6627
6950
|
|
|
6628
6951
|
## License
|
|
6629
|
-
Copyright (c)
|
|
6952
|
+
Copyright (c) 2024 paydock
|