@paydock/client-sdk 1.10.89-beta → 1.11.3-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 +478 -2
- package/bundles/widget.umd.js +449 -3
- package/bundles/widget.umd.min.js +1 -1
- package/inicialization-guide.md +7 -0
- package/lib/api/api-internal.d.ts +2 -0
- package/lib/api/api-internal.js +4 -0
- package/lib/api/api-internal.js.map +1 -1
- package/lib/api/api-service-internal.d.ts +17 -0
- package/lib/api/api-service-internal.js +18 -0
- package/lib/api/api-service-internal.js.map +1 -0
- package/lib/checkout-button/zipmoney.runner.d.ts +1 -0
- package/lib/checkout-button/zipmoney.runner.js +8 -0
- package/lib/checkout-button/zipmoney.runner.js.map +1 -1
- package/lib/components/iframe-event.d.ts +3 -0
- package/lib/components/iframe-event.js +2 -0
- package/lib/components/iframe-event.js.map +1 -1
- package/lib/components/link.d.ts +4 -2
- package/lib/components/link.js +4 -0
- package/lib/components/link.js.map +1 -1
- package/lib/components/param.d.ts +6 -0
- package/lib/components/param.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/secure-remote-commerce/index.d.ts +1 -0
- package/lib/secure-remote-commerce/index.js +2 -0
- package/lib/secure-remote-commerce/index.js.map +1 -0
- package/lib/secure-remote-commerce/interfaces.d.ts +58 -0
- package/lib/secure-remote-commerce/interfaces.js +22 -0
- package/lib/secure-remote-commerce/interfaces.js.map +1 -0
- package/lib/secure-remote-commerce/providers/src-provider.d.ts +10 -0
- package/lib/secure-remote-commerce/providers/src-provider.js +1 -0
- package/lib/secure-remote-commerce/providers/src-provider.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.d.ts +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.js +2 -0
- package/lib/secure-remote-commerce/providers/visa-src/index.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.d.ts +27 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.js +100 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.js.map +1 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.d.ts +8 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js +10 -0
- package/lib/secure-remote-commerce/providers/visa-src/visa-src.styles.js.map +1 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.d.ts +148 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.js +210 -0
- package/lib/secure-remote-commerce/secure-remote-commerce.js.map +1 -0
- package/lib/wallet-buttons/google.wallet-service.js +2 -3
- package/lib/wallet-buttons/google.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/mastercard.wallet-service.d.ts +1 -0
- package/lib/wallet-buttons/mastercard.wallet-service.js +4 -0
- package/lib/wallet-buttons/mastercard.wallet-service.js.map +1 -1
- package/lib/wallet-buttons/wallet-buttons.js +1 -1
- package/lib/wallet-buttons/wallet-buttons.js.map +1 -1
- package/package.json +1 -1
- package/slate.md +233 -3
package/README.md
CHANGED
|
@@ -5300,7 +5300,7 @@ button.load();
|
|
|
5300
5300
|
|
|
5301
5301
|
```javascript--es2015
|
|
5302
5302
|
// ES2015 | TypeScript
|
|
5303
|
-
import { WalletButtons } from '@paydock/client-sdk
|
|
5303
|
+
import { WalletButtons } from '@paydock/client-sdk';
|
|
5304
5304
|
|
|
5305
5305
|
var button = new WalletButtons(
|
|
5306
5306
|
'#widget',
|
|
@@ -5325,7 +5325,7 @@ button.load();
|
|
|
5325
5325
|
|
|
5326
5326
|
```javascript--es2015
|
|
5327
5327
|
// ES2015 | TypeScript
|
|
5328
|
-
import { WalletButtons } from '@paydock/client-sdk
|
|
5328
|
+
import { WalletButtons } from '@paydock/client-sdk';
|
|
5329
5329
|
|
|
5330
5330
|
var button = new WalletButtons(
|
|
5331
5331
|
'#widget',
|
|
@@ -5696,5 +5696,481 @@ Also, for **ApplePay via MPGS** you can initialize the `ApplePayPaymentRequest`
|
|
|
5696
5696
|
</script>
|
|
5697
5697
|
</html>
|
|
5698
5698
|
```
|
|
5699
|
+
## Classes
|
|
5700
|
+
|
|
5701
|
+
<dl>
|
|
5702
|
+
<dt><a href="#SRC">SRC</a></dt>
|
|
5703
|
+
<dd><p>Class SRC include methods for interacting with different secure remote commerce options such as Visa SRC</p>
|
|
5704
|
+
</dd>
|
|
5705
|
+
</dl>
|
|
5706
|
+
|
|
5707
|
+
## Interfaces
|
|
5708
|
+
|
|
5709
|
+
<dl>
|
|
5710
|
+
<dt><a href="#IVisaSRCMeta">IVisaSRCMeta</a> : <code>object</code></dt>
|
|
5711
|
+
<dd><p>Interface of data used for the Visa Checkout.</p>
|
|
5712
|
+
</dd>
|
|
5713
|
+
</dl>
|
|
5714
|
+
|
|
5715
|
+
<a name="IVisaSRCMeta" id="IVisaSRCMeta"></a>
|
|
5716
|
+
|
|
5717
|
+
## IVisaSRCMeta : <code>object</code>
|
|
5718
|
+
Interface of data used for the Visa Checkout.
|
|
5719
|
+
|
|
5720
|
+
**Kind**: global interface
|
|
5721
|
+
|
|
5722
|
+
| Param | Type | Description |
|
|
5723
|
+
| --- | --- | --- |
|
|
5724
|
+
| [srci_transaction_id] | <code>string</code> | Used to identify the SRC Id. |
|
|
5725
|
+
| [dpa_data] | <code>object</code> | Object where the DPA creation data is stored. |
|
|
5726
|
+
| [dpa_data.dpa_presentation_name] | <code>string</code> | Name in which the DPA is presented in. |
|
|
5727
|
+
| [dpa_data.dpa_uri] | <code>string</code> | Used for indicating the DPA URI. |
|
|
5728
|
+
| [dpa_transaction_options] | <code>object</code> | Object that stores options for creating a trasaction with DPA. |
|
|
5729
|
+
| [dpa_transaction_options.dpa_locale] | <code>string</code> | DPA’s preferred locale, example en_US. |
|
|
5730
|
+
| [dpa_transaction_options.dpa_accepted_billing_countries] | <code>Array</code> | Used to indicate list of accepted billing countries for DPA. |
|
|
5731
|
+
| [dpa_transaction_options.dpa_accepted_shipping_countries] | <code>Array</code> | Used to indicate list of accepted shipping countries for DPA. |
|
|
5732
|
+
| [dpa_transaction_options.dpa_billing_preference] | <code>string</code> | Used for listing the enumeration for billing preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'. |
|
|
5733
|
+
| [dpa_transaction_options.dpa_shipping_preference] | <code>string</code> | Used for listing the enumeration for shipping preferences for DPA. Options are 'ALL', 'POSTAL_COUNTRY' and 'NONE'. |
|
|
5734
|
+
| [dpa_transaction_options.consumer_name_requested] | <code>boolean</code> | Used to check if the name of the consumer is needed. |
|
|
5735
|
+
| [dpa_transaction_options.consumer_email_address_requested] | <code>boolean</code> | Used to check if the email of the consumer is needed. |
|
|
5736
|
+
| [dpa_transaction_options.consumer_phone_number_requested] | <code>boolean</code> | Used to check if the phone number of the consumer is needed. |
|
|
5737
|
+
| [dpa_transaction_options.payment_options] | <code>object</code> | Object used to check the payment options that are included. |
|
|
5738
|
+
| [dpa_transaction_options.payment_options.dpa_dynamic_data_ttl_minutes] | <code>number</code> | The minimum requested validity period for the transaction credentials. |
|
|
5739
|
+
| [dpa_transaction_options.payment_options.dynamic_data_type] | <code>string</code> | Used for listing the enumeration for dynamic data types. Options are 'TAVV' and 'DTVV'. |
|
|
5740
|
+
| [dpa_transaction_options.payment_options.dpa_pan_requested] | <code>boolean</code> | Used to check if PAN number was requested. |
|
|
5741
|
+
| [dpa_transaction_options.review_action] | <code>string</code> | Used for listing the enumeration of review actions. Options are 'pay' and 'continue'. |
|
|
5742
|
+
| [dpa_transaction_options.checkout_description] | <code>string</code> | Used for indicating the description of the checkout. |
|
|
5743
|
+
| [dpa_transaction_options.transaction_type] | <code>string</code> | Used for listing the enumeration of the type of the transaction. 'PURCHASE', 'BILL_PAYMENT' and 'MONEY_TRANSFER' |
|
|
5744
|
+
| [dpa_transaction_options.order_type] | <code>string</code> | Used for listing the enumeration of the type of the order. Options are 'REAUTHORIZATION', 'RECURRING' and 'INSTALLMENT'. |
|
|
5745
|
+
| [dpa_transaction_options.transaction_amount] | <code>object</code> | Object used to describe the details of the transaction. |
|
|
5746
|
+
| [dpa_transaction_options.transaction_amount.transaction_amount] | <code>number</code> | Used to indicate the amount of the transaction. |
|
|
5747
|
+
| [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. |
|
|
5748
|
+
| [dpa_transaction_options.merchant_order_id] | <code>string</code> | Used to indicate the merchants order Id. |
|
|
5749
|
+
| [dpa_transaction_options.merchant_category_code] | <code>string</code> | Used to indicate the merchants category code. |
|
|
5750
|
+
| [dpa_transaction_options.merchant_country_code] | <code>string</code> | Used to indicate the merchants country code. 2 letter ISO code format. |
|
|
5751
|
+
| [customer] | <code>object</code> | Object where the customer data is stored to prefill in the checkout. |
|
|
5752
|
+
| [customer.email] | <code>string</code> | Customer email. |
|
|
5753
|
+
| [customer.first_name] | <code>string</code> | Customer first name. |
|
|
5754
|
+
| [customer.last_name] | <code>string</code> | Customer last name. |
|
|
5755
|
+
| [customer.phone] | <code>object</code> | Object where the customer phone is stored. |
|
|
5756
|
+
| [customer.phone.country_code] | <code>string</code> | Customer phone country code (example "1" for US). |
|
|
5757
|
+
| [customer.phone.phone] | <code>string</code> | Customer phone number. |
|
|
5758
|
+
| [customer.payment_source] | <code>object</code> | Object where the customer billing address data is stored. |
|
|
5759
|
+
| [customer.payment_source.address_line1] | <code>string</code> | Customer billing address line 1. |
|
|
5760
|
+
| [customer.payment_source.address_line2] | <code>string</code> | Customer billing address line 2. |
|
|
5761
|
+
| [customer.payment_source.address_city] | <code>string</code> | Customer billing address city. |
|
|
5762
|
+
| [customer.payment_source.address_postcode] | <code>string</code> | Customer billing address postcode. |
|
|
5763
|
+
| [customer.payment_source.address_state] | <code>string</code> | Customer billing address state code (if applicable for the country, example "FL" for Florida). |
|
|
5764
|
+
| [customer.payment_source.address_country] | <code>string</code> | Customer billing address country code (example "US"). |
|
|
5765
|
+
|
|
5766
|
+
<a name="SRC" id="SRC"></a>
|
|
5767
|
+
|
|
5768
|
+
## SRC
|
|
5769
|
+
Class SRC include methods for interacting with different secure remote commerce options such as Visa SRC
|
|
5770
|
+
|
|
5771
|
+
**Kind**: global class
|
|
5772
|
+
|
|
5773
|
+
* [SRC](#SRC)
|
|
5774
|
+
* [new exports.SRC(button_selector, iframe_selector, service_id, public_key, meta)](#new_SRC_new)
|
|
5775
|
+
* [.load()](#SRC+load)
|
|
5776
|
+
* [.setEnv(env, [alias])](#SRC+setEnv)
|
|
5777
|
+
* [.getEnv()](#SRC+getEnv)
|
|
5778
|
+
* [.on(eventName, [cb])](#SRC+on) ⇒ <code>Promise.<any></code> \| <code>void</code>
|
|
5779
|
+
* [.hideButton([saveSize])](#SRC+hideButton)
|
|
5780
|
+
* [.showButton()](#SRC+showButton)
|
|
5781
|
+
* [.hideCheckout([saveSize])](#SRC+hideCheckout)
|
|
5782
|
+
* [.showCheckout()](#SRC+showCheckout)
|
|
5783
|
+
* [.reload()](#SRC+reload)
|
|
5784
|
+
* [.useAutoResize()](#SRC+useAutoResize)
|
|
5785
|
+
|
|
5786
|
+
<a name="new_SRC_new" id="new_SRC_new"></a>
|
|
5787
|
+
|
|
5788
|
+
### new exports.SRC(button_selector, iframe_selector, service_id, public_key, meta)
|
|
5789
|
+
|
|
5790
|
+
| Param | Type | Description |
|
|
5791
|
+
| --- | --- | --- |
|
|
5792
|
+
| button_selector | <code>string</code> | Selector of html element. Container for SRC checkout button. |
|
|
5793
|
+
| iframe_selector | <code>string</code> | Selector of html element. Container for SRC checkout iFrame. |
|
|
5794
|
+
| service_id | <code>string</code> | Card Scheme Service ID |
|
|
5795
|
+
| public_key | <code>string</code> | Paydock public key |
|
|
5796
|
+
| meta | [<code>IVisaSRCMeta</code>](#IVisaSRCMeta) | Data that configures the SRC checkout |
|
|
5797
|
+
|
|
5798
|
+
**Example**
|
|
5799
|
+
```js
|
|
5800
|
+
var SRC = new SRC('#checkoutButton', '#checkoutIframe', 'service_id', 'public_key', {});
|
|
5801
|
+
```
|
|
5802
|
+
<a name="SRC+load" id="SRC+load"></a>
|
|
5803
|
+
|
|
5804
|
+
### srC.load()
|
|
5805
|
+
The final method after configuring the SRC to start the load process of SRC checkout
|
|
5806
|
+
|
|
5807
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5808
|
+
<a name="SRC+setEnv" id="SRC+setEnv"></a>
|
|
5809
|
+
|
|
5810
|
+
### srC.setEnv(env, [alias])
|
|
5811
|
+
Current method can change environment. By default environment = sandbox.
|
|
5812
|
+
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
5813
|
+
|
|
5814
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5815
|
+
|
|
5816
|
+
| Param | Type | Description |
|
|
5817
|
+
| --- | --- | --- |
|
|
5818
|
+
| env | <code>string</code> | sandbox, production |
|
|
5819
|
+
| [alias] | <code>string</code> | Own domain alias |
|
|
5820
|
+
|
|
5821
|
+
**Example**
|
|
5822
|
+
```js
|
|
5823
|
+
SRC.setEnv('production');
|
|
5824
|
+
```
|
|
5825
|
+
<a name="SRC+getEnv" id="SRC+getEnv"></a>
|
|
5826
|
+
|
|
5827
|
+
### srC.getEnv()
|
|
5828
|
+
Method to read the current environment
|
|
5829
|
+
|
|
5830
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5831
|
+
**Example**
|
|
5832
|
+
```js
|
|
5833
|
+
SRC.getEnv();
|
|
5834
|
+
```
|
|
5835
|
+
<a name="SRC+on" id="SRC+on"></a>
|
|
5836
|
+
|
|
5837
|
+
### srC.on(eventName, [cb]) ⇒ <code>Promise.<any></code> \| <code>void</code>
|
|
5838
|
+
Listen to events of SRC
|
|
5839
|
+
|
|
5840
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5841
|
+
|
|
5842
|
+
| Param | Type | Description |
|
|
5843
|
+
| --- | --- | --- |
|
|
5844
|
+
| eventName | <code>string</code> | Available event names [EVENT](#EVENT) |
|
|
5845
|
+
| [cb] | <code>listener</code> | |
|
|
5846
|
+
|
|
5847
|
+
**Example**
|
|
5848
|
+
```js
|
|
5849
|
+
SRC.on('checkoutCompleted', function (token) {
|
|
5850
|
+
console.log(token);
|
|
5851
|
+
});
|
|
5852
|
+
// or
|
|
5853
|
+
SRC.on('checkoutCompleted').then(function (token) {
|
|
5854
|
+
console.log(token);
|
|
5855
|
+
});
|
|
5856
|
+
```
|
|
5857
|
+
<a name="SRC+hideButton" id="SRC+hideButton"></a>
|
|
5858
|
+
|
|
5859
|
+
### srC.hideButton([saveSize])
|
|
5860
|
+
Using this method you can hide button
|
|
5861
|
+
|
|
5862
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5863
|
+
|
|
5864
|
+
| Param | Type | Default | Description |
|
|
5865
|
+
| --- | --- | --- | --- |
|
|
5866
|
+
| [saveSize] | <code>boolean</code> | <code>false</code> | using this param you can save iframe's size (if applicable) |
|
|
5867
|
+
|
|
5868
|
+
**Example**
|
|
5869
|
+
```js
|
|
5870
|
+
SRC.hideButton();
|
|
5871
|
+
```
|
|
5872
|
+
<a name="SRC+showButton" id="SRC+showButton"></a>
|
|
5873
|
+
|
|
5874
|
+
### srC.showButton()
|
|
5875
|
+
Using this method you can show the SRC button after using hideButton method
|
|
5876
|
+
|
|
5877
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5878
|
+
**Example**
|
|
5879
|
+
```js
|
|
5880
|
+
SRC.showButton();
|
|
5881
|
+
```
|
|
5882
|
+
<a name="SRC+hideCheckout" id="SRC+hideCheckout"></a>
|
|
5883
|
+
|
|
5884
|
+
### srC.hideCheckout([saveSize])
|
|
5885
|
+
Using this method you can hide checkout after load and button click
|
|
5886
|
+
|
|
5887
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5888
|
+
|
|
5889
|
+
| Param | Type | Default | Description |
|
|
5890
|
+
| --- | --- | --- | --- |
|
|
5891
|
+
| [saveSize] | <code>boolean</code> | <code>false</code> | using this param you can save iframe's size (if applicable) |
|
|
5892
|
+
|
|
5893
|
+
**Example**
|
|
5894
|
+
```js
|
|
5895
|
+
SRC.hideCheckout();
|
|
5896
|
+
```
|
|
5897
|
+
<a name="SRC+showCheckout" id="SRC+showCheckout"></a>
|
|
5898
|
+
|
|
5899
|
+
### srC.showCheckout()
|
|
5900
|
+
Using this method you can show checkout after using hideCheckout method
|
|
5901
|
+
|
|
5902
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5903
|
+
**Example**
|
|
5904
|
+
```js
|
|
5905
|
+
SRC.showCheckout()
|
|
5906
|
+
```
|
|
5907
|
+
<a name="SRC+reload" id="SRC+reload"></a>
|
|
5908
|
+
|
|
5909
|
+
### srC.reload()
|
|
5910
|
+
Using this method you can reload the whole checkout
|
|
5911
|
+
|
|
5912
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5913
|
+
**Example**
|
|
5914
|
+
```js
|
|
5915
|
+
SRC.reload()
|
|
5916
|
+
```
|
|
5917
|
+
<a name="SRC+useAutoResize" id="SRC+useAutoResize"></a>
|
|
5918
|
+
|
|
5919
|
+
### srC.useAutoResize()
|
|
5920
|
+
Use this method for resize checkout iFrame according to content height, if applicable
|
|
5921
|
+
|
|
5922
|
+
**Kind**: instance method of [<code>SRC</code>](#SRC)
|
|
5923
|
+
**Example**
|
|
5924
|
+
```js
|
|
5925
|
+
SRC.useAutoResize();
|
|
5926
|
+
```
|
|
5927
|
+
<a name="EVENT" id="EVENT"></a>
|
|
5928
|
+
|
|
5929
|
+
## EVENT : <code>enum</code>
|
|
5930
|
+
List of available event's name in the SRC checkout lifecycle
|
|
5931
|
+
|
|
5932
|
+
**Kind**: global enum
|
|
5933
|
+
|
|
5934
|
+
| Param | Type | Default |
|
|
5935
|
+
| --- | --- | --- |
|
|
5936
|
+
| CHECKOUT_BUTTON_LOADED | <code>string</code> | <code>"checkoutButtonLoaded"</code> |
|
|
5937
|
+
| CHECKOUT_BUTTON_CLICKED | <code>string</code> | <code>"checkoutButtonClicked"</code> |
|
|
5938
|
+
| IFRAME_LOADED | <code>string</code> | <code>"iframeLoaded"</code> |
|
|
5939
|
+
| CHECKOUT_READY | <code>string</code> | <code>"checkoutReady"</code> |
|
|
5940
|
+
| CHECKOUT_COMPLETED | <code>string</code> | <code>"checkoutCompleted"</code> |
|
|
5941
|
+
| CHECKOUT_ERROR | <code>string</code> | <code>"checkoutError"</code> |
|
|
5942
|
+
|
|
5943
|
+
|
|
5944
|
+
## Secure Remote Commerce
|
|
5945
|
+
You can find description of all methods and parameters [here](https://www.npmjs.com/package/@paydock/client-sdk#secure-remote-commerce)
|
|
5946
|
+
|
|
5947
|
+
This widget provides you with the ability to easily integrate with SRC providers. Currently Visa SRC is supported.
|
|
5948
|
+
|
|
5949
|
+
## SRC simple example
|
|
5950
|
+
|
|
5951
|
+
### Container
|
|
5952
|
+
|
|
5953
|
+
```html
|
|
5954
|
+
<div id="checkoutButton"></div>
|
|
5955
|
+
<div id="checkoutIframe"></div>
|
|
5956
|
+
```
|
|
5957
|
+
|
|
5958
|
+
You must create a container for the initial checkout button, and a different one for the checkout iFrame. Inside the first tag the button will be initialized, and inside the second one the iFrame will be loaded once the button is clicked.
|
|
5959
|
+
|
|
5960
|
+
|
|
5961
|
+
### Initialization
|
|
5962
|
+
```javascript
|
|
5963
|
+
var src = new paydock.SRC(
|
|
5964
|
+
"#checkoutButton",
|
|
5965
|
+
"#checkoutIframe",
|
|
5966
|
+
"scheme_service_id",
|
|
5967
|
+
"paydock_public_key",
|
|
5968
|
+
{}, // meta
|
|
5969
|
+
);
|
|
5970
|
+
src.load();
|
|
5971
|
+
```
|
|
5972
|
+
|
|
5973
|
+
```javascript--es2015
|
|
5974
|
+
// ES2015 | TypeScript
|
|
5975
|
+
|
|
5976
|
+
import { SRC } from '@paydock/client-sdk';
|
|
5977
|
+
|
|
5978
|
+
var src = new SRC(
|
|
5979
|
+
"#checkoutButton",
|
|
5980
|
+
"#checkoutIframe",
|
|
5981
|
+
"scheme_service_id",
|
|
5982
|
+
"paydock_public_key",
|
|
5983
|
+
{}, // meta
|
|
5984
|
+
);
|
|
5985
|
+
src.load();
|
|
5986
|
+
```
|
|
5987
|
+
|
|
5988
|
+
### Full example
|
|
5989
|
+
|
|
5990
|
+
```html
|
|
5991
|
+
<!DOCTYPE html>
|
|
5992
|
+
<html lang="en">
|
|
5993
|
+
<head>
|
|
5994
|
+
<meta charset="UTF-8">
|
|
5995
|
+
<title>Title</title>
|
|
5996
|
+
<style>iframe {border: 0;width: 40%;height: 300px;}</style>
|
|
5997
|
+
</head>
|
|
5998
|
+
<body>
|
|
5999
|
+
<div id="checkoutButton"></div>
|
|
6000
|
+
<div id="checkoutIframe"></div>
|
|
6001
|
+
<script src="https://app-sandbox.paydock.com/v1/widget.umd.js" ></script>
|
|
6002
|
+
<script>
|
|
6003
|
+
var src = new paydock.SRC(
|
|
6004
|
+
"#checkoutButton",
|
|
6005
|
+
"#checkoutIframe",
|
|
6006
|
+
"scheme_service_id",
|
|
6007
|
+
"paydock_public_key",
|
|
6008
|
+
{},
|
|
6009
|
+
);
|
|
6010
|
+
src.load();
|
|
6011
|
+
</script>
|
|
6012
|
+
</body>
|
|
6013
|
+
</html>
|
|
6014
|
+
```
|
|
6015
|
+
|
|
6016
|
+
|
|
6017
|
+
## SRC advanced example
|
|
6018
|
+
|
|
6019
|
+
### Settings
|
|
6020
|
+
|
|
6021
|
+
```javascript
|
|
6022
|
+
|
|
6023
|
+
src.setEnv('sandbox'); // set enviroment
|
|
6024
|
+
|
|
6025
|
+
src.hideButton(); // hide button
|
|
6026
|
+
|
|
6027
|
+
src.showButton(); // show button
|
|
6028
|
+
|
|
6029
|
+
src.hideCheckout(); // hide checkout iframe
|
|
6030
|
+
|
|
6031
|
+
src.showCheckout(); // show checkout iframe
|
|
6032
|
+
|
|
6033
|
+
src.on('checkoutButtonLoaded', () => {
|
|
6034
|
+
console.log("Button loaded");
|
|
6035
|
+
});
|
|
6036
|
+
|
|
6037
|
+
src.on('checkoutButtonClicked', () => {
|
|
6038
|
+
console.log("Button clicked");
|
|
6039
|
+
});
|
|
6040
|
+
|
|
6041
|
+
src.on('iframeLoaded', () => {
|
|
6042
|
+
console.log("Initial iframe loaded");
|
|
6043
|
+
});
|
|
6044
|
+
|
|
6045
|
+
src.on('checkoutReady', () => {
|
|
6046
|
+
console.log("Checkout ready to be used");
|
|
6047
|
+
});
|
|
6048
|
+
|
|
6049
|
+
src.on('checkoutCompleted', (token) => {
|
|
6050
|
+
console.log(token);
|
|
6051
|
+
});
|
|
6052
|
+
|
|
6053
|
+
src.on('checkoutError', (error) => {
|
|
6054
|
+
console.log(error);
|
|
6055
|
+
});
|
|
6056
|
+
```
|
|
6057
|
+
|
|
6058
|
+
Here you can see how you can use this methods to customize your checkout experience
|
|
6059
|
+
|
|
6060
|
+
### Full example
|
|
6061
|
+
|
|
6062
|
+
```html
|
|
6063
|
+
<!DOCTYPE html>
|
|
6064
|
+
<html lang="en">
|
|
6065
|
+
<head>
|
|
6066
|
+
<meta charset="UTF-8">
|
|
6067
|
+
<title>Title</title>
|
|
6068
|
+
<style>iframe {border: 0;width: 40%;height: 450px;}</style>
|
|
6069
|
+
</head>
|
|
6070
|
+
<body>
|
|
6071
|
+
<div id="checkoutButton"></div>
|
|
6072
|
+
<div id="checkoutIframe"></div>
|
|
6073
|
+
<script src="https://app-sandbox.paydock.com/v1/widget.umd.js" ></script>
|
|
6074
|
+
<script>
|
|
6075
|
+
var src = new paydock.SRC(
|
|
6076
|
+
"#checkoutButton",
|
|
6077
|
+
"#checkoutIframe",
|
|
6078
|
+
"scheme_service_id",
|
|
6079
|
+
"paydock_public_key",
|
|
6080
|
+
{},
|
|
6081
|
+
);
|
|
6082
|
+
|
|
6083
|
+
src.on('checkoutReady', () => {
|
|
6084
|
+
console.log("Checkout ready to be used");
|
|
6085
|
+
});
|
|
6086
|
+
|
|
6087
|
+
src.on('checkoutCompleted', (token) => {
|
|
6088
|
+
console.log(token);
|
|
6089
|
+
});
|
|
6090
|
+
src.load();
|
|
6091
|
+
</script>
|
|
6092
|
+
</body>
|
|
6093
|
+
</html>
|
|
6094
|
+
```
|
|
6095
|
+
|
|
6096
|
+
## Customization options for address fields
|
|
6097
|
+
### Shipping address:
|
|
6098
|
+
|
|
6099
|
+
To customize shipping address experience we use a flag that manages how VisaSRC requires or not shipping address to the customer. Options are NONE (default option), POSTAL_COUNTRY or ALL.
|
|
6100
|
+
|
|
6101
|
+
```
|
|
6102
|
+
var src = new paydock.SRC(
|
|
6103
|
+
"#checkoutButton",
|
|
6104
|
+
"#checkoutIframe",
|
|
6105
|
+
"scheme_service_id",
|
|
6106
|
+
"paydock_public_key",
|
|
6107
|
+
{
|
|
6108
|
+
"dpa_transaction_options": {
|
|
6109
|
+
"dpa_shipping_preference": "ALL"
|
|
6110
|
+
}
|
|
6111
|
+
},
|
|
6112
|
+
);
|
|
6113
|
+
```
|
|
6114
|
+
|
|
6115
|
+
With this the Visa popup requires the shipping address from consumer, and these information will be stored in the Paydock charge.
|
|
6116
|
+
|
|
6117
|
+
Another option is at time of creating the charge. Say that you have a different way of collecting the shipping address (outside Paydock checkout), you can then disable the shipping address on our SRC widget and send it when creating the charge creation after getting the One Time Token out of the SRC widget:
|
|
6118
|
+
|
|
6119
|
+
```
|
|
6120
|
+
POST v1/charges
|
|
6121
|
+
|
|
6122
|
+
{
|
|
6123
|
+
"amount": "10.00",
|
|
6124
|
+
"currency": "AUD",
|
|
6125
|
+
"token": "token",
|
|
6126
|
+
"customer": {
|
|
6127
|
+
"payment_source": {
|
|
6128
|
+
"gateway_id": "gateway_id"
|
|
6129
|
+
}
|
|
6130
|
+
},
|
|
6131
|
+
"shipping": {
|
|
6132
|
+
"address_line1": "address_line1",
|
|
6133
|
+
"address_line2": "address_line2",
|
|
6134
|
+
"address_line3": "address_line3",
|
|
6135
|
+
"address_city": "address_city",
|
|
6136
|
+
"address_postcode": "address_postcode",
|
|
6137
|
+
"address_state": "address_state",
|
|
6138
|
+
"address_country": "address_country"
|
|
6139
|
+
}
|
|
6140
|
+
}
|
|
6141
|
+
```
|
|
6142
|
+
|
|
6143
|
+
- Billing address:
|
|
6144
|
+
|
|
6145
|
+
Billing address fields are always present on the checkout and required when adding a new credit card (or for new consumer checkout). You can send billing fields on the meta data to pre-fill these fields inside the customer object:
|
|
6146
|
+
|
|
6147
|
+
```
|
|
6148
|
+
var src = new paydock.SRC(
|
|
6149
|
+
"#checkoutButton",
|
|
6150
|
+
"#checkoutIframe",
|
|
6151
|
+
"scheme_service_id",
|
|
6152
|
+
"paydock_public_key",
|
|
6153
|
+
{
|
|
6154
|
+
"customer": {
|
|
6155
|
+
"email": "test@email.com",
|
|
6156
|
+
"first_name": "Name",
|
|
6157
|
+
"last_name": "Surname",
|
|
6158
|
+
"phone": {
|
|
6159
|
+
"country_code": "1",
|
|
6160
|
+
"phone": "2124567890"
|
|
6161
|
+
},
|
|
6162
|
+
"payment_source": {
|
|
6163
|
+
"address_line1": "Line 1",
|
|
6164
|
+
"address_line2": "Line 2",
|
|
6165
|
+
"address_city": "Miami",
|
|
6166
|
+
"address_postcode": "33126",
|
|
6167
|
+
"address_state": "FL",
|
|
6168
|
+
"address_country": "US"
|
|
6169
|
+
}
|
|
6170
|
+
}
|
|
6171
|
+
},
|
|
6172
|
+
);
|
|
6173
|
+
```
|
|
6174
|
+
|
|
5699
6175
|
## License
|
|
5700
6176
|
Copyright (c) 2017 paydock
|