@paydock/client-sdk 1.104.3-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 +729 -405
- 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/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/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 +123 -120
- 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
|
@@ -286,6 +286,12 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
286
286
|
<dt><a href="#user-content-w_STYLABLE_ELEMENT_STATE">STYLABLE_ELEMENT_STATE</a> : <code>object</code></dt>
|
|
287
287
|
<dd><p>Current constant include available states of element for styling</p>
|
|
288
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>
|
|
289
295
|
<dt><a href="#user-content-w_TRIGGER">TRIGGER</a> : <code>object</code></dt>
|
|
290
296
|
<dd><p>List of available triggers</p>
|
|
291
297
|
</dd>
|
|
@@ -298,7 +304,8 @@ This example shows how you can use a lot of other methods to settings your form
|
|
|
298
304
|
<dd><p>Interface of data from validation event.</p>
|
|
299
305
|
</dd>
|
|
300
306
|
<dt><a href="#user-content-w_IEventMetaData">IEventMetaData</a></dt>
|
|
301
|
-
<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>
|
|
302
309
|
</dd>
|
|
303
310
|
<dt><a href="#user-content-w_IEventAfterLoadData">IEventAfterLoadData</a></dt>
|
|
304
311
|
<dd><p>Interface of data from event.</p>
|
|
@@ -347,33 +354,34 @@ Interface of data from validation event.
|
|
|
347
354
|
|
|
348
355
|
| Param | Type | Description |
|
|
349
356
|
| --- | --- | --- |
|
|
350
|
-
| event | <code>string</code> |
|
|
351
|
-
|
|
|
352
|
-
|
|
|
353
|
-
| [ref_id] | <code>string</code> | Custom value
|
|
354
|
-
| [form_valid] | <code>boolean</code> |
|
|
355
|
-
| [invalid_fields] | <code>
|
|
356
|
-
| [invalid_showed_fields] | <code>
|
|
357
|
-
| [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), |
|
|
358
365
|
|
|
359
366
|
<a name="w_IEventMetaData" id="w_IEventMetaData" href="#user-content-w_IEventMetaData"> </a>
|
|
360
367
|
|
|
361
368
|
## IEventMetaData
|
|
362
|
-
|
|
369
|
+
Contains basic information associated with the event and additional meta data
|
|
370
|
+
specific to the event. E.g., card info, gateway info, etc.
|
|
363
371
|
|
|
364
372
|
**Kind**: global interface
|
|
365
373
|
|
|
366
374
|
| Param | Type | Description |
|
|
367
375
|
| --- | --- | --- |
|
|
368
|
-
| event | <code>string</code> |
|
|
369
|
-
| purpose | <code>string</code> |
|
|
370
|
-
| message_source | <code>string</code> |
|
|
371
|
-
| [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. |
|
|
372
380
|
| configuration_token | <code>string</code> | Token received from our API with widget data |
|
|
373
381
|
| type | <code>string</code> | Payment type 'card', 'bank_account' |
|
|
374
382
|
| gateway_type | <code>string</code> | Gateway type |
|
|
375
383
|
| [card_number_last4] | <code>string</code> | Last 4 digit of your card |
|
|
376
|
-
| [card_scheme] | <code>string</code> | Card scheme |
|
|
384
|
+
| [card_scheme] | <code>string</code> | Card scheme, e.g., (Visa, Mastercard and American Express (AmEx)) |
|
|
377
385
|
| [card_number_length] | <code>number</code> | Card number length |
|
|
378
386
|
| [account_name] | <code>string</code> | Bank account account name |
|
|
379
387
|
| [account_number] | <code>string</code> | Bank account account number |
|
|
@@ -387,10 +395,10 @@ Interface of data from event.
|
|
|
387
395
|
|
|
388
396
|
| Param | Type | Description |
|
|
389
397
|
| --- | --- | --- |
|
|
390
|
-
| event | <code>string</code> |
|
|
391
|
-
| purpose | <code>string</code> |
|
|
392
|
-
| message_source | <code>string</code> |
|
|
393
|
-
| [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. |
|
|
394
402
|
|
|
395
403
|
<a name="w_IEventFinishData" id="w_IEventFinishData" href="#user-content-w_IEventFinishData"> </a>
|
|
396
404
|
|
|
@@ -401,10 +409,10 @@ Interface of data from event.
|
|
|
401
409
|
|
|
402
410
|
| Param | Type | Description |
|
|
403
411
|
| --- | --- | --- |
|
|
404
|
-
| event | <code>string</code> |
|
|
405
|
-
| purpose | <code>string</code> |
|
|
406
|
-
| message_source | <code>string</code> |
|
|
407
|
-
| [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. |
|
|
408
416
|
| payment_source | <code>string</code> | One time token. Result from this endpoint [API docs](https://docs.paydock.com/#tokens) |
|
|
409
417
|
|
|
410
418
|
<a name="w_IPayPalMeta" id="w_IPayPalMeta" href="#user-content-w_IPayPalMeta"> </a>
|
|
@@ -618,7 +626,7 @@ Class Widget include method for working on html and include extended by HtmlMult
|
|
|
618
626
|
* [.setFormElements(elements)](#user-content-w_HtmlWidget+setFormElements)
|
|
619
627
|
* [.setMeta(object)](#user-content-w_HtmlWidget+setMeta)
|
|
620
628
|
* [.load()](#user-content-w_HtmlMultiWidget+load)
|
|
621
|
-
* [.
|
|
629
|
+
* [.afterLoad()](#user-content-w_HtmlMultiWidget+afterLoad)
|
|
622
630
|
* [.trigger(triggers, data)](#user-content-w_HtmlMultiWidget+trigger)
|
|
623
631
|
* [.getValidationState()](#user-content-w_HtmlMultiWidget+getValidationState) ⇒ [<code>IFormValidation</code>](#user-content-w_IFormValidation)
|
|
624
632
|
* [.isValidForm()](#user-content-w_HtmlMultiWidget+isValidForm) ⇒ <code>boolean</code>
|
|
@@ -631,6 +639,7 @@ Class Widget include method for working on html and include extended by HtmlMult
|
|
|
631
639
|
* [.hideElements(elements)](#user-content-w_HtmlMultiWidget+hideElements)
|
|
632
640
|
* [.showElements(elements)](#user-content-w_HtmlMultiWidget+showElements)
|
|
633
641
|
* [.updateFormValues(fieldValues)](#user-content-w_HtmlMultiWidget+updateFormValues)
|
|
642
|
+
* [.updateFormValue(key, value)](#user-content-w_HtmlMultiWidget+updateFormValue)
|
|
634
643
|
* [.onFinishInsert(selector, dataType)](#user-content-w_HtmlMultiWidget+onFinishInsert)
|
|
635
644
|
* [.interceptSubmitForm(selector)](#user-content-w_HtmlMultiWidget+interceptSubmitForm)
|
|
636
645
|
* [.useCheckoutAutoSubmit()](#user-content-w_HtmlMultiWidget+useCheckoutAutoSubmit)
|
|
@@ -795,51 +804,38 @@ config.setMeta({
|
|
|
795
804
|
<a name="w_HtmlMultiWidget+load" id="w_HtmlMultiWidget+load" href="#user-content-w_HtmlMultiWidget+load"> </a>
|
|
796
805
|
|
|
797
806
|
### htmlWidget.load()
|
|
798
|
-
|
|
807
|
+
Loads the widget.
|
|
808
|
+
|
|
809
|
+
Calling this method results in an iframe element being inserted and rendered in the DOM.
|
|
799
810
|
|
|
800
811
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
801
812
|
**Overrides**: [<code>load</code>](#user-content-w_HtmlMultiWidget+load)
|
|
802
|
-
<a name="w_HtmlMultiWidget+
|
|
813
|
+
<a name="w_HtmlMultiWidget+afterLoad" id="w_HtmlMultiWidget+afterLoad" href="#user-content-w_HtmlMultiWidget+afterLoad"> </a>
|
|
803
814
|
|
|
804
|
-
### htmlWidget.
|
|
805
|
-
|
|
815
|
+
### htmlWidget.afterLoad()
|
|
816
|
+
Registers a form validation callback for validation events.
|
|
806
817
|
|
|
807
818
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
808
|
-
**Overrides**: [<code>
|
|
809
|
-
|
|
810
|
-
| Param | Type | Description |
|
|
811
|
-
| --- | --- | --- |
|
|
812
|
-
| eventName | <code>string</code> | Available event names [EVENT](#user-content-w_EVENT) |
|
|
813
|
-
| [cb] | <code>listener</code> | |
|
|
814
|
-
|
|
815
|
-
**Example**
|
|
816
|
-
|
|
817
|
-
```javascript
|
|
818
|
-
widget.on('form_submit', function (data) {
|
|
819
|
-
console.log(data);
|
|
820
|
-
});
|
|
821
|
-
// or
|
|
822
|
-
widget.on('form_submit').then(function (data) {
|
|
823
|
-
console.log(data);
|
|
824
|
-
});
|
|
825
|
-
```
|
|
819
|
+
**Overrides**: [<code>afterLoad</code>](#user-content-w_HtmlMultiWidget+afterLoad)
|
|
826
820
|
<a name="w_HtmlMultiWidget+trigger" id="w_HtmlMultiWidget+trigger" href="#user-content-w_HtmlMultiWidget+trigger"> </a>
|
|
827
821
|
|
|
828
822
|
### htmlWidget.trigger(triggers, data)
|
|
829
|
-
|
|
823
|
+
Registers callback that will be invoked for every trigger.
|
|
830
824
|
|
|
831
825
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
832
826
|
**Overrides**: [<code>trigger</code>](#user-content-w_HtmlMultiWidget+trigger)
|
|
833
827
|
|
|
834
828
|
| Param | Type | Description |
|
|
835
829
|
| --- | --- | --- |
|
|
836
|
-
| triggers | <code>
|
|
837
|
-
| 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. |
|
|
838
832
|
|
|
839
833
|
<a name="w_HtmlMultiWidget+getValidationState" id="w_HtmlMultiWidget+getValidationState" href="#user-content-w_HtmlMultiWidget+getValidationState"> </a>
|
|
840
834
|
|
|
841
835
|
### htmlWidget.getValidationState() ⇒ [<code>IFormValidation</code>](#user-content-w_IFormValidation)
|
|
842
|
-
|
|
836
|
+
Gets a reference to the form current validation state.
|
|
837
|
+
|
|
838
|
+
!Warning: do not directly modify the values of the returned object.
|
|
843
839
|
|
|
844
840
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
845
841
|
**Overrides**: [<code>getValidationState</code>](#user-content-w_HtmlMultiWidget+getValidationState)
|
|
@@ -847,11 +843,13 @@ Using this method you can get validation state information
|
|
|
847
843
|
<a name="w_HtmlMultiWidget+isValidForm" id="w_HtmlMultiWidget+isValidForm" href="#user-content-w_HtmlMultiWidget+isValidForm"> </a>
|
|
848
844
|
|
|
849
845
|
### htmlWidget.isValidForm() ⇒ <code>boolean</code>
|
|
850
|
-
|
|
846
|
+
Checks if a given form is valid.
|
|
847
|
+
|
|
848
|
+
A form is valid if all form fields are valid.
|
|
851
849
|
|
|
852
850
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
853
851
|
**Overrides**: [<code>isValidForm</code>](#user-content-w_HtmlMultiWidget+isValidForm)
|
|
854
|
-
**Returns**: <code>boolean</code> -
|
|
852
|
+
**Returns**: <code>boolean</code> - Indicates wether or not form is valid.
|
|
855
853
|
<a name="w_HtmlMultiWidget+isInvalidField" id="w_HtmlMultiWidget+isInvalidField" href="#user-content-w_HtmlMultiWidget+isInvalidField"> </a>
|
|
856
854
|
|
|
857
855
|
### htmlWidget.isInvalidField(field) ⇒ <code>boolean</code>
|
|
@@ -868,92 +866,96 @@ Using this method you can check if a specific form field is invalid
|
|
|
868
866
|
<a name="w_HtmlMultiWidget+isFieldErrorShowed" id="w_HtmlMultiWidget+isFieldErrorShowed" href="#user-content-w_HtmlMultiWidget+isFieldErrorShowed"> </a>
|
|
869
867
|
|
|
870
868
|
### htmlWidget.isFieldErrorShowed(field) ⇒ <code>boolean</code>
|
|
871
|
-
|
|
869
|
+
Checks if a given form field is displaying an error.
|
|
872
870
|
|
|
873
871
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
874
872
|
**Overrides**: [<code>isFieldErrorShowed</code>](#user-content-w_HtmlMultiWidget+isFieldErrorShowed)
|
|
875
|
-
**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.
|
|
876
874
|
|
|
877
875
|
| Param | Type | Description |
|
|
878
876
|
| --- | --- | --- |
|
|
879
|
-
| field | <code>string</code> |
|
|
877
|
+
| field | <code>string</code> | The form field name |
|
|
880
878
|
|
|
881
879
|
<a name="w_HtmlMultiWidget+isInvalidFieldByValidator" id="w_HtmlMultiWidget+isInvalidFieldByValidator" href="#user-content-w_HtmlMultiWidget+isInvalidFieldByValidator"> </a>
|
|
882
880
|
|
|
883
881
|
### htmlWidget.isInvalidFieldByValidator(field, validator) ⇒ <code>boolean</code>
|
|
884
|
-
|
|
882
|
+
Checks if a given form field is valid or invalid by name.
|
|
885
883
|
|
|
886
884
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
887
885
|
**Overrides**: [<code>isInvalidFieldByValidator</code>](#user-content-w_HtmlMultiWidget+isInvalidFieldByValidator)
|
|
888
|
-
**Returns**: <code>boolean</code> -
|
|
886
|
+
**Returns**: <code>boolean</code> - Indicates wether or not the field is invalid based on validator intepretation.
|
|
889
887
|
|
|
890
888
|
| Param | Type | Description |
|
|
891
889
|
| --- | --- | --- |
|
|
892
|
-
| field | <code>string</code> |
|
|
893
|
-
| validator |
|
|
890
|
+
| field | <code>string</code> | The form field name |
|
|
891
|
+
| validator | | The name of the validator. |
|
|
894
892
|
|
|
895
893
|
<a name="w_HtmlMultiWidget+hide" id="w_HtmlMultiWidget+hide" href="#user-content-w_HtmlMultiWidget+hide"> </a>
|
|
896
894
|
|
|
897
895
|
### htmlWidget.hide([saveSize])
|
|
898
|
-
|
|
896
|
+
Hides the widget.
|
|
897
|
+
|
|
898
|
+
E.g., use this method to hide the widget after it loads.
|
|
899
899
|
|
|
900
900
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
901
901
|
**Overrides**: [<code>hide</code>](#user-content-w_HtmlMultiWidget+hide)
|
|
902
902
|
|
|
903
903
|
| Param | Type | Default | Description |
|
|
904
904
|
| --- | --- | --- | --- |
|
|
905
|
-
| [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. |
|
|
906
906
|
|
|
907
907
|
<a name="w_HtmlMultiWidget+show" id="w_HtmlMultiWidget+show" href="#user-content-w_HtmlMultiWidget+show"> </a>
|
|
908
908
|
|
|
909
909
|
### htmlWidget.show()
|
|
910
|
-
|
|
910
|
+
Shows the widget.
|
|
911
|
+
|
|
912
|
+
E.g., use this method to show the widget after it was explicitly hidden.
|
|
911
913
|
|
|
912
914
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
913
915
|
**Overrides**: [<code>show</code>](#user-content-w_HtmlMultiWidget+show)
|
|
914
916
|
<a name="w_HtmlMultiWidget+reload" id="w_HtmlMultiWidget+reload" href="#user-content-w_HtmlMultiWidget+reload"> </a>
|
|
915
917
|
|
|
916
918
|
### htmlWidget.reload()
|
|
917
|
-
|
|
919
|
+
Reloads the widget.
|
|
918
920
|
|
|
919
921
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
920
922
|
**Overrides**: [<code>reload</code>](#user-content-w_HtmlMultiWidget+reload)
|
|
921
923
|
<a name="w_HtmlMultiWidget+hideElements" id="w_HtmlMultiWidget+hideElements" href="#user-content-w_HtmlMultiWidget+hideElements"> </a>
|
|
922
924
|
|
|
923
925
|
### htmlWidget.hideElements(elements)
|
|
924
|
-
|
|
926
|
+
Hides the specified Widget elements by their identifier.
|
|
925
927
|
|
|
926
928
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
927
929
|
**Overrides**: [<code>hideElements</code>](#user-content-w_HtmlMultiWidget+hideElements)
|
|
928
930
|
|
|
929
931
|
| Param | Type | Description |
|
|
930
932
|
| --- | --- | --- |
|
|
931
|
-
| 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) |
|
|
932
934
|
|
|
933
935
|
**Example**
|
|
934
|
-
|
|
935
936
|
```javascript
|
|
936
937
|
widget.hideElements(['submit_button', 'email']);
|
|
937
938
|
```
|
|
938
939
|
<a name="w_HtmlMultiWidget+showElements" id="w_HtmlMultiWidget+showElements" href="#user-content-w_HtmlMultiWidget+showElements"> </a>
|
|
939
940
|
|
|
940
941
|
### htmlWidget.showElements(elements)
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
* @example
|
|
944
|
-
widget.showElements(['submit_button', 'email']);
|
|
942
|
+
Shows the specified Widget elements by their identifier.
|
|
945
943
|
|
|
946
944
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
947
945
|
**Overrides**: [<code>showElements</code>](#user-content-w_HtmlMultiWidget+showElements)
|
|
948
946
|
|
|
949
947
|
| Param | Type | Description |
|
|
950
948
|
| --- | --- | --- |
|
|
951
|
-
| 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) |
|
|
952
950
|
|
|
951
|
+
**Example**
|
|
952
|
+
```javascript
|
|
953
|
+
widget.showElements(['submit_button', 'email']);
|
|
954
|
+
```
|
|
953
955
|
<a name="w_HtmlMultiWidget+updateFormValues" id="w_HtmlMultiWidget+updateFormValues" href="#user-content-w_HtmlMultiWidget+updateFormValues"> </a>
|
|
954
956
|
|
|
955
957
|
### htmlWidget.updateFormValues(fieldValues)
|
|
956
|
-
|
|
958
|
+
Updates the form field values inside the widget.
|
|
957
959
|
|
|
958
960
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
959
961
|
**Overrides**: [<code>updateFormValues</code>](#user-content-w_HtmlMultiWidget+updateFormValues)
|
|
@@ -963,53 +965,71 @@ Method for update values for form fields inside the widget
|
|
|
963
965
|
| fieldValues | <code>IFormValues</code> | Fields with values |
|
|
964
966
|
|
|
965
967
|
**Example**
|
|
966
|
-
|
|
967
968
|
```javascript
|
|
968
969
|
widget.updateFormValues({
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
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");
|
|
972
990
|
```
|
|
973
991
|
<a name="w_HtmlMultiWidget+onFinishInsert" id="w_HtmlMultiWidget+onFinishInsert" href="#user-content-w_HtmlMultiWidget+onFinishInsert"> </a>
|
|
974
992
|
|
|
975
993
|
### htmlWidget.onFinishInsert(selector, dataType)
|
|
976
|
-
|
|
994
|
+
Inserts the event data (after finish event) onto the input field associated with the provided CSS selector.
|
|
977
995
|
|
|
978
996
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
979
997
|
**Overrides**: [<code>onFinishInsert</code>](#user-content-w_HtmlMultiWidget+onFinishInsert)
|
|
980
998
|
|
|
981
999
|
| Param | Type | Description |
|
|
982
1000
|
| --- | --- | --- |
|
|
983
|
-
| selector | <code>string</code> |
|
|
984
|
-
| 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. |
|
|
985
1003
|
|
|
986
1004
|
<a name="w_HtmlMultiWidget+interceptSubmitForm" id="w_HtmlMultiWidget+interceptSubmitForm" href="#user-content-w_HtmlMultiWidget+interceptSubmitForm"> </a>
|
|
987
1005
|
|
|
988
1006
|
### htmlWidget.interceptSubmitForm(selector)
|
|
989
|
-
|
|
1007
|
+
Intercepts a form submission and delegates processing to the widget.
|
|
990
1008
|
|
|
991
|
-
|
|
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
|
|
992
1013
|
|
|
993
1014
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
994
1015
|
**Overrides**: [<code>interceptSubmitForm</code>](#user-content-w_HtmlMultiWidget+interceptSubmitForm)
|
|
995
|
-
**Note**: submit button
|
|
1016
|
+
**Note**: The widget's submit button will be hidden.
|
|
996
1017
|
|
|
997
1018
|
| Param | Type | Description |
|
|
998
1019
|
| --- | --- | --- |
|
|
999
1020
|
| selector | <code>string</code> | css selector of your form |
|
|
1000
1021
|
|
|
1001
1022
|
**Example**
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
<form id="myForm">
|
|
1023
|
+
```html
|
|
1024
|
+
<body>
|
|
1025
|
+
<form id="myForm">
|
|
1005
1026
|
<input name="amount">
|
|
1006
1027
|
<button type="submit">Submit</button>
|
|
1007
1028
|
</form>
|
|
1008
|
-
|
|
1009
|
-
-->
|
|
1010
|
-
<script>
|
|
1029
|
+
<script>
|
|
1011
1030
|
widget.interceptSubmitForm('#myForm');
|
|
1012
|
-
</script>
|
|
1031
|
+
</script>
|
|
1032
|
+
</body>
|
|
1013
1033
|
```
|
|
1014
1034
|
<a name="w_HtmlMultiWidget+useCheckoutAutoSubmit" id="w_HtmlMultiWidget+useCheckoutAutoSubmit" href="#user-content-w_HtmlMultiWidget+useCheckoutAutoSubmit"> </a>
|
|
1015
1035
|
|
|
@@ -1026,7 +1046,6 @@ Use this method for resize iFrame according content height
|
|
|
1026
1046
|
**Kind**: instance method of [<code>HtmlWidget</code>](#user-content-w_HtmlWidget)
|
|
1027
1047
|
**Overrides**: [<code>useAutoResize</code>](#user-content-w_HtmlMultiWidget+useAutoResize)
|
|
1028
1048
|
**Example**
|
|
1029
|
-
|
|
1030
1049
|
```javascript
|
|
1031
1050
|
widget.useAutoResize();
|
|
1032
1051
|
```
|
|
@@ -1331,7 +1350,7 @@ Class HtmlMultiWidget include method for working with html
|
|
|
1331
1350
|
* [HtmlMultiWidget](#user-content-w_HtmlMultiWidget) ⇐ [<code>MultiWidget</code>](#user-content-w_MultiWidget)
|
|
1332
1351
|
* [new HtmlMultiWidget(selector, publicKey, conf)](#user-content-w_new_HtmlMultiWidget_new)
|
|
1333
1352
|
* [.load()](#user-content-w_HtmlMultiWidget+load)
|
|
1334
|
-
* [.
|
|
1353
|
+
* [.afterLoad()](#user-content-w_HtmlMultiWidget+afterLoad)
|
|
1335
1354
|
* [.trigger(triggers, data)](#user-content-w_HtmlMultiWidget+trigger)
|
|
1336
1355
|
* [.getValidationState()](#user-content-w_HtmlMultiWidget+getValidationState) ⇒ [<code>IFormValidation</code>](#user-content-w_IFormValidation)
|
|
1337
1356
|
* [.isValidForm()](#user-content-w_HtmlMultiWidget+isValidForm) ⇒ <code>boolean</code>
|
|
@@ -1344,6 +1363,7 @@ Class HtmlMultiWidget include method for working with html
|
|
|
1344
1363
|
* [.hideElements(elements)](#user-content-w_HtmlMultiWidget+hideElements)
|
|
1345
1364
|
* [.showElements(elements)](#user-content-w_HtmlMultiWidget+showElements)
|
|
1346
1365
|
* [.updateFormValues(fieldValues)](#user-content-w_HtmlMultiWidget+updateFormValues)
|
|
1366
|
+
* [.updateFormValue(key, value)](#user-content-w_HtmlMultiWidget+updateFormValue)
|
|
1347
1367
|
* [.onFinishInsert(selector, dataType)](#user-content-w_HtmlMultiWidget+onFinishInsert)
|
|
1348
1368
|
* [.interceptSubmitForm(selector)](#user-content-w_HtmlMultiWidget+interceptSubmitForm)
|
|
1349
1369
|
* [.useCheckoutAutoSubmit()](#user-content-w_HtmlMultiWidget+useCheckoutAutoSubmit)
|
|
@@ -1394,58 +1414,47 @@ var widget = new MultiWidget('#widget', 'publicKey',[ With Configurations
|
|
|
1394
1414
|
<a name="w_HtmlMultiWidget+load" id="w_HtmlMultiWidget+load" href="#user-content-w_HtmlMultiWidget+load"> </a>
|
|
1395
1415
|
|
|
1396
1416
|
### htmlMultiWidget.load()
|
|
1397
|
-
|
|
1417
|
+
Loads the widget.
|
|
1398
1418
|
|
|
1399
|
-
|
|
1400
|
-
<a name="w_HtmlMultiWidget+on" id="w_HtmlMultiWidget+on" href="#user-content-w_HtmlMultiWidget+on"> </a>
|
|
1401
|
-
|
|
1402
|
-
### htmlMultiWidget.on(eventName, [cb]) ⇒ <code>Promise.<(IEventData\|IEventMetaData\|IEventFinishData\|IFormValidation)></code> \| <code>void</code>
|
|
1403
|
-
Listen to events of widget
|
|
1419
|
+
Calling this method results in an iframe element being inserted and rendered in the DOM.
|
|
1404
1420
|
|
|
1405
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>
|
|
1406
1423
|
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
| eventName | <code>string</code> | Available event names [EVENT](#user-content-w_EVENT) |
|
|
1410
|
-
| [cb] | <code>listener</code> | |
|
|
1411
|
-
|
|
1412
|
-
**Example**
|
|
1424
|
+
### htmlMultiWidget.afterLoad()
|
|
1425
|
+
Registers a form validation callback for validation events.
|
|
1413
1426
|
|
|
1414
|
-
|
|
1415
|
-
widget.on('form_submit', function (data) {
|
|
1416
|
-
console.log(data);
|
|
1417
|
-
});
|
|
1418
|
-
// or
|
|
1419
|
-
widget.on('form_submit').then(function (data) {
|
|
1420
|
-
console.log(data);
|
|
1421
|
-
});
|
|
1422
|
-
```
|
|
1427
|
+
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1423
1428
|
<a name="w_HtmlMultiWidget+trigger" id="w_HtmlMultiWidget+trigger" href="#user-content-w_HtmlMultiWidget+trigger"> </a>
|
|
1424
1429
|
|
|
1425
1430
|
### htmlMultiWidget.trigger(triggers, data)
|
|
1426
|
-
|
|
1431
|
+
Registers callback that will be invoked for every trigger.
|
|
1427
1432
|
|
|
1428
1433
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1429
1434
|
|
|
1430
1435
|
| Param | Type | Description |
|
|
1431
1436
|
| --- | --- | --- |
|
|
1432
|
-
| triggers | <code>
|
|
1433
|
-
| 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. |
|
|
1434
1439
|
|
|
1435
1440
|
<a name="w_HtmlMultiWidget+getValidationState" id="w_HtmlMultiWidget+getValidationState" href="#user-content-w_HtmlMultiWidget+getValidationState"> </a>
|
|
1436
1441
|
|
|
1437
1442
|
### htmlMultiWidget.getValidationState() ⇒ [<code>IFormValidation</code>](#user-content-w_IFormValidation)
|
|
1438
|
-
|
|
1443
|
+
Gets a reference to the form current validation state.
|
|
1444
|
+
|
|
1445
|
+
!Warning: do not directly modify the values of the returned object.
|
|
1439
1446
|
|
|
1440
1447
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1441
1448
|
**Returns**: [<code>IFormValidation</code>](#user-content-w_IFormValidation) - Form validation object
|
|
1442
1449
|
<a name="w_HtmlMultiWidget+isValidForm" id="w_HtmlMultiWidget+isValidForm" href="#user-content-w_HtmlMultiWidget+isValidForm"> </a>
|
|
1443
1450
|
|
|
1444
1451
|
### htmlMultiWidget.isValidForm() ⇒ <code>boolean</code>
|
|
1445
|
-
|
|
1452
|
+
Checks if a given form is valid.
|
|
1453
|
+
|
|
1454
|
+
A form is valid if all form fields are valid.
|
|
1446
1455
|
|
|
1447
1456
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1448
|
-
**Returns**: <code>boolean</code> -
|
|
1457
|
+
**Returns**: <code>boolean</code> - Indicates wether or not form is valid.
|
|
1449
1458
|
<a name="w_HtmlMultiWidget+isInvalidField" id="w_HtmlMultiWidget+isInvalidField" href="#user-content-w_HtmlMultiWidget+isInvalidField"> </a>
|
|
1450
1459
|
|
|
1451
1460
|
### htmlMultiWidget.isInvalidField(field) ⇒ <code>boolean</code>
|
|
@@ -1461,85 +1470,89 @@ Using this method you can check if a specific form field is invalid
|
|
|
1461
1470
|
<a name="w_HtmlMultiWidget+isFieldErrorShowed" id="w_HtmlMultiWidget+isFieldErrorShowed" href="#user-content-w_HtmlMultiWidget+isFieldErrorShowed"> </a>
|
|
1462
1471
|
|
|
1463
1472
|
### htmlMultiWidget.isFieldErrorShowed(field) ⇒ <code>boolean</code>
|
|
1464
|
-
|
|
1473
|
+
Checks if a given form field is displaying an error.
|
|
1465
1474
|
|
|
1466
1475
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1467
|
-
**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.
|
|
1468
1477
|
|
|
1469
1478
|
| Param | Type | Description |
|
|
1470
1479
|
| --- | --- | --- |
|
|
1471
|
-
| field | <code>string</code> |
|
|
1480
|
+
| field | <code>string</code> | The form field name |
|
|
1472
1481
|
|
|
1473
1482
|
<a name="w_HtmlMultiWidget+isInvalidFieldByValidator" id="w_HtmlMultiWidget+isInvalidFieldByValidator" href="#user-content-w_HtmlMultiWidget+isInvalidFieldByValidator"> </a>
|
|
1474
1483
|
|
|
1475
1484
|
### htmlMultiWidget.isInvalidFieldByValidator(field, validator) ⇒ <code>boolean</code>
|
|
1476
|
-
|
|
1485
|
+
Checks if a given form field is valid or invalid by name.
|
|
1477
1486
|
|
|
1478
1487
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1479
|
-
**Returns**: <code>boolean</code> -
|
|
1488
|
+
**Returns**: <code>boolean</code> - Indicates wether or not the field is invalid based on validator intepretation.
|
|
1480
1489
|
|
|
1481
1490
|
| Param | Type | Description |
|
|
1482
1491
|
| --- | --- | --- |
|
|
1483
|
-
| field | <code>string</code> |
|
|
1484
|
-
| validator |
|
|
1492
|
+
| field | <code>string</code> | The form field name |
|
|
1493
|
+
| validator | | The name of the validator. |
|
|
1485
1494
|
|
|
1486
1495
|
<a name="w_HtmlMultiWidget+hide" id="w_HtmlMultiWidget+hide" href="#user-content-w_HtmlMultiWidget+hide"> </a>
|
|
1487
1496
|
|
|
1488
1497
|
### htmlMultiWidget.hide([saveSize])
|
|
1489
|
-
|
|
1498
|
+
Hides the widget.
|
|
1499
|
+
|
|
1500
|
+
E.g., use this method to hide the widget after it loads.
|
|
1490
1501
|
|
|
1491
1502
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1492
1503
|
|
|
1493
1504
|
| Param | Type | Default | Description |
|
|
1494
1505
|
| --- | --- | --- | --- |
|
|
1495
|
-
| [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. |
|
|
1496
1507
|
|
|
1497
1508
|
<a name="w_HtmlMultiWidget+show" id="w_HtmlMultiWidget+show" href="#user-content-w_HtmlMultiWidget+show"> </a>
|
|
1498
1509
|
|
|
1499
1510
|
### htmlMultiWidget.show()
|
|
1500
|
-
|
|
1511
|
+
Shows the widget.
|
|
1512
|
+
|
|
1513
|
+
E.g., use this method to show the widget after it was explicitly hidden.
|
|
1501
1514
|
|
|
1502
1515
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1503
1516
|
<a name="w_HtmlMultiWidget+reload" id="w_HtmlMultiWidget+reload" href="#user-content-w_HtmlMultiWidget+reload"> </a>
|
|
1504
1517
|
|
|
1505
1518
|
### htmlMultiWidget.reload()
|
|
1506
|
-
|
|
1519
|
+
Reloads the widget.
|
|
1507
1520
|
|
|
1508
1521
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1509
1522
|
<a name="w_HtmlMultiWidget+hideElements" id="w_HtmlMultiWidget+hideElements" href="#user-content-w_HtmlMultiWidget+hideElements"> </a>
|
|
1510
1523
|
|
|
1511
1524
|
### htmlMultiWidget.hideElements(elements)
|
|
1512
|
-
|
|
1525
|
+
Hides the specified Widget elements by their identifier.
|
|
1513
1526
|
|
|
1514
1527
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1515
1528
|
|
|
1516
1529
|
| Param | Type | Description |
|
|
1517
1530
|
| --- | --- | --- |
|
|
1518
|
-
| 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) |
|
|
1519
1532
|
|
|
1520
1533
|
**Example**
|
|
1521
|
-
|
|
1522
1534
|
```javascript
|
|
1523
1535
|
widget.hideElements(['submit_button', 'email']);
|
|
1524
1536
|
```
|
|
1525
1537
|
<a name="w_HtmlMultiWidget+showElements" id="w_HtmlMultiWidget+showElements" href="#user-content-w_HtmlMultiWidget+showElements"> </a>
|
|
1526
1538
|
|
|
1527
1539
|
### htmlMultiWidget.showElements(elements)
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
* @example
|
|
1531
|
-
widget.showElements(['submit_button', 'email']);
|
|
1540
|
+
Shows the specified Widget elements by their identifier.
|
|
1532
1541
|
|
|
1533
1542
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1534
1543
|
|
|
1535
1544
|
| Param | Type | Description |
|
|
1536
1545
|
| --- | --- | --- |
|
|
1537
|
-
| 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) |
|
|
1538
1547
|
|
|
1548
|
+
**Example**
|
|
1549
|
+
```javascript
|
|
1550
|
+
widget.showElements(['submit_button', 'email']);
|
|
1551
|
+
```
|
|
1539
1552
|
<a name="w_HtmlMultiWidget+updateFormValues" id="w_HtmlMultiWidget+updateFormValues" href="#user-content-w_HtmlMultiWidget+updateFormValues"> </a>
|
|
1540
1553
|
|
|
1541
1554
|
### htmlMultiWidget.updateFormValues(fieldValues)
|
|
1542
|
-
|
|
1555
|
+
Updates the form field values inside the widget.
|
|
1543
1556
|
|
|
1544
1557
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1545
1558
|
|
|
@@ -1548,51 +1561,68 @@ Method for update values for form fields inside the widget
|
|
|
1548
1561
|
| fieldValues | <code>IFormValues</code> | Fields with values |
|
|
1549
1562
|
|
|
1550
1563
|
**Example**
|
|
1551
|
-
|
|
1552
1564
|
```javascript
|
|
1553
1565
|
widget.updateFormValues({
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
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");
|
|
1557
1585
|
```
|
|
1558
1586
|
<a name="w_HtmlMultiWidget+onFinishInsert" id="w_HtmlMultiWidget+onFinishInsert" href="#user-content-w_HtmlMultiWidget+onFinishInsert"> </a>
|
|
1559
1587
|
|
|
1560
1588
|
### htmlMultiWidget.onFinishInsert(selector, dataType)
|
|
1561
|
-
|
|
1589
|
+
Inserts the event data (after finish event) onto the input field associated with the provided CSS selector.
|
|
1562
1590
|
|
|
1563
1591
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1564
1592
|
|
|
1565
1593
|
| Param | Type | Description |
|
|
1566
1594
|
| --- | --- | --- |
|
|
1567
|
-
| selector | <code>string</code> |
|
|
1568
|
-
| 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. |
|
|
1569
1597
|
|
|
1570
1598
|
<a name="w_HtmlMultiWidget+interceptSubmitForm" id="w_HtmlMultiWidget+interceptSubmitForm" href="#user-content-w_HtmlMultiWidget+interceptSubmitForm"> </a>
|
|
1571
1599
|
|
|
1572
1600
|
### htmlMultiWidget.interceptSubmitForm(selector)
|
|
1573
|
-
|
|
1601
|
+
Intercepts a form submission and delegates processing to the widget.
|
|
1574
1602
|
|
|
1575
|
-
|
|
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
|
|
1576
1607
|
|
|
1577
1608
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1578
|
-
**Note**: submit button
|
|
1609
|
+
**Note**: The widget's submit button will be hidden.
|
|
1579
1610
|
|
|
1580
1611
|
| Param | Type | Description |
|
|
1581
1612
|
| --- | --- | --- |
|
|
1582
1613
|
| selector | <code>string</code> | css selector of your form |
|
|
1583
1614
|
|
|
1584
1615
|
**Example**
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
<form id="myForm">
|
|
1616
|
+
```html
|
|
1617
|
+
<body>
|
|
1618
|
+
<form id="myForm">
|
|
1588
1619
|
<input name="amount">
|
|
1589
1620
|
<button type="submit">Submit</button>
|
|
1590
1621
|
</form>
|
|
1591
|
-
|
|
1592
|
-
-->
|
|
1593
|
-
<script>
|
|
1622
|
+
<script>
|
|
1594
1623
|
widget.interceptSubmitForm('#myForm');
|
|
1595
|
-
</script>
|
|
1624
|
+
</script>
|
|
1625
|
+
</body>
|
|
1596
1626
|
```
|
|
1597
1627
|
<a name="w_HtmlMultiWidget+useCheckoutAutoSubmit" id="w_HtmlMultiWidget+useCheckoutAutoSubmit" href="#user-content-w_HtmlMultiWidget+useCheckoutAutoSubmit"> </a>
|
|
1598
1628
|
|
|
@@ -1607,7 +1637,6 @@ Use this method for resize iFrame according content height
|
|
|
1607
1637
|
|
|
1608
1638
|
**Kind**: instance method of [<code>HtmlMultiWidget</code>](#user-content-w_HtmlMultiWidget)
|
|
1609
1639
|
**Example**
|
|
1610
|
-
|
|
1611
1640
|
```javascript
|
|
1612
1641
|
widget.useAutoResize();
|
|
1613
1642
|
```
|
|
@@ -2660,6 +2689,32 @@ Current constant include available states of element for styling
|
|
|
2660
2689
|
| FOCUS | <code>string</code> | <code>"focus"</code> | focus. This state applies to: input |
|
|
2661
2690
|
| HOVER | <code>string</code> | <code>"hover"</code> | focus. This state applies to: submit_button |
|
|
2662
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
|
+
|
|
2663
2718
|
<a name="w_TRIGGER" id="w_TRIGGER" href="#user-content-w_TRIGGER"> </a>
|
|
2664
2719
|
|
|
2665
2720
|
## TRIGGER : <code>object</code>
|
|
@@ -2916,10 +2971,10 @@ Interface of data from event.
|
|
|
2916
2971
|
|
|
2917
2972
|
| Param | Type | Description |
|
|
2918
2973
|
| --- | --- | --- |
|
|
2919
|
-
| event | <code>string</code> |
|
|
2920
|
-
| purpose | <code>string</code> |
|
|
2921
|
-
| message_source | <code>string</code> |
|
|
2922
|
-
| [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. |
|
|
2923
2978
|
| total_item | <code>number</code> | Pagination param. Total item count |
|
|
2924
2979
|
| skip | <code>number</code> | Pagination param. Skip items from first item |
|
|
2925
2980
|
| limit | <code>number</code> | Pagination param. Query limit |
|
|
@@ -2933,10 +2988,10 @@ Interface of data from event.
|
|
|
2933
2988
|
|
|
2934
2989
|
| Param | Type | Description |
|
|
2935
2990
|
| --- | --- | --- |
|
|
2936
|
-
| event | <code>string</code> |
|
|
2937
|
-
| purpose | <code>string</code> |
|
|
2938
|
-
| message_source | <code>string</code> |
|
|
2939
|
-
| [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. |
|
|
2940
2995
|
|
|
2941
2996
|
<a name="psw_IEventSizeData" id="psw_IEventSizeData" href="#user-content-psw_IEventSizeData"> </a>
|
|
2942
2997
|
|
|
@@ -2947,10 +3002,10 @@ Interface of data from event.
|
|
|
2947
3002
|
|
|
2948
3003
|
| Param | Type | Description |
|
|
2949
3004
|
| --- | --- | --- |
|
|
2950
|
-
| event | <code>number</code> |
|
|
2951
|
-
| purpose | <code>number</code> |
|
|
2952
|
-
| message_source | <code>string</code> |
|
|
2953
|
-
| [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. |
|
|
2954
3009
|
| height | <code>number</code> | Height of iFrame |
|
|
2955
3010
|
| width | <code>number</code> | Width of iFrame |
|
|
2956
3011
|
|
|
@@ -5245,6 +5300,14 @@ In some situations you may want to forcibly close the checkout so that your user
|
|
|
5245
5300
|
button.close();
|
|
5246
5301
|
```
|
|
5247
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
|
+
|
|
5248
5311
|
### Performing actions when shipping info is updated
|
|
5249
5312
|
|
|
5250
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).
|
|
@@ -5372,30 +5435,51 @@ _(Required `meta` fields: - . Optional `meta` fields: `request_shipping`, `pay_l
|
|
|
5372
5435
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
5373
5436
|
<script>
|
|
5374
5437
|
let button = new paydock.WalletButtons(
|
|
5375
|
-
|
|
5376
|
-
|
|
5377
|
-
|
|
5378
|
-
|
|
5379
|
-
|
|
5380
|
-
|
|
5381
|
-
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
|
|
5388
|
-
|
|
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
|
+
);
|
|
5389
5452
|
button.setEnv('sandbox');
|
|
5390
5453
|
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
5391
5454
|
button.onUpdate((data) => {
|
|
5392
|
-
|
|
5393
|
-
|
|
5394
|
-
|
|
5395
|
-
|
|
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
|
+
});
|
|
5396
5459
|
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
5397
5460
|
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
5398
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
|
+
|
|
5399
5483
|
button.load();
|
|
5400
5484
|
</script>
|
|
5401
5485
|
</html>
|
|
@@ -5529,6 +5613,7 @@ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `ra
|
|
|
5529
5613
|
button.onUnavailable(() => console.log("No wallet buttons available"));
|
|
5530
5614
|
button.onPaymentSuccessful((data) => console.log("The payment was successful"));
|
|
5531
5615
|
button.onPaymentError((data) => console.log("The payment was not successful"));
|
|
5616
|
+
button.onClick(() => console.log("On WalletButton Click"));
|
|
5532
5617
|
button.onUpdate((data) => {
|
|
5533
5618
|
console.log("Updating amount via a backend to backend call to POST charges/:id");
|
|
5534
5619
|
// call `POST charges/:id` to modify charge
|
|
@@ -5561,7 +5646,6 @@ _(Required `meta` fields: `amount_label`, `country`. Optional `meta` fields: `ra
|
|
|
5561
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.
|
|
5562
5647
|
|
|
5563
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.
|
|
5564
|
-
|
|
5565
5649
|
### ApplePay and GooglePay via MPGS Raw data initialization example
|
|
5566
5650
|
|
|
5567
5651
|
```html
|
|
@@ -5693,6 +5777,24 @@ Similarly, for **GooglePay via MPGS** you can initialize the `PaymentMethodSpeci
|
|
|
5693
5777
|
## Interfaces
|
|
5694
5778
|
|
|
5695
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>
|
|
5696
5798
|
<dt><a href="#IWalletMeta">IWalletMeta</a> : <code>object</code></dt>
|
|
5697
5799
|
<dd><p>Interface of data used by the wallet checkout and payment proccess.</p>
|
|
5698
5800
|
</dd>
|
|
@@ -5707,6 +5809,100 @@ Similarly, for **GooglePay via MPGS** you can initialize the `PaymentMethodSpeci
|
|
|
5707
5809
|
</dd>
|
|
5708
5810
|
</dl>
|
|
5709
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
|
+
|
|
5710
5906
|
<a name="IWalletMeta" id="IWalletMeta" href="#IWalletMeta"> </a>
|
|
5711
5907
|
|
|
5712
5908
|
## IWalletMeta : <code>object</code>
|
|
@@ -5791,14 +5987,19 @@ Class WalletButtons to work with different E-Wallets within html (currently supp
|
|
|
5791
5987
|
* [.load()](#WalletButtons+load)
|
|
5792
5988
|
* [.update()](#WalletButtons+update)
|
|
5793
5989
|
* [.setEnv(env, [alias])](#WalletButtons+setEnv)
|
|
5990
|
+
* [.enable()](#WalletButtons+enable)
|
|
5991
|
+
* [.disable()](#WalletButtons+disable)
|
|
5794
5992
|
* [.close()](#WalletButtons+close)
|
|
5795
|
-
* [.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>
|
|
5796
5994
|
* [.onUnavailable([handler])](#WalletButtons+onUnavailable)
|
|
5797
5995
|
* [.onUpdate([handler])](#WalletButtons+onUpdate)
|
|
5798
5996
|
* [.onPaymentSuccessful([handler])](#WalletButtons+onPaymentSuccessful)
|
|
5799
5997
|
* [.onPaymentInReview([handler])](#WalletButtons+onPaymentInReview)
|
|
5800
5998
|
* [.onPaymentError([handler])](#WalletButtons+onPaymentError)
|
|
5801
5999
|
* [.onAuthTokensChanged([handler])](#WalletButtons+onAuthTokensChanged)
|
|
6000
|
+
* [.onClick(handler)](#WalletButtons+onClick)
|
|
6001
|
+
* [.onCheckoutOpen(handler)](#WalletButtons+onCheckoutOpen)
|
|
6002
|
+
* [.onCheckoutClose(handler)](#WalletButtons+onCheckoutClose)
|
|
5802
6003
|
|
|
5803
6004
|
<a name="new_WalletButtons_new" id="new_WalletButtons_new" href="#new_WalletButtons_new"> </a>
|
|
5804
6005
|
|
|
@@ -5909,6 +6110,26 @@ Bear in mind that you must set an environment before calling `button.load()`.
|
|
|
5909
6110
|
```js
|
|
5910
6111
|
button.setEnv('production', 'paydock.com');
|
|
5911
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
|
+
```
|
|
5912
6133
|
<a name="WalletButtons+close" id="WalletButtons+close" href="#WalletButtons+close"> </a>
|
|
5913
6134
|
|
|
5914
6135
|
### walletButtons.close()
|
|
@@ -5921,7 +6142,7 @@ button.close();
|
|
|
5921
6142
|
```
|
|
5922
6143
|
<a name="WalletButtons+on" id="WalletButtons+on" href="#WalletButtons+on"> </a>
|
|
5923
6144
|
|
|
5924
|
-
### walletButtons.on(eventName, [cb]) ⇒ <code>Promise.<IEventData></code> \| <code>void</code>
|
|
6145
|
+
### walletButtons.on(eventName, [cb]) ⇒ [<code>Promise.<IEventData></code>](#IEventData) \| <code>void</code>
|
|
5925
6146
|
Listen to events of button. `unavailable` returns no data, `paymentSuccessful` returns IWalletPaymentSuccessful
|
|
5926
6147
|
for Stripe or full response for Flypay, and `paymentError` an error.
|
|
5927
6148
|
|
|
@@ -6084,6 +6305,63 @@ button.onAuthTokensChanged().then((eventData) => {
|
|
|
6084
6305
|
console.log('Authentication tokens changed:', eventData);
|
|
6085
6306
|
});
|
|
6086
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
|
+
```
|
|
6087
6365
|
<a name="EVENT" id="EVENT" href="#EVENT"> </a>
|
|
6088
6366
|
|
|
6089
6367
|
## EVENT : <code>object</code>
|
|
@@ -6097,31 +6375,36 @@ List of available event's name in the wallet button lifecycle
|
|
|
6097
6375
|
| UPDATE | <code>string</code> | <code>"update"</code> |
|
|
6098
6376
|
| PAYMENT_SUCCESSFUL | <code>string</code> | <code>"paymentSuccessful"</code> |
|
|
6099
6377
|
| PAYMENT_ERROR | <code>string</code> | <code>"paymentError"</code> |
|
|
6378
|
+
| ON_CLICK | <code>string</code> | <code>"onClick"</code> |
|
|
6379
|
+
|
|
6100
6380
|
|
|
6381
|
+
# Secure Remote Commerce
|
|
6101
6382
|
|
|
6102
|
-
##
|
|
6103
|
-
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#SRC).
|
|
6383
|
+
## Overview
|
|
6104
6384
|
|
|
6105
|
-
|
|
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).
|
|
6106
6387
|
|
|
6107
6388
|
## SRC simple example
|
|
6108
6389
|
|
|
6109
|
-
|
|
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.
|
|
6110
6395
|
|
|
6111
6396
|
```html
|
|
6112
|
-
<div id="checkoutButton"></div>
|
|
6113
6397
|
<div id="checkoutIframe"></div>
|
|
6114
6398
|
```
|
|
6115
6399
|
|
|
6116
|
-
|
|
6400
|
+
### Initialize the Widget
|
|
6117
6401
|
|
|
6402
|
+
Use the following code to initialize your widget:
|
|
6118
6403
|
|
|
6119
|
-
### Initialization
|
|
6120
6404
|
```javascript
|
|
6121
|
-
var src = new paydock.
|
|
6122
|
-
"#checkoutButton",
|
|
6405
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6123
6406
|
"#checkoutIframe",
|
|
6124
|
-
"
|
|
6407
|
+
"service_id",
|
|
6125
6408
|
"paydock_public_key_or_access_token",
|
|
6126
6409
|
{}, // meta
|
|
6127
6410
|
);
|
|
@@ -6130,23 +6413,22 @@ src.load();
|
|
|
6130
6413
|
|
|
6131
6414
|
```javascript
|
|
6132
6415
|
// ES2015 | TypeScript
|
|
6133
|
-
|
|
6134
|
-
|
|
6135
|
-
|
|
6136
|
-
var src = new SRC(
|
|
6137
|
-
"#checkoutButton",
|
|
6416
|
+
import { MastercardSRCClickToPay } from '@paydock/client-sdk';
|
|
6417
|
+
var src = new MastercardSRCClickToPay(
|
|
6138
6418
|
"#checkoutIframe",
|
|
6139
|
-
"
|
|
6419
|
+
"service_id",
|
|
6140
6420
|
"paydock_public_key_or_access_token",
|
|
6141
6421
|
{}, // meta
|
|
6142
6422
|
);
|
|
6143
6423
|
src.load();
|
|
6144
6424
|
```
|
|
6145
6425
|
|
|
6146
|
-
*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.
|
|
6147
6427
|
|
|
6148
6428
|
### Full example
|
|
6149
6429
|
|
|
6430
|
+
A full example of the container and the initialized widget is as follows:
|
|
6431
|
+
|
|
6150
6432
|
```html
|
|
6151
6433
|
<!DOCTYPE html>
|
|
6152
6434
|
<html lang="en">
|
|
@@ -6156,14 +6438,12 @@ src.load();
|
|
|
6156
6438
|
<style>iframe {border: 0;width: 40%;height: 300px;}</style>
|
|
6157
6439
|
</head>
|
|
6158
6440
|
<body>
|
|
6159
|
-
<div id="checkoutButton"></div>
|
|
6160
6441
|
<div id="checkoutIframe"></div>
|
|
6161
6442
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
6162
6443
|
<script>
|
|
6163
|
-
var src = new paydock.
|
|
6164
|
-
"#checkoutButton",
|
|
6444
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6165
6445
|
"#checkoutIframe",
|
|
6166
|
-
"
|
|
6446
|
+
"service_id",
|
|
6167
6447
|
"paydock_public_key_or_access_token",
|
|
6168
6448
|
{},
|
|
6169
6449
|
);
|
|
@@ -6173,50 +6453,30 @@ src.load();
|
|
|
6173
6453
|
</html>
|
|
6174
6454
|
```
|
|
6175
6455
|
|
|
6456
|
+
## Customize your SRC Checkout
|
|
6176
6457
|
|
|
6177
|
-
|
|
6458
|
+
The following is an advanced example that includes customization. You can use these methods to enhance your checkout experience.
|
|
6178
6459
|
|
|
6179
6460
|
### Settings
|
|
6180
6461
|
|
|
6181
6462
|
```javascript
|
|
6182
|
-
|
|
6183
|
-
src.setEnv('sandbox'); // set enviroment
|
|
6184
|
-
|
|
6185
|
-
src.hideButton(); // hide button
|
|
6186
|
-
|
|
6187
|
-
src.showButton(); // show button
|
|
6188
|
-
|
|
6463
|
+
src.setEnv('sandbox'); // set environment
|
|
6189
6464
|
src.hideCheckout(); // hide checkout iframe
|
|
6190
|
-
|
|
6191
6465
|
src.showCheckout(); // show checkout iframe
|
|
6192
|
-
|
|
6193
|
-
src.on('checkoutButtonLoaded', () => {
|
|
6194
|
-
console.log("Button loaded");
|
|
6195
|
-
});
|
|
6196
|
-
|
|
6197
|
-
src.on('checkoutButtonClicked', () => {
|
|
6198
|
-
console.log("Button clicked");
|
|
6199
|
-
});
|
|
6200
|
-
|
|
6201
6466
|
src.on('iframeLoaded', () => {
|
|
6202
6467
|
console.log("Initial iframe loaded");
|
|
6203
6468
|
});
|
|
6204
|
-
|
|
6205
6469
|
src.on('checkoutReady', () => {
|
|
6206
6470
|
console.log("Checkout ready to be used");
|
|
6207
6471
|
});
|
|
6208
|
-
|
|
6209
6472
|
src.on('checkoutCompleted', (token) => {
|
|
6210
6473
|
console.log(token);
|
|
6211
6474
|
});
|
|
6212
|
-
|
|
6213
6475
|
src.on('checkoutError', (error) => {
|
|
6214
6476
|
console.log(error);
|
|
6215
6477
|
});
|
|
6216
6478
|
```
|
|
6217
6479
|
|
|
6218
|
-
Here you can see how you can use this methods to customize your checkout experience
|
|
6219
|
-
|
|
6220
6480
|
### Full example
|
|
6221
6481
|
|
|
6222
6482
|
```html
|
|
@@ -6228,64 +6488,73 @@ Here you can see how you can use this methods to customize your checkout experie
|
|
|
6228
6488
|
<style>iframe {border: 0;width: 40%;height: 450px;}</style>
|
|
6229
6489
|
</head>
|
|
6230
6490
|
<body>
|
|
6231
|
-
<div id="checkoutButton"></div>
|
|
6232
6491
|
<div id="checkoutIframe"></div>
|
|
6233
6492
|
<script src="https://widget.paydock.com/sdk/latest/widget.umd.min.js" ></script>
|
|
6234
6493
|
<script>
|
|
6235
|
-
var src = new paydock.
|
|
6236
|
-
"#checkoutButton",
|
|
6494
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6237
6495
|
"#checkoutIframe",
|
|
6238
|
-
"
|
|
6496
|
+
"service_id",
|
|
6239
6497
|
"paydock_public_key_or_access_token",
|
|
6240
6498
|
{},
|
|
6241
6499
|
);
|
|
6242
|
-
|
|
6500
|
+
src.on('iframeLoaded', () => {
|
|
6501
|
+
console.log("Initial iframe loaded");
|
|
6502
|
+
});
|
|
6243
6503
|
src.on('checkoutReady', () => {
|
|
6244
6504
|
console.log("Checkout ready to be used");
|
|
6245
6505
|
});
|
|
6246
|
-
|
|
6247
6506
|
src.on('checkoutCompleted', (token) => {
|
|
6248
6507
|
console.log(token);
|
|
6249
6508
|
});
|
|
6509
|
+
src.on('checkoutError', (error) => {
|
|
6510
|
+
console.log(error);
|
|
6511
|
+
});
|
|
6250
6512
|
src.load();
|
|
6251
6513
|
</script>
|
|
6252
6514
|
</body>
|
|
6253
6515
|
</html>
|
|
6254
6516
|
```
|
|
6255
6517
|
|
|
6256
|
-
##
|
|
6257
|
-
### Shipping address:
|
|
6518
|
+
## Customize your billing address fields
|
|
6258
6519
|
|
|
6259
|
-
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.
|
|
6260
6522
|
|
|
6261
6523
|
```
|
|
6262
|
-
var src = new paydock.
|
|
6263
|
-
"#checkoutButton",
|
|
6524
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6264
6525
|
"#checkoutIframe",
|
|
6265
|
-
"
|
|
6526
|
+
"service_id",
|
|
6266
6527
|
"paydock_public_key_or_access_token",
|
|
6267
6528
|
{
|
|
6268
6529
|
"dpa_transaction_options": {
|
|
6269
|
-
"
|
|
6530
|
+
"dpa_billing_preference": "FULL"
|
|
6270
6531
|
}
|
|
6271
6532
|
},
|
|
6272
6533
|
);
|
|
6273
6534
|
```
|
|
6274
6535
|
|
|
6275
|
-
|
|
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:
|
|
6276
6538
|
|
|
6277
|
-
|
|
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.
|
|
6278
6542
|
|
|
6279
6543
|
```
|
|
6280
6544
|
POST v1/charges
|
|
6281
|
-
|
|
6282
6545
|
{
|
|
6283
6546
|
"amount": "10.00",
|
|
6284
6547
|
"currency": "AUD",
|
|
6285
|
-
"token": "
|
|
6548
|
+
"token": "one_time_token",
|
|
6286
6549
|
"customer": {
|
|
6287
6550
|
"payment_source": {
|
|
6288
|
-
"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"
|
|
6289
6558
|
}
|
|
6290
6559
|
},
|
|
6291
6560
|
"shipping": {
|
|
@@ -6300,201 +6569,262 @@ POST v1/charges
|
|
|
6300
6569
|
}
|
|
6301
6570
|
```
|
|
6302
6571
|
|
|
6303
|
-
|
|
6572
|
+
## How to customize accepted cards
|
|
6304
6573
|
|
|
6305
|
-
|
|
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:
|
|
6306
6579
|
|
|
6307
6580
|
```
|
|
6308
|
-
var src = new paydock.
|
|
6309
|
-
"#checkoutButton",
|
|
6581
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6310
6582
|
"#checkoutIframe",
|
|
6311
|
-
"
|
|
6312
|
-
"
|
|
6583
|
+
"service_id",
|
|
6584
|
+
"paydock_public_key",
|
|
6313
6585
|
{
|
|
6314
|
-
|
|
6315
|
-
"email": "test@email.com",
|
|
6316
|
-
"first_name": "Name",
|
|
6317
|
-
"last_name": "Surname",
|
|
6318
|
-
"phone": {
|
|
6319
|
-
"country_code": "1",
|
|
6320
|
-
"phone": "2124567890"
|
|
6321
|
-
},
|
|
6322
|
-
"payment_source": {
|
|
6323
|
-
"address_line1": "Line 1",
|
|
6324
|
-
"address_line2": "Line 2",
|
|
6325
|
-
"address_city": "Miami",
|
|
6326
|
-
"address_postcode": "33126",
|
|
6327
|
-
"address_state": "FL",
|
|
6328
|
-
"address_country": "US"
|
|
6329
|
-
}
|
|
6330
|
-
}
|
|
6586
|
+
unaccepted_card_type: 'DEBIT'
|
|
6331
6587
|
},
|
|
6332
6588
|
);
|
|
6333
6589
|
```
|
|
6334
6590
|
|
|
6335
|
-
##
|
|
6591
|
+
## Personalize the Style
|
|
6336
6592
|
|
|
6337
|
-
|
|
6593
|
+
Customize the look and feel of your UI. The following example demonstrates changes in the styling of the buttons.
|
|
6338
6594
|
|
|
6339
6595
|
### Example code
|
|
6340
6596
|
|
|
6341
6597
|
```
|
|
6342
|
-
var src = new paydock.
|
|
6343
|
-
"#checkoutButton",
|
|
6598
|
+
var src = new paydock.MastercardSRCClickToPay(
|
|
6344
6599
|
"#checkoutIframe",
|
|
6345
|
-
"
|
|
6600
|
+
"service_id",
|
|
6346
6601
|
"paydock_public_key",
|
|
6602
|
+
{},
|
|
6347
6603
|
);
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
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
|
+
});
|
|
6351
6612
|
```
|
|
6352
|
-
## Event and Values
|
|
6353
|
-
|
|
6354
|
-
| Event Value | Type | Description |
|
|
6355
|
-
| ------------------- | ------------------- | -------------------------------------------------------------- |
|
|
6356
|
-
| primary_color | <code>string</code> | HEX color for the principal buttons, example : #32a852 |
|
|
6357
|
-
| button_text_color | <code>string</code> | HEX color for the text of the buttons, example : #32a852|
|
|
6358
|
-
| font_family | <code>string</code> | Look more [mozilla.org/color](https://developer.mozilla.org/en-US/docs/Web/CSS/font-family)|
|
|
6359
|
-
| card_schemes | <code>[string] - array of string</code> | Possible values "visa", "mastercard", "amex" and "discover" - Default show all logos
|
|
6360
6613
|
|
|
6361
6614
|
## Classes
|
|
6362
6615
|
|
|
6363
6616
|
<dl>
|
|
6364
|
-
<dt><a href="#
|
|
6365
|
-
<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>
|
|
6366
6619
|
</dd>
|
|
6367
6620
|
</dl>
|
|
6368
6621
|
|
|
6369
6622
|
## Interfaces
|
|
6370
6623
|
|
|
6371
6624
|
<dl>
|
|
6372
|
-
<dt><a href="#
|
|
6373
|
-
<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>
|
|
6374
6637
|
</dd>
|
|
6375
6638
|
</dl>
|
|
6376
6639
|
|
|
6377
|
-
<a name="
|
|
6640
|
+
<a name="IMastercardSRCMeta" id="IMastercardSRCMeta" href="#IMastercardSRCMeta"> </a>
|
|
6378
6641
|
|
|
6379
|
-
##
|
|
6380
|
-
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).
|
|
6381
6644
|
|
|
6382
6645
|
**Kind**: global interface
|
|
6383
6646
|
|
|
6384
6647
|
| Param | Type | Description |
|
|
6385
6648
|
| --- | --- | --- |
|
|
6386
|
-
| [
|
|
6649
|
+
| [disable_summary_screen] | <code>boolean</code> | Boolean flag that controls if a final summary screen is presented in the checkout flow. |
|
|
6387
6650
|
| [dpa_data] | <code>object</code> | Object where the DPA creation data is stored. |
|
|
6388
|
-
| [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. |
|
|
6389
6652
|
| [dpa_data.dpa_uri] | <code>string</code> | Used for indicating the DPA URI. |
|
|
6390
|
-
| [
|
|
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. |
|
|
6391
6669
|
| [dpa_transaction_options.dpa_locale] | <code>string</code> | DPA’s preferred locale, example en_US. |
|
|
6392
|
-
| [dpa_transaction_options.dpa_accepted_billing_countries] | <code>Array
|
|
6393
|
-
| [dpa_transaction_options.
|
|
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.transaction_amount.transaction_amount] | <code>number</code> | Used to indicate the amount of the transaction. |
|
|
6409
|
-
| [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. |
|
|
6410
|
-
| [dpa_transaction_options.merchant_order_id] | <code>string</code> | Used to indicate the merchants order Id. |
|
|
6411
|
-
| [dpa_transaction_options.merchant_category_code] | <code>string</code> | Used to indicate the merchants category code. |
|
|
6412
|
-
| [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. |
|
|
6413
6686
|
| [customer] | <code>object</code> | Object where the customer data is stored to prefill in the checkout. |
|
|
6414
6687
|
| [customer.email] | <code>string</code> | Customer email. |
|
|
6415
6688
|
| [customer.first_name] | <code>string</code> | Customer first name. |
|
|
6416
6689
|
| [customer.last_name] | <code>string</code> | Customer last name. |
|
|
6417
6690
|
| [customer.phone] | <code>object</code> | Object where the customer phone is stored. |
|
|
6418
|
-
| [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! |
|
|
6419
6692
|
| [customer.phone.phone] | <code>string</code> | Customer phone number. |
|
|
6420
|
-
| [
|
|
6421
|
-
|
|
6422
|
-
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
| [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
|
|
6427
6699
|
|
|
6428
|
-
|
|
6700
|
+
**Kind**: global interface
|
|
6429
6701
|
|
|
6430
|
-
|
|
6431
|
-
|
|
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
|
|
6432
6760
|
|
|
6433
6761
|
**Kind**: global class
|
|
6762
|
+
**Extends**: <code>SRC</code>
|
|
6434
6763
|
|
|
6435
|
-
* [
|
|
6436
|
-
* [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)
|
|
6437
6767
|
* [.setStyles(fields)](#SRC+setStyles)
|
|
6438
|
-
* [.load()](#SRC+load)
|
|
6439
6768
|
* [.setEnv(env, [alias])](#SRC+setEnv)
|
|
6440
6769
|
* [.getEnv()](#SRC+getEnv)
|
|
6441
6770
|
* [.on(eventName, [cb])](#SRC+on) ⇒ <code>Promise.<any></code> \| <code>void</code>
|
|
6442
|
-
* [.hideButton([saveSize])](#SRC+hideButton)
|
|
6443
|
-
* [.showButton()](#SRC+showButton)
|
|
6444
6771
|
* [.hideCheckout([saveSize])](#SRC+hideCheckout)
|
|
6445
6772
|
* [.showCheckout()](#SRC+showCheckout)
|
|
6446
6773
|
* [.reload()](#SRC+reload)
|
|
6447
6774
|
* [.useAutoResize()](#SRC+useAutoResize)
|
|
6448
6775
|
|
|
6449
|
-
<a name="
|
|
6776
|
+
<a name="new_MastercardSRCClickToPay_new" id="new_MastercardSRCClickToPay_new" href="#new_MastercardSRCClickToPay_new"> </a>
|
|
6450
6777
|
|
|
6451
|
-
### new
|
|
6778
|
+
### new MastercardSRCClickToPay(iframe_selector, service_id, public_key_or_access_token, meta)
|
|
6452
6779
|
|
|
6453
6780
|
| Param | Type | Description |
|
|
6454
6781
|
| --- | --- | --- |
|
|
6455
|
-
| button_selector | <code>string</code> | Selector of html element. Container for SRC checkout button. |
|
|
6456
6782
|
| iframe_selector | <code>string</code> | Selector of html element. Container for SRC checkout iFrame. |
|
|
6457
6783
|
| service_id | <code>string</code> | Card Scheme Service ID |
|
|
6458
6784
|
| public_key_or_access_token | <code>string</code> | Paydock public key or Access Token |
|
|
6459
|
-
| meta | [<code>
|
|
6785
|
+
| meta | [<code>IMastercardSRCMeta</code>](#IMastercardSRCMeta) | Data that configures the SRC checkout |
|
|
6460
6786
|
|
|
6461
6787
|
**Example**
|
|
6462
6788
|
```js
|
|
6463
|
-
var
|
|
6789
|
+
var mastercardSRC = new MastercardSRCClickToPay('#checkoutIframe', 'service_id', 'public_key', {});
|
|
6464
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)
|
|
6465
6797
|
<a name="SRC+setStyles" id="SRC+setStyles" href="#SRC+setStyles"> </a>
|
|
6466
6798
|
|
|
6467
|
-
###
|
|
6799
|
+
### mastercardSRCClickToPay.setStyles(fields)
|
|
6468
6800
|
Object contain styles for widget - call before `.load()`.
|
|
6469
6801
|
|
|
6470
|
-
**Kind**: instance method of [<code>
|
|
6802
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6803
|
+
**Overrides**: [<code>setStyles</code>](#SRC+setStyles)
|
|
6471
6804
|
|
|
6472
6805
|
| Param | Type | Description |
|
|
6473
6806
|
| --- | --- | --- |
|
|
6474
|
-
| 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) |
|
|
6475
6808
|
|
|
6476
6809
|
**Example**
|
|
6477
6810
|
```js
|
|
6478
6811
|
widget.setStyles({
|
|
6479
|
-
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
|
|
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
|
+
});
|
|
6484
6819
|
```
|
|
6485
|
-
<a name="SRC+load" id="SRC+load" href="#SRC+load"> </a>
|
|
6486
|
-
|
|
6487
|
-
### srC.load()
|
|
6488
|
-
The final method after configuring the SRC to start the load process of SRC checkout
|
|
6489
|
-
|
|
6490
|
-
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
6491
6820
|
<a name="SRC+setEnv" id="SRC+setEnv" href="#SRC+setEnv"> </a>
|
|
6492
6821
|
|
|
6493
|
-
###
|
|
6822
|
+
### mastercardSRCClickToPay.setEnv(env, [alias])
|
|
6494
6823
|
Current method can change environment. By default environment = sandbox.
|
|
6495
6824
|
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
6496
6825
|
|
|
6497
|
-
**Kind**: instance method of [<code>
|
|
6826
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6827
|
+
**Overrides**: [<code>setEnv</code>](#SRC+setEnv)
|
|
6498
6828
|
|
|
6499
6829
|
| Param | Type | Description |
|
|
6500
6830
|
| --- | --- | --- |
|
|
@@ -6507,25 +6837,27 @@ SRC.setEnv('production');
|
|
|
6507
6837
|
```
|
|
6508
6838
|
<a name="SRC+getEnv" id="SRC+getEnv" href="#SRC+getEnv"> </a>
|
|
6509
6839
|
|
|
6510
|
-
###
|
|
6840
|
+
### mastercardSRCClickToPay.getEnv()
|
|
6511
6841
|
Method to read the current environment
|
|
6512
6842
|
|
|
6513
|
-
**Kind**: instance method of [<code>
|
|
6843
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6844
|
+
**Overrides**: [<code>getEnv</code>](#SRC+getEnv)
|
|
6514
6845
|
**Example**
|
|
6515
6846
|
```js
|
|
6516
6847
|
SRC.getEnv();
|
|
6517
6848
|
```
|
|
6518
6849
|
<a name="SRC+on" id="SRC+on" href="#SRC+on"> </a>
|
|
6519
6850
|
|
|
6520
|
-
###
|
|
6851
|
+
### mastercardSRCClickToPay.on(eventName, [cb]) ⇒ <code>Promise.<any></code> \| <code>void</code>
|
|
6521
6852
|
Listen to events of SRC
|
|
6522
6853
|
|
|
6523
|
-
**Kind**: instance method of [<code>
|
|
6854
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6855
|
+
**Overrides**: [<code>on</code>](#SRC+on)
|
|
6524
6856
|
|
|
6525
6857
|
| Param | Type | Description |
|
|
6526
6858
|
| --- | --- | --- |
|
|
6527
6859
|
| eventName | <code>string</code> | Available event names [EVENT](#EVENT) |
|
|
6528
|
-
| [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) |
|
|
6529
6861
|
|
|
6530
6862
|
**Example**
|
|
6531
6863
|
```js
|
|
@@ -6537,37 +6869,13 @@ SRC.on('checkoutCompleted').then(function (token) {
|
|
|
6537
6869
|
console.log(token);
|
|
6538
6870
|
});
|
|
6539
6871
|
```
|
|
6540
|
-
<a name="SRC+hideButton" id="SRC+hideButton" href="#SRC+hideButton"> </a>
|
|
6541
|
-
|
|
6542
|
-
### srC.hideButton([saveSize])
|
|
6543
|
-
Using this method you can hide button
|
|
6544
|
-
|
|
6545
|
-
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
6546
|
-
|
|
6547
|
-
| Param | Type | Default | Description |
|
|
6548
|
-
| --- | --- | --- | --- |
|
|
6549
|
-
| [saveSize] | <code>boolean</code> | <code>false</code> | using this param you can save iframe's size (if applicable) |
|
|
6550
|
-
|
|
6551
|
-
**Example**
|
|
6552
|
-
```js
|
|
6553
|
-
SRC.hideButton();
|
|
6554
|
-
```
|
|
6555
|
-
<a name="SRC+showButton" id="SRC+showButton" href="#SRC+showButton"> </a>
|
|
6556
|
-
|
|
6557
|
-
### srC.showButton()
|
|
6558
|
-
Using this method you can show the SRC button after using hideButton method
|
|
6559
|
-
|
|
6560
|
-
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
6561
|
-
**Example**
|
|
6562
|
-
```js
|
|
6563
|
-
SRC.showButton();
|
|
6564
|
-
```
|
|
6565
6872
|
<a name="SRC+hideCheckout" id="SRC+hideCheckout" href="#SRC+hideCheckout"> </a>
|
|
6566
6873
|
|
|
6567
|
-
###
|
|
6874
|
+
### mastercardSRCClickToPay.hideCheckout([saveSize])
|
|
6568
6875
|
Using this method you can hide checkout after load and button click
|
|
6569
6876
|
|
|
6570
|
-
**Kind**: instance method of [<code>
|
|
6877
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6878
|
+
**Overrides**: [<code>hideCheckout</code>](#SRC+hideCheckout)
|
|
6571
6879
|
|
|
6572
6880
|
| Param | Type | Default | Description |
|
|
6573
6881
|
| --- | --- | --- | --- |
|
|
@@ -6579,30 +6887,33 @@ SRC.hideCheckout();
|
|
|
6579
6887
|
```
|
|
6580
6888
|
<a name="SRC+showCheckout" id="SRC+showCheckout" href="#SRC+showCheckout"> </a>
|
|
6581
6889
|
|
|
6582
|
-
###
|
|
6890
|
+
### mastercardSRCClickToPay.showCheckout()
|
|
6583
6891
|
Using this method you can show checkout after using hideCheckout method
|
|
6584
6892
|
|
|
6585
|
-
**Kind**: instance method of [<code>
|
|
6893
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6894
|
+
**Overrides**: [<code>showCheckout</code>](#SRC+showCheckout)
|
|
6586
6895
|
**Example**
|
|
6587
6896
|
```js
|
|
6588
6897
|
SRC.showCheckout()
|
|
6589
6898
|
```
|
|
6590
6899
|
<a name="SRC+reload" id="SRC+reload" href="#SRC+reload"> </a>
|
|
6591
6900
|
|
|
6592
|
-
###
|
|
6901
|
+
### mastercardSRCClickToPay.reload()
|
|
6593
6902
|
Using this method you can reload the whole checkout
|
|
6594
6903
|
|
|
6595
|
-
**Kind**: instance method of [<code>
|
|
6904
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6905
|
+
**Overrides**: [<code>reload</code>](#SRC+reload)
|
|
6596
6906
|
**Example**
|
|
6597
6907
|
```js
|
|
6598
6908
|
SRC.reload()
|
|
6599
6909
|
```
|
|
6600
6910
|
<a name="SRC+useAutoResize" id="SRC+useAutoResize" href="#SRC+useAutoResize"> </a>
|
|
6601
6911
|
|
|
6602
|
-
###
|
|
6912
|
+
### mastercardSRCClickToPay.useAutoResize()
|
|
6603
6913
|
Use this method for resize checkout iFrame according to content height, if applicable
|
|
6604
6914
|
|
|
6605
|
-
**Kind**: instance method of [<code>
|
|
6915
|
+
**Kind**: instance method of [<code>MastercardSRCClickToPay</code>](#MastercardSRCClickToPay)
|
|
6916
|
+
**Overrides**: [<code>useAutoResize</code>](#SRC+useAutoResize)
|
|
6606
6917
|
**Example**
|
|
6607
6918
|
```js
|
|
6608
6919
|
SRC.useAutoResize();
|
|
@@ -6614,15 +6925,28 @@ List of available event's name in the SRC checkout lifecycle
|
|
|
6614
6925
|
|
|
6615
6926
|
**Kind**: global enum
|
|
6616
6927
|
|
|
6617
|
-
| Param | Type | Default |
|
|
6618
|
-
| --- | --- | --- |
|
|
6619
|
-
|
|
|
6620
|
-
|
|
|
6621
|
-
|
|
|
6622
|
-
|
|
|
6623
|
-
| CHECKOUT_COMPLETED | <code>string</code> | <code>"checkoutCompleted"</code> |
|
|
6624
|
-
| 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> | |
|
|
6625
6949
|
|
|
6626
6950
|
|
|
6627
6951
|
## License
|
|
6628
|
-
Copyright (c)
|
|
6952
|
+
Copyright (c) 2024 paydock
|