@paydock/client-sdk 1.139.0 → 1.140.1
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 +2543 -0
- package/bundles/index.cjs +1296 -508
- package/bundles/index.cjs.d.ts +1377 -200
- package/bundles/index.mjs +1295 -509
- package/bundles/index.mjs.d.ts +1377 -200
- package/bundles/types/checkout/checkout.d.ts.map +1 -1
- package/bundles/types/checkout/v1/instructions/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/v3/instructions/instruction.card_form.show.d.ts.map +1 -1
- package/bundles/types/checkout/v3/instructions/instruction.payment_methods.show.d.ts.map +1 -1
- package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts +1 -2
- package/bundles/types/checkout-button/zipmoney/zipmoney-contextual.runner.d.ts.map +1 -1
- package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts +70 -0
- package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts.map +1 -0
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +242 -74
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
- package/bundles/types/open-wallets/base/open-wallet.service.d.ts +62 -4
- package/bundles/types/open-wallets/base/open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/enum/error-operation.enum.d.ts +15 -0
- package/bundles/types/open-wallets/enum/error-operation.enum.d.ts.map +1 -0
- package/bundles/types/open-wallets/enum/event.enum.d.ts +11 -3
- package/bundles/types/open-wallets/enum/event.enum.d.ts.map +1 -1
- package/bundles/types/open-wallets/enum/token-type.enum.d.ts +10 -0
- package/bundles/types/open-wallets/enum/token-type.enum.d.ts.map +1 -0
- package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts +65 -0
- package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts.map +1 -0
- package/bundles/types/open-wallets/index.d.ts +293 -0
- package/bundles/types/open-wallets/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/events.interface.d.ts +87 -14
- package/bundles/types/open-wallets/interfaces/events.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts +6 -0
- package/bundles/types/open-wallets/interfaces/google-pay/google-pay-meta.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/index.d.ts +2 -2
- package/bundles/types/open-wallets/interfaces/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/open-wallet-meta.interface.d.ts +12 -0
- package/bundles/types/open-wallets/interfaces/open-wallet-meta.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts +28 -2
- package/bundles/types/open-wallets/interfaces/payment-source.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +27 -2
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/constants/google-pay.constants.d.ts +9 -0
- package/bundles/types/open-wallets/services/google-pay/constants/google-pay.constants.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts +20 -9
- package/bundles/types/open-wallets/services/google-pay/google-pay.open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/utils/google-pay.utils.d.ts +45 -0
- package/bundles/types/open-wallets/services/google-pay/utils/google-pay.utils.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/utils/index.d.ts +1 -1
- package/bundles/types/open-wallets/services/google-pay/utils/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/validation/google-pay.validation.d.ts +13 -0
- package/bundles/types/open-wallets/services/google-pay/validation/google-pay.validation.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/base-event-data.interface.d.ts +24 -2
- package/bundles/types/open-wallets/types/base-event-data.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/index.d.ts +2 -1
- package/bundles/types/open-wallets/types/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/on-shipping-address-change-event-data.interface.d.ts +16 -2
- package/bundles/types/open-wallets/types/on-shipping-address-change-event-data.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/on-shipping-address-change-event-response.interface.d.ts +20 -2
- package/bundles/types/open-wallets/types/on-shipping-address-change-event-response.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/on-shipping-option-change-event-data.interface.d.ts +13 -2
- package/bundles/types/open-wallets/types/on-shipping-option-change-event-data.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/on-shipping-option-change-event-response.interface.d.ts +12 -0
- package/bundles/types/open-wallets/types/on-shipping-option-change-event-response.interface.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/payment-source.type.d.ts +3 -2
- package/bundles/types/open-wallets/types/payment-source.type.d.ts.map +1 -1
- package/bundles/types/open-wallets/types/shipping-event-to-response.type.d.ts +8 -0
- package/bundles/types/open-wallets/types/shipping-event-to-response.type.d.ts.map +1 -1
- package/bundles/widget.umd.js +1296 -508
- package/bundles/widget.umd.js.d.ts +1377 -200
- package/bundles/widget.umd.js.min.d.ts +1377 -200
- package/bundles/widget.umd.min.js +1 -1
- package/docs/open-wallet-buttons-examples.md +523 -822
- package/docs/open-wallet-buttons.md +1652 -0
- package/package.json +1 -1
- package/slate.md +1643 -0
|
@@ -0,0 +1,1652 @@
|
|
|
1
|
+
## Classes
|
|
2
|
+
|
|
3
|
+
<dl>
|
|
4
|
+
<dt><a href="#ApplePayOpenWalletButton">ApplePayOpenWalletButton</a> ⇐ <code><a href="#OpenWalletButtons">OpenWalletButtons</a></code></dt>
|
|
5
|
+
<dd><p>Apple Pay wallet button that creates One-Time Tokens (OTT) via Apple Pay.</p>
|
|
6
|
+
<p>Provides a fully typed Apple Pay integration with Apple Pay-specific metadata
|
|
7
|
+
and validates that the service configuration corresponds to an Apple Pay service.
|
|
8
|
+
On <code>load()</code>, the button fetches the service configuration and raises an error via <code>onError</code>
|
|
9
|
+
if the service type does not match Apple Pay.</p>
|
|
10
|
+
</dd>
|
|
11
|
+
<dt><a href="#GooglePayOpenWalletButton">GooglePayOpenWalletButton</a> ⇐ <code><a href="#OpenWalletButtons">OpenWalletButtons</a></code></dt>
|
|
12
|
+
<dd><p>Google Pay wallet button that creates One-Time Tokens (OTT) via Google Pay.</p>
|
|
13
|
+
<p>Provides a fully typed Google Pay integration with Google Pay-specific metadata
|
|
14
|
+
and validates that the service configuration corresponds to a Google Pay service.
|
|
15
|
+
On <code>load()</code>, the button fetches the service configuration and raises an error via <code>onError</code>
|
|
16
|
+
if the service type does not match Google Pay.</p>
|
|
17
|
+
</dd>
|
|
18
|
+
<dt><a href="#OpenWalletButtons">OpenWalletButtons</a></dt>
|
|
19
|
+
<dd><p>Abstract base class for Open Wallet buttons. <strong>Do not instantiate directly.</strong>
|
|
20
|
+
Use <a href="#ApplePayOpenWalletButton">ApplePayOpenWalletButton</a> or <a href="#GooglePayOpenWalletButton">GooglePayOpenWalletButton</a> instead.</p>
|
|
21
|
+
<p>Use one of the concrete implementations instead:</p>
|
|
22
|
+
<ul>
|
|
23
|
+
<li><a href="#ApplePayOpenWalletButton">ApplePayOpenWalletButton</a> for Apple Pay integration</li>
|
|
24
|
+
<li><a href="#GooglePayOpenWalletButton">GooglePayOpenWalletButton</a> for Google Pay integration</li>
|
|
25
|
+
</ul>
|
|
26
|
+
<p>These subclasses inherit all event handlers and lifecycle methods documented below.</p>
|
|
27
|
+
</dd>
|
|
28
|
+
</dl>
|
|
29
|
+
|
|
30
|
+
## Constants
|
|
31
|
+
|
|
32
|
+
<dl>
|
|
33
|
+
<dt><a href="#EVENT">EVENT</a> : <code>object</code></dt>
|
|
34
|
+
<dd><p>List of available event names in the Open Wallet button lifecycle.</p>
|
|
35
|
+
</dd>
|
|
36
|
+
<dt><a href="#WALLET_TYPES">WALLET_TYPES</a> : <code>object</code></dt>
|
|
37
|
+
<dd><p>Enum of available wallet types.</p>
|
|
38
|
+
</dd>
|
|
39
|
+
<dt><a href="#TOKEN_TYPE">TOKEN_TYPE</a> : <code>object</code></dt>
|
|
40
|
+
<dd><p>Token types returned in the OTT (One-Time Token) creation response.</p>
|
|
41
|
+
</dd>
|
|
42
|
+
<dt><a href="#ERROR_OPERATION">ERROR_OPERATION</a> : <code>object</code></dt>
|
|
43
|
+
<dd><p>Operations that can fail during the wallet lifecycle.
|
|
44
|
+
Used in the <code>context.operation</code> field of <a href="#OnErrorEventData">OnErrorEventData</a>.</p>
|
|
45
|
+
</dd>
|
|
46
|
+
</dl>
|
|
47
|
+
|
|
48
|
+
## Typedefs
|
|
49
|
+
|
|
50
|
+
<dl>
|
|
51
|
+
<dt><a href="#OnClickCallback">OnClickCallback</a> ⇒ <code>boolean</code> | <code>void</code> | <code>Promise.<(boolean|void)></code></dt>
|
|
52
|
+
<dd><p>Callback for onClick method.</p>
|
|
53
|
+
</dd>
|
|
54
|
+
<dt><a href="#OnSuccessCallback">OnSuccessCallback</a> : <code>function</code></dt>
|
|
55
|
+
<dd><p>Callback for onSuccess method.</p>
|
|
56
|
+
</dd>
|
|
57
|
+
<dt><a href="#OnUnavailableCallback">OnUnavailableCallback</a> : <code>function</code></dt>
|
|
58
|
+
<dd><p>Callback for onUnavailable method.</p>
|
|
59
|
+
</dd>
|
|
60
|
+
<dt><a href="#OnErrorCallback">OnErrorCallback</a> : <code>function</code></dt>
|
|
61
|
+
<dd><p>Callback for onError method.</p>
|
|
62
|
+
</dd>
|
|
63
|
+
<dt><a href="#OnCancelCallback">OnCancelCallback</a> : <code>function</code></dt>
|
|
64
|
+
<dd><p>Callback for onCancel method.</p>
|
|
65
|
+
</dd>
|
|
66
|
+
<dt><a href="#OnShippingAddressChangeCallback">OnShippingAddressChangeCallback</a> ⇒ <code><a href="#OnShippingAddressChangeEventResponse">OnShippingAddressChangeEventResponse</a></code> | <code><a href="#OnShippingAddressChangeEventResponse">Promise.<OnShippingAddressChangeEventResponse></a></code></dt>
|
|
67
|
+
<dd><p>Callback for onShippingAddressChange method.</p>
|
|
68
|
+
</dd>
|
|
69
|
+
<dt><a href="#OnShippingOptionsChangeCallback">OnShippingOptionsChangeCallback</a> ⇒ <code><a href="#OnShippingOptionChangeEventResponse">OnShippingOptionChangeEventResponse</a></code> | <code><a href="#OnShippingOptionChangeEventResponse">Promise.<OnShippingOptionChangeEventResponse></a></code></dt>
|
|
70
|
+
<dd><p>Callback for onShippingOptionsChange method.</p>
|
|
71
|
+
</dd>
|
|
72
|
+
</dl>
|
|
73
|
+
|
|
74
|
+
## Interfaces
|
|
75
|
+
|
|
76
|
+
<dl>
|
|
77
|
+
<dt><a href="#ApplePayOpenWalletMeta">ApplePayOpenWalletMeta</a> : <code>object</code></dt>
|
|
78
|
+
<dd><p>Interface for Apple Pay-specific metadata.</p>
|
|
79
|
+
<p>For further information about ApplePay Capabilities refer to <a href="https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/4440085-applepaycapabilities">the documentation</a>.
|
|
80
|
+
Apple will determine if the device has an ApplePay wallet available and at least one active payment.</p>
|
|
81
|
+
</dd>
|
|
82
|
+
<dt><a href="#GooglePayOpenWalletMeta">GooglePayOpenWalletMeta</a> : <code>object</code></dt>
|
|
83
|
+
<dd><p>Interface for Google Pay-specific metadata.</p>
|
|
84
|
+
</dd>
|
|
85
|
+
<dt><a href="#OnClickEventData">OnClickEventData</a> : <code>object</code></dt>
|
|
86
|
+
<dd><p>Interface for OnClickEventData.
|
|
87
|
+
Emitted when the wallet button is clicked.</p>
|
|
88
|
+
<p>The merchant's <code>onClick</code> handler controls the payment flow via its return value:</p>
|
|
89
|
+
<ul>
|
|
90
|
+
<li>Return <code>void</code> / <code>undefined</code> to continue normally.</li>
|
|
91
|
+
<li>Return <code>false</code> to abort the payment flow.</li>
|
|
92
|
+
<li>Return a <code>Promise<void></code> to defer the wallet sheet until the promise resolves.</li>
|
|
93
|
+
<li>Return a <code>Promise<boolean></code> — if it resolves to <code>false</code>, the flow is aborted.</li>
|
|
94
|
+
<li>Throwing an error (sync or async) also aborts the flow.</li>
|
|
95
|
+
</ul>
|
|
96
|
+
</dd>
|
|
97
|
+
<dt><a href="#OnCreateOTTSuccessfulEventData">OnCreateOTTSuccessfulEventData</a> : <code>object</code></dt>
|
|
98
|
+
<dd><p>Interface for OnCreateOTTSuccessfulEventData.
|
|
99
|
+
Emitted when the One-Time Token is successfully created.</p>
|
|
100
|
+
</dd>
|
|
101
|
+
<dt><a href="#OnCreateOTTErrorEventData">OnCreateOTTErrorEventData</a> : <code>object</code></dt>
|
|
102
|
+
<dd><p>Interface for OnCreateOTTErrorEventData.
|
|
103
|
+
Emitted when OTT creation fails. The error details are in the <code>data</code> payload.</p>
|
|
104
|
+
</dd>
|
|
105
|
+
<dt><a href="#OnUnavailableEventData">OnUnavailableEventData</a> : <code>object</code></dt>
|
|
106
|
+
<dd><p>Interface for OnUnavailableEventData.
|
|
107
|
+
Emitted when the wallet is not available on the current device or browser.</p>
|
|
108
|
+
</dd>
|
|
109
|
+
<dt><a href="#OnErrorEventData">OnErrorEventData</a> : <code>object</code></dt>
|
|
110
|
+
<dd><p>Interface for OnErrorEventData.
|
|
111
|
+
Emitted when an error occurs during wallet operation, including configuration issues, service type mismatches, and OTT creation failures.</p>
|
|
112
|
+
</dd>
|
|
113
|
+
<dt><a href="#OnLoadedEventData">OnLoadedEventData</a> : <code>object</code></dt>
|
|
114
|
+
<dd><p>Interface for OnLoadedEventData.
|
|
115
|
+
Emitted when the wallet button has been loaded and rendered in the DOM.
|
|
116
|
+
No payload — the specific wallet type is determined by the concrete button class
|
|
117
|
+
(<a href="#ApplePayOpenWalletButton">ApplePayOpenWalletButton</a> or <a href="#GooglePayOpenWalletButton">GooglePayOpenWalletButton</a>).</p>
|
|
118
|
+
</dd>
|
|
119
|
+
<dt><a href="#OnCancelEventData">OnCancelEventData</a> : <code>object</code></dt>
|
|
120
|
+
<dd><p>Interface for OnCancelEventData.
|
|
121
|
+
Emitted when the wallet checkout is cancelled or closed by the user. No payload data.</p>
|
|
122
|
+
</dd>
|
|
123
|
+
<dt><a href="#OnShippingAddressChangeEventData">OnShippingAddressChangeEventData</a> : <code>object</code></dt>
|
|
124
|
+
<dd><p>Interface for OnShippingAddressChangeEventData.
|
|
125
|
+
Emitted when the customer selects or updates their shipping address in the wallet payment sheet.
|
|
126
|
+
This event is also emitted when the payment sheet first opens (INITIALIZE) with the initial shipping address, if present in the User's wallet.</p>
|
|
127
|
+
<p>If no handler is registered for this event, the SDK auto-accepts with the current transaction data.</p>
|
|
128
|
+
</dd>
|
|
129
|
+
<dt><a href="#OnShippingAddressChangeEventResponse">OnShippingAddressChangeEventResponse</a> : <code>object</code></dt>
|
|
130
|
+
<dd><p>Interface for OnShippingAddressChangeEventResponse.
|
|
131
|
+
Returned by the merchant's <code>onShippingAddressChange</code> handler.</p>
|
|
132
|
+
</dd>
|
|
133
|
+
<dt><a href="#OnShippingOptionChangeEventData">OnShippingOptionChangeEventData</a> : <code>object</code></dt>
|
|
134
|
+
<dd><p>Interface for OnShippingOptionChangeEventData.
|
|
135
|
+
Emitted when the customer selects a shipping option in the wallet payment sheet.</p>
|
|
136
|
+
<p>If no handler is registered for this event, the SDK auto-accepts with the current transaction data.</p>
|
|
137
|
+
</dd>
|
|
138
|
+
<dt><a href="#OnShippingOptionChangeEventResponse">OnShippingOptionChangeEventResponse</a> : <code>object</code></dt>
|
|
139
|
+
<dd><p>Interface for OnShippingOptionChangeEventResponse.
|
|
140
|
+
Returned by the merchant's <code>onShippingOptionsChange</code> handler.</p>
|
|
141
|
+
</dd>
|
|
142
|
+
<dt><a href="#IApplePayShippingOption">IApplePayShippingOption</a> : <code>object</code></dt>
|
|
143
|
+
<dd><p>Interface for IApplePayShippingOption.
|
|
144
|
+
Used for shipping options in Apple Pay wallets.</p>
|
|
145
|
+
</dd>
|
|
146
|
+
<dt><a href="#IGooglePayShippingOption">IGooglePayShippingOption</a> : <code>object</code></dt>
|
|
147
|
+
<dd><p>Interface for IGooglePayShippingOption.
|
|
148
|
+
Used for shipping options in Google Pay wallets.</p>
|
|
149
|
+
</dd>
|
|
150
|
+
</dl>
|
|
151
|
+
|
|
152
|
+
<a name="ApplePayOpenWalletMeta" id="ApplePayOpenWalletMeta" href="#ApplePayOpenWalletMeta"> </a>
|
|
153
|
+
|
|
154
|
+
## ApplePayOpenWalletMeta : <code>object</code>
|
|
155
|
+
Interface for Apple Pay-specific metadata.
|
|
156
|
+
|
|
157
|
+
For further information about ApplePay Capabilities refer to [the documentation](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaysession/4440085-applepaycapabilities).
|
|
158
|
+
Apple will determine if the device has an ApplePay wallet available and at least one active payment.
|
|
159
|
+
|
|
160
|
+
**Kind**: global interface
|
|
161
|
+
|
|
162
|
+
| Param | Type | Description |
|
|
163
|
+
| --- | --- | --- |
|
|
164
|
+
| amount | <code>number</code> | The payment amount. |
|
|
165
|
+
| currency | <code>string</code> | The ISO 4217 currency code. |
|
|
166
|
+
| country | <code>string</code> | The ISO 3166-1 alpha-2 country code. |
|
|
167
|
+
| amount_label | <code>string</code> | Label shown next to the total amount (e.g. `'TOTAL'`). Used in the Apple Pay payment sheet. |
|
|
168
|
+
| [request_shipping] | <code>boolean</code> | Enable shipping address collection in the Apple Pay sheet. |
|
|
169
|
+
| [shipping_options] | [<code>Array.<IApplePayShippingOption></code>](#IApplePayShippingOption) | Array of available shipping options. The first item is used as the default selected option. Requires `request_shipping` to be `true`. |
|
|
170
|
+
| [show_billing_address] | <code>boolean</code> | Show billing address fields in the Apple Pay sheet. |
|
|
171
|
+
| store_name | <code>string</code> | The merchant's store name displayed during payment. |
|
|
172
|
+
| [apple_pay_capabilities] | <code>Array.<('credentials\_available'\|'credentials\_status\_unknown'\|'credentials\_unavailable')></code> | Device capabilities needed for the wallet button to be available. |
|
|
173
|
+
| [merchant_capabilities] | <code>Array.<('supports3DS'\|'supportsEMV'\|'supportsCredit'\|'supportsDebit')></code> | Array of merchant capabilities influencing the transaction processing features available. |
|
|
174
|
+
| [supported_networks] | <code>Array.<('visa'\|'masterCard'\|'amex'\|'chinaUnionPay'\|'discover'\|'interac'\|'jcb'\|'privateLabel')></code> | List of payment networks supported for Apple Pay transactions. |
|
|
175
|
+
| [required_billing_contact_fields] | <code>Array.<('email'\|'name'\|'phone'\|'postalAddress')></code> | Contact fields required from the user for billing purposes. Phone and email are currently not returned by Apple. |
|
|
176
|
+
| [required_shipping_contact_fields] | <code>Array.<('email'\|'phone'\|'postalAddress'\|'name')></code> | Shipping contact fields required to complete the transaction. Include `'postalAddress'` to show address fields in the Apple Pay sheet. Required handling of onShippingAddressChange callback. |
|
|
177
|
+
| [supported_countries] | <code>Array.<string></code> | List of countries where Apple Pay is supported by the merchant. |
|
|
178
|
+
| [shipping_editing_mode] | <code>'available'</code> \| <code>'store\_pickup'</code> | `'available'` for editable shipping, `'store_pickup'` for non-editable. |
|
|
179
|
+
| [style] | <code>object</code> | Styling configuration for the Apple Pay button. |
|
|
180
|
+
| [style.button_type] | <code>ApplePayButtonType</code> | The type of Apple Pay button (e.g. `'buy'`, `'donate'`, `'plain'`). |
|
|
181
|
+
| [style.button_style] | <code>ApplePayButtonStyle</code> | The style of the Apple Pay button (`'black'`, `'white'`, `'white-outline'`). |
|
|
182
|
+
|
|
183
|
+
<a name="GooglePayOpenWalletMeta" id="GooglePayOpenWalletMeta" href="#GooglePayOpenWalletMeta"> </a>
|
|
184
|
+
|
|
185
|
+
## GooglePayOpenWalletMeta : <code>object</code>
|
|
186
|
+
Interface for Google Pay-specific metadata.
|
|
187
|
+
|
|
188
|
+
**Kind**: global interface
|
|
189
|
+
|
|
190
|
+
| Param | Type | Description |
|
|
191
|
+
| --- | --- | --- |
|
|
192
|
+
| amount | <code>number</code> | The payment amount. |
|
|
193
|
+
| currency | <code>string</code> | The ISO 4217 currency code. |
|
|
194
|
+
| country | <code>string</code> | The ISO 3166-1 alpha-2 country code. |
|
|
195
|
+
| [amount_label] | <code>string</code> | Label shown next to the total amount. |
|
|
196
|
+
| [merchant_name] | <code>string</code> | Display name for the merchant in the Google Pay sheet. |
|
|
197
|
+
| [request_shipping] | <code>boolean</code> | Enable shipping address collection. |
|
|
198
|
+
| [shipping_options] | [<code>Array.<IGooglePayShippingOption></code>](#IGooglePayShippingOption) | Array of available shipping options. The first item is used as the default selected option. Requires `request_shipping` to be `true`. |
|
|
199
|
+
| [show_billing_address] | <code>boolean</code> | Show billing address fields. |
|
|
200
|
+
| [card_config] | <code>object</code> | Google Pay card configuration for custom auth methods, card networks, and tokenization. |
|
|
201
|
+
| [style] | <code>object</code> | Styling configuration for the Google Pay button. |
|
|
202
|
+
| [style.button_type] | <code>GooglePayButtonType</code> | The type of Google Pay button (`'book'`, `'buy'`, `'checkout'`, `'donate'`, `'order'`, `'pay'`, `'plain'`, `'subscribe'`). |
|
|
203
|
+
| [style.button_color] | <code>GooglePayButtonColor</code> | The color of the Google Pay button (`'default'`, `'black'`, `'white'`). |
|
|
204
|
+
| [style.button_size_mode] | <code>GooglePayButtonSizeMode</code> | The size mode (`'static'`, `'fill'`). |
|
|
205
|
+
|
|
206
|
+
<a name="OnClickEventData" id="OnClickEventData" href="#OnClickEventData"> </a>
|
|
207
|
+
|
|
208
|
+
## OnClickEventData : <code>object</code>
|
|
209
|
+
Interface for OnClickEventData.
|
|
210
|
+
Emitted when the wallet button is clicked.
|
|
211
|
+
|
|
212
|
+
The merchant's `onClick` handler controls the payment flow via its return value:
|
|
213
|
+
- Return `void` / `undefined` to continue normally.
|
|
214
|
+
- Return `false` to abort the payment flow.
|
|
215
|
+
- Return a `Promise<void>` to defer the wallet sheet until the promise resolves.
|
|
216
|
+
- Return a `Promise<boolean>` — if it resolves to `false`, the flow is aborted.
|
|
217
|
+
- Throwing an error (sync or async) also aborts the flow.
|
|
218
|
+
|
|
219
|
+
**Kind**: global interface
|
|
220
|
+
|
|
221
|
+
| Param | Type | Description |
|
|
222
|
+
| --- | --- | --- |
|
|
223
|
+
| event | <code>string</code> | Always `'onClick'`. |
|
|
224
|
+
|
|
225
|
+
<a name="OnCreateOTTSuccessfulEventData" id="OnCreateOTTSuccessfulEventData" href="#OnCreateOTTSuccessfulEventData"> </a>
|
|
226
|
+
|
|
227
|
+
## OnCreateOTTSuccessfulEventData : <code>object</code>
|
|
228
|
+
Interface for OnCreateOTTSuccessfulEventData.
|
|
229
|
+
Emitted when the One-Time Token is successfully created.
|
|
230
|
+
|
|
231
|
+
**Kind**: global interface
|
|
232
|
+
|
|
233
|
+
| Param | Type | Description |
|
|
234
|
+
| --- | --- | --- |
|
|
235
|
+
| event | <code>string</code> | Always `'success'`. |
|
|
236
|
+
| [data] | <code>object</code> | OTT success payload. |
|
|
237
|
+
| data.token | <code>object</code> | The created OTT response. |
|
|
238
|
+
| data.token.temp_token | <code>string</code> | The temporary one-time token string. |
|
|
239
|
+
| data.token.token_type | [<code>TOKEN\_TYPE</code>](#TOKEN_TYPE) | The type of the token. `TOKEN_TYPE.CARD` for FPAN (Google Pay only), `TOKEN_TYPE.CARD_SCHEME_TOKEN` for DPAN (Apple Pay & Google Pay). |
|
|
240
|
+
| data.amount | <code>number</code> | The payment amount. |
|
|
241
|
+
| [data.shipping] | <code>object</code> | The shipping address and contact information, if provided. |
|
|
242
|
+
| [data.shipping.method] | <code>string</code> | The shipping method. |
|
|
243
|
+
| [data.shipping.options] | <code>Array.<(IApplePayShippingOption\|IGooglePayShippingOption)></code> | The selected shipping options. |
|
|
244
|
+
| [data.shipping.address_line1] | <code>string</code> | Shipping address line 1. |
|
|
245
|
+
| [data.shipping.address_line2] | <code>string</code> | Shipping address line 2. |
|
|
246
|
+
| [data.shipping.address_city] | <code>string</code> | Shipping address city. |
|
|
247
|
+
| [data.shipping.address_postcode] | <code>string</code> | Shipping address postal code. |
|
|
248
|
+
| [data.shipping.address_state] | <code>string</code> | Shipping address state or province. |
|
|
249
|
+
| [data.shipping.address_country] | <code>string</code> | Shipping address country code. |
|
|
250
|
+
| [data.shipping.address_company] | <code>string</code> | Shipping company name. |
|
|
251
|
+
| [data.shipping.address_origin_postcode] | <code>string</code> | Origin postal code. |
|
|
252
|
+
| [data.shipping.contact] | <code>object</code> | Shipping contact information. |
|
|
253
|
+
| [data.shipping.contact.first_name] | <code>string</code> | Contact first name. |
|
|
254
|
+
| [data.shipping.contact.last_name] | <code>string</code> | Contact last name. |
|
|
255
|
+
| [data.shipping.contact.email] | <code>string</code> | Contact email address. |
|
|
256
|
+
| [data.shipping.contact.phone] | <code>string</code> | Contact phone number. |
|
|
257
|
+
| [data.shipping.contact.phone2] | <code>string</code> | Contact secondary phone number. |
|
|
258
|
+
| [data.billing] | <code>object</code> | The billing address, if provided. |
|
|
259
|
+
| data.billing.address_line1 | <code>string</code> | Billing address line 1. |
|
|
260
|
+
| data.billing.address_line2 | <code>string</code> | Billing address line 2. |
|
|
261
|
+
| data.billing.address_country | <code>string</code> | Billing address country code. |
|
|
262
|
+
| data.billing.address_city | <code>string</code> | Billing address city. |
|
|
263
|
+
| data.billing.address_postcode | <code>string</code> | Billing address postal code. |
|
|
264
|
+
| data.billing.address_state | <code>string</code> | Billing address state or province. |
|
|
265
|
+
|
|
266
|
+
<a name="OnCreateOTTErrorEventData" id="OnCreateOTTErrorEventData" href="#OnCreateOTTErrorEventData"> </a>
|
|
267
|
+
|
|
268
|
+
## OnCreateOTTErrorEventData : <code>object</code>
|
|
269
|
+
Interface for OnCreateOTTErrorEventData.
|
|
270
|
+
Emitted when OTT creation fails. The error details are in the `data` payload.
|
|
271
|
+
|
|
272
|
+
**Kind**: global interface
|
|
273
|
+
|
|
274
|
+
| Param | Type | Description |
|
|
275
|
+
| --- | --- | --- |
|
|
276
|
+
| event | <code>string</code> | Always `'error'`. |
|
|
277
|
+
| [data] | <code>object</code> | Error details payload. |
|
|
278
|
+
| [data.message] | <code>string</code> | Error message. |
|
|
279
|
+
| [data.code] | <code>string</code> | Error code. |
|
|
280
|
+
|
|
281
|
+
<a name="OnUnavailableEventData" id="OnUnavailableEventData" href="#OnUnavailableEventData"> </a>
|
|
282
|
+
|
|
283
|
+
## OnUnavailableEventData : <code>object</code>
|
|
284
|
+
Interface for OnUnavailableEventData.
|
|
285
|
+
Emitted when the wallet is not available on the current device or browser.
|
|
286
|
+
|
|
287
|
+
**Kind**: global interface
|
|
288
|
+
|
|
289
|
+
| Param | Type | Description |
|
|
290
|
+
| --- | --- | --- |
|
|
291
|
+
| event | <code>string</code> | Always `'unavailable'`. |
|
|
292
|
+
| [data] | <code>object</code> | Unavailability details payload. |
|
|
293
|
+
| data.reason | <code>string</code> | A human-readable reason why the wallet is unavailable. |
|
|
294
|
+
| [data.details] | <code>object</code> | Additional details about the unavailability. |
|
|
295
|
+
| data.details.service_id | <code>string</code> | The service ID that was checked. |
|
|
296
|
+
|
|
297
|
+
<a name="OnErrorEventData" id="OnErrorEventData" href="#OnErrorEventData"> </a>
|
|
298
|
+
|
|
299
|
+
## OnErrorEventData : <code>object</code>
|
|
300
|
+
Interface for OnErrorEventData.
|
|
301
|
+
Emitted when an error occurs during wallet operation, including configuration issues, service type mismatches, and OTT creation failures.
|
|
302
|
+
|
|
303
|
+
**Kind**: global interface
|
|
304
|
+
|
|
305
|
+
| Param | Type | Description |
|
|
306
|
+
| --- | --- | --- |
|
|
307
|
+
| event | <code>string</code> | Always `'error'`. |
|
|
308
|
+
| [data] | <code>object</code> | Error payload. |
|
|
309
|
+
| data.error | <code>Error</code> | The Error object describing what went wrong. |
|
|
310
|
+
| [data.context] | <code>object</code> | Context about the error. |
|
|
311
|
+
| [data.context.operation] | [<code>ERROR\_OPERATION</code>](#ERROR_OPERATION) | The operation that failed. See [ERROR_OPERATION](#ERROR_OPERATION) enum for possible values. |
|
|
312
|
+
|
|
313
|
+
<a name="OnLoadedEventData" id="OnLoadedEventData" href="#OnLoadedEventData"> </a>
|
|
314
|
+
|
|
315
|
+
## OnLoadedEventData : <code>object</code>
|
|
316
|
+
Interface for OnLoadedEventData.
|
|
317
|
+
Emitted when the wallet button has been loaded and rendered in the DOM.
|
|
318
|
+
No payload — the specific wallet type is determined by the concrete button class
|
|
319
|
+
([ApplePayOpenWalletButton](#ApplePayOpenWalletButton) or [GooglePayOpenWalletButton](#GooglePayOpenWalletButton)).
|
|
320
|
+
|
|
321
|
+
**Kind**: global interface
|
|
322
|
+
|
|
323
|
+
| Param | Type | Description |
|
|
324
|
+
| --- | --- | --- |
|
|
325
|
+
| event | <code>string</code> | Always `'loaded'`. |
|
|
326
|
+
|
|
327
|
+
<a name="OnCancelEventData" id="OnCancelEventData" href="#OnCancelEventData"> </a>
|
|
328
|
+
|
|
329
|
+
## OnCancelEventData : <code>object</code>
|
|
330
|
+
Interface for OnCancelEventData.
|
|
331
|
+
Emitted when the wallet checkout is cancelled or closed by the user. No payload data.
|
|
332
|
+
|
|
333
|
+
**Kind**: global interface
|
|
334
|
+
|
|
335
|
+
| Param | Type | Description |
|
|
336
|
+
| --- | --- | --- |
|
|
337
|
+
| event | <code>string</code> | Always `'checkoutClose'`. |
|
|
338
|
+
|
|
339
|
+
<a name="OnShippingAddressChangeEventData" id="OnShippingAddressChangeEventData" href="#OnShippingAddressChangeEventData"> </a>
|
|
340
|
+
|
|
341
|
+
## OnShippingAddressChangeEventData : <code>object</code>
|
|
342
|
+
Interface for OnShippingAddressChangeEventData.
|
|
343
|
+
Emitted when the customer selects or updates their shipping address in the wallet payment sheet.
|
|
344
|
+
This event is also emitted when the payment sheet first opens (INITIALIZE) with the initial shipping address, if present in the User's wallet.
|
|
345
|
+
|
|
346
|
+
If no handler is registered for this event, the SDK auto-accepts with the current transaction data.
|
|
347
|
+
|
|
348
|
+
**Kind**: global interface
|
|
349
|
+
|
|
350
|
+
| Param | Type | Description |
|
|
351
|
+
| --- | --- | --- |
|
|
352
|
+
| event | <code>string</code> | Always `'onShippingAddressChange'`. |
|
|
353
|
+
| [data] | <code>object</code> | Shipping address data. |
|
|
354
|
+
| [data.address_city] | <code>string</code> | Shipping address city. |
|
|
355
|
+
| [data.address_state] | <code>string</code> | Shipping address state. |
|
|
356
|
+
| [data.address_postcode] | <code>string</code> | Shipping address postal code. |
|
|
357
|
+
| [data.address_country] | <code>string</code> | Shipping address country code. |
|
|
358
|
+
| [data.address_line1] | <code>string</code> | Apple Pay only - Shipping address line 1. |
|
|
359
|
+
| [data.address_line2] | <code>string</code> | Apple Pay only - Shipping address line 2. |
|
|
360
|
+
| [data.contact.phone] | <code>string</code> | Apple Pay only - Shipping contact phone. |
|
|
361
|
+
| [data.contact.email] | <code>string</code> | Apple Pay only - Shipping contact email. |
|
|
362
|
+
| [data.contact.first_name] | <code>string</code> | Apple Pay only - Shipping contact first name. |
|
|
363
|
+
| [data.contact.last_name] | <code>string</code> | Apple Pay only - Shipping contact last name. |
|
|
364
|
+
|
|
365
|
+
<a name="OnShippingAddressChangeEventResponse" id="OnShippingAddressChangeEventResponse" href="#OnShippingAddressChangeEventResponse"> </a>
|
|
366
|
+
|
|
367
|
+
## OnShippingAddressChangeEventResponse : <code>object</code>
|
|
368
|
+
Interface for OnShippingAddressChangeEventResponse.
|
|
369
|
+
Returned by the merchant's `onShippingAddressChange` handler.
|
|
370
|
+
|
|
371
|
+
**Kind**: global interface
|
|
372
|
+
|
|
373
|
+
| Param | Type | Description |
|
|
374
|
+
| --- | --- | --- |
|
|
375
|
+
| [amount] | <code>number</code> | Updated payment amount based on the new shipping address. |
|
|
376
|
+
| [shipping_options] | <code>Array.<(IApplePayShippingOption\|IGooglePayShippingOption)></code> | Updated list of available shipping options. The first item is used as the default selected option. |
|
|
377
|
+
| [error] | <code>object</code> | Error object to display in the wallet payment sheet if the address is invalid. |
|
|
378
|
+
| error.code | <code>string</code> | Error code. Possible values: `'address_error'`, `'country_error'`, `'state_error'`, `'zip_error'`, `'shipping_contact_invalid'`, `'billing_contact_invalid'`. |
|
|
379
|
+
| [error.field] | <code>string</code> | Apple Pay only - The specific field that caused the error. Possible values: `'phone'`, `'email'`, `'name'`, `'phonetic_name'`, `'address_lines'`, `'locality'`, `'postal_code'`, `'administrative_area'`, `'country'`, `'country_code'`. |
|
|
380
|
+
| [error.message] | <code>string</code> | A human-readable error message to display to the customer. |
|
|
381
|
+
|
|
382
|
+
<a name="OnShippingOptionChangeEventData" id="OnShippingOptionChangeEventData" href="#OnShippingOptionChangeEventData"> </a>
|
|
383
|
+
|
|
384
|
+
## OnShippingOptionChangeEventData : <code>object</code>
|
|
385
|
+
Interface for OnShippingOptionChangeEventData.
|
|
386
|
+
Emitted when the customer selects a shipping option in the wallet payment sheet.
|
|
387
|
+
|
|
388
|
+
If no handler is registered for this event, the SDK auto-accepts with the current transaction data.
|
|
389
|
+
|
|
390
|
+
**Kind**: global interface
|
|
391
|
+
|
|
392
|
+
| Param | Type | Description |
|
|
393
|
+
| --- | --- | --- |
|
|
394
|
+
| event | <code>string</code> | Always `'onShippingOptionsChange'`. |
|
|
395
|
+
| [data] | <code>object</code> | Shipping option data. |
|
|
396
|
+
| [data.shipping_option_id] | <code>string</code> | Selected shipping option ID. |
|
|
397
|
+
| [data.label] | <code>string</code> | Selected shipping option label. |
|
|
398
|
+
| [data.detail] | <code>string</code> | Selected shipping option detail. |
|
|
399
|
+
| [data.amount] | <code>string</code> | Apple Pay only - Selected shipping option amount. |
|
|
400
|
+
|
|
401
|
+
<a name="OnShippingOptionChangeEventResponse" id="OnShippingOptionChangeEventResponse" href="#OnShippingOptionChangeEventResponse"> </a>
|
|
402
|
+
|
|
403
|
+
## OnShippingOptionChangeEventResponse : <code>object</code>
|
|
404
|
+
Interface for OnShippingOptionChangeEventResponse.
|
|
405
|
+
Returned by the merchant's `onShippingOptionsChange` handler.
|
|
406
|
+
|
|
407
|
+
**Kind**: global interface
|
|
408
|
+
|
|
409
|
+
| Param | Type | Description |
|
|
410
|
+
| --- | --- | --- |
|
|
411
|
+
| [amount] | <code>number</code> | Updated total payment amount based on the selected shipping option. |
|
|
412
|
+
| [error] | <code>object</code> | Error object to display if the shipping option is invalid. |
|
|
413
|
+
| error.code | <code>string</code> | Error code. Possible values: `'method_unavailable'`, `'store_unavailable'`. |
|
|
414
|
+
| [error.message] | <code>string</code> | A human-readable error message. |
|
|
415
|
+
|
|
416
|
+
<a name="IApplePayShippingOption" id="IApplePayShippingOption" href="#IApplePayShippingOption"> </a>
|
|
417
|
+
|
|
418
|
+
## IApplePayShippingOption : <code>object</code>
|
|
419
|
+
Interface for IApplePayShippingOption.
|
|
420
|
+
Used for shipping options in Apple Pay wallets.
|
|
421
|
+
|
|
422
|
+
**Kind**: global interface
|
|
423
|
+
|
|
424
|
+
| Param | Type | Description |
|
|
425
|
+
| --- | --- | --- |
|
|
426
|
+
| id | <code>string</code> | Unique identifier for the shipping option. |
|
|
427
|
+
| label | <code>string</code> | Display name for the shipping option. |
|
|
428
|
+
| amount | <code>number</code> | Shipping cost amount. |
|
|
429
|
+
| [detail] | <code>string</code> | Optional description or detail text. |
|
|
430
|
+
| [date_components_range] | <code>object</code> | Apple Pay only - Delivery date range estimate. |
|
|
431
|
+
| [date_components_range.start_date_components] | <code>object</code> | Start date for the delivery estimate. |
|
|
432
|
+
| [date_components_range.start_date_components.years] | <code>number</code> | Years from now. |
|
|
433
|
+
| [date_components_range.start_date_components.months] | <code>number</code> | Months from now. |
|
|
434
|
+
| [date_components_range.start_date_components.days] | <code>number</code> | Days from now. |
|
|
435
|
+
| [date_components_range.start_date_components.hours] | <code>number</code> | Hours from now. |
|
|
436
|
+
| [date_components_range.end_date_components] | <code>object</code> | End date for the delivery estimate. |
|
|
437
|
+
| [date_components_range.end_date_components.years] | <code>number</code> | Years from now. |
|
|
438
|
+
| [date_components_range.end_date_components.months] | <code>number</code> | Months from now. |
|
|
439
|
+
| [date_components_range.end_date_components.days] | <code>number</code> | Days from now. |
|
|
440
|
+
| [date_components_range.end_date_components.hours] | <code>number</code> | Hours from now. |
|
|
441
|
+
|
|
442
|
+
<a name="IGooglePayShippingOption" id="IGooglePayShippingOption" href="#IGooglePayShippingOption"> </a>
|
|
443
|
+
|
|
444
|
+
## IGooglePayShippingOption : <code>object</code>
|
|
445
|
+
Interface for IGooglePayShippingOption.
|
|
446
|
+
Used for shipping options in Google Pay wallets.
|
|
447
|
+
|
|
448
|
+
**Kind**: global interface
|
|
449
|
+
|
|
450
|
+
| Param | Type | Description |
|
|
451
|
+
| --- | --- | --- |
|
|
452
|
+
| id | <code>string</code> | Unique identifier for the shipping option. |
|
|
453
|
+
| label | <code>string</code> | Display name for the shipping option. |
|
|
454
|
+
| [detail] | <code>string</code> | Optional description or detail text. |
|
|
455
|
+
| [type] | <code>'ELECTRONIC'</code> \| <code>'GROUND'</code> \| <code>'NOT\_SHIPPED'</code> \| <code>'OVERNIGHT'</code> \| <code>'PICKUP'</code> \| <code>'PRIORITY'</code> \| <code>'SAME\_DAY'</code> | The shipping type. |
|
|
456
|
+
|
|
457
|
+
<a name="ApplePayOpenWalletButton" id="ApplePayOpenWalletButton" href="#ApplePayOpenWalletButton"> </a>
|
|
458
|
+
|
|
459
|
+
## ApplePayOpenWalletButton ⇐ [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
460
|
+
Apple Pay wallet button that creates One-Time Tokens (OTT) via Apple Pay.
|
|
461
|
+
|
|
462
|
+
Provides a fully typed Apple Pay integration with Apple Pay-specific metadata
|
|
463
|
+
and validates that the service configuration corresponds to an Apple Pay service.
|
|
464
|
+
On `load()`, the button fetches the service configuration and raises an error via `onError`
|
|
465
|
+
if the service type does not match Apple Pay.
|
|
466
|
+
|
|
467
|
+
**Kind**: global class
|
|
468
|
+
**Extends**: [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
469
|
+
|
|
470
|
+
* [ApplePayOpenWalletButton](#ApplePayOpenWalletButton) ⇐ [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
471
|
+
* [new ApplePayOpenWalletButton(selector, publicKeyOrAccessToken, serviceId, meta)](#new_ApplePayOpenWalletButton_new)
|
|
472
|
+
* [.load()](#OpenWalletButtons+load)
|
|
473
|
+
* [.setEnv(env, [alias])](#OpenWalletButtons+setEnv)
|
|
474
|
+
* [.setMeta(meta)](#OpenWalletButtons+setMeta)
|
|
475
|
+
* [.destroy()](#OpenWalletButtons+destroy)
|
|
476
|
+
* [.onClick(handler)](#OpenWalletButtons+onClick)
|
|
477
|
+
* [.onSuccess(handler)](#OpenWalletButtons+onSuccess)
|
|
478
|
+
* [.onUnavailable(handler)](#OpenWalletButtons+onUnavailable)
|
|
479
|
+
* [.onError(handler)](#OpenWalletButtons+onError)
|
|
480
|
+
* [.onCancel(handler)](#OpenWalletButtons+onCancel)
|
|
481
|
+
* [.onLoaded(handler)](#OpenWalletButtons+onLoaded)
|
|
482
|
+
* [.onShippingAddressChange(handler)](#OpenWalletButtons+onShippingAddressChange)
|
|
483
|
+
* [.onShippingOptionsChange(handler)](#OpenWalletButtons+onShippingOptionsChange)
|
|
484
|
+
|
|
485
|
+
<a name="new_ApplePayOpenWalletButton_new" id="new_ApplePayOpenWalletButton_new" href="#new_ApplePayOpenWalletButton_new"> </a>
|
|
486
|
+
|
|
487
|
+
### new ApplePayOpenWalletButton(selector, publicKeyOrAccessToken, serviceId, meta)
|
|
488
|
+
|
|
489
|
+
| Param | Type | Description |
|
|
490
|
+
| --- | --- | --- |
|
|
491
|
+
| selector | <code>string</code> | CSS selector of the HTML element that will contain the Apple Pay button. |
|
|
492
|
+
| publicKeyOrAccessToken | <code>string</code> | Public key or access token for API authentication. |
|
|
493
|
+
| serviceId | <code>string</code> | The Apple Pay service ID configured in PayDock dashboard. |
|
|
494
|
+
| meta | [<code>ApplePayOpenWalletMeta</code>](#ApplePayOpenWalletMeta) | Apple Pay-specific metadata (amount, currency, country, amount_label, store_name, style, apple_pay_capabilities, etc.). |
|
|
495
|
+
|
|
496
|
+
**Example**
|
|
497
|
+
```js
|
|
498
|
+
const button = new ApplePayOpenWalletButton(
|
|
499
|
+
'#wallet-container',
|
|
500
|
+
publicKeyOrAccessToken,
|
|
501
|
+
serviceId,
|
|
502
|
+
{
|
|
503
|
+
amount: 100,
|
|
504
|
+
currency: 'AUD',
|
|
505
|
+
country: 'AU',
|
|
506
|
+
amount_label: 'TOTAL',
|
|
507
|
+
store_name: 'My Store',
|
|
508
|
+
apple_pay_capabilities: ['credentials_available'],
|
|
509
|
+
},
|
|
510
|
+
);
|
|
511
|
+
button.setEnv('sandbox');
|
|
512
|
+
button.onSuccess((data) => console.log('OTT:', data.token));
|
|
513
|
+
button.onError((error) => console.error('Error:', error));
|
|
514
|
+
button.load();
|
|
515
|
+
```
|
|
516
|
+
<a name="OpenWalletButtons+load" id="OpenWalletButtons+load" href="#OpenWalletButtons+load"> </a>
|
|
517
|
+
|
|
518
|
+
### applePayOpenWalletButton.load()
|
|
519
|
+
Loads and initializes the wallet button based on the service configuration.
|
|
520
|
+
This method fetches the wallet service configuration, validates that the service
|
|
521
|
+
type matches the expected wallet, and creates the appropriate wallet service instance.
|
|
522
|
+
Bear in mind that you must call this method after setting up all event handlers.
|
|
523
|
+
|
|
524
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
525
|
+
**Example**
|
|
526
|
+
```js
|
|
527
|
+
button.onClick((data) => { ... });
|
|
528
|
+
button.onSuccess((data) => { ... });
|
|
529
|
+
button.onError((error) => { ... });
|
|
530
|
+
button.load();
|
|
531
|
+
```
|
|
532
|
+
<a name="OpenWalletButtons+setEnv" id="OpenWalletButtons+setEnv" href="#OpenWalletButtons+setEnv"> </a>
|
|
533
|
+
|
|
534
|
+
### applePayOpenWalletButton.setEnv(env, [alias])
|
|
535
|
+
Current method can change environment. By default environment = sandbox.
|
|
536
|
+
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
537
|
+
Bear in mind that you must set an environment before calling `button.load()`.
|
|
538
|
+
|
|
539
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
540
|
+
|
|
541
|
+
| Param | Type | Description |
|
|
542
|
+
| --- | --- | --- |
|
|
543
|
+
| env | <code>string</code> | The target environment: `'sandbox'` or `'production'`. |
|
|
544
|
+
| [alias] | <code>string</code> | Own domain alias. |
|
|
545
|
+
|
|
546
|
+
**Example**
|
|
547
|
+
```js
|
|
548
|
+
button.setEnv('production', 'paydock.com');
|
|
549
|
+
```
|
|
550
|
+
<a name="OpenWalletButtons+setMeta" id="OpenWalletButtons+setMeta" href="#OpenWalletButtons+setMeta"> </a>
|
|
551
|
+
|
|
552
|
+
### applePayOpenWalletButton.setMeta(meta)
|
|
553
|
+
Updates the wallet metadata after initialization.
|
|
554
|
+
Use this when order information changes (e.g. amount, currency) after the button has been rendered.
|
|
555
|
+
Bear in mind that this must be called before the next payment attempt takes effect.
|
|
556
|
+
|
|
557
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
558
|
+
|
|
559
|
+
| Param | Type | Description |
|
|
560
|
+
| --- | --- | --- |
|
|
561
|
+
| meta | [<code>ApplePayOpenWalletMeta</code>](#ApplePayOpenWalletMeta) \| [<code>GooglePayOpenWalletMeta</code>](#GooglePayOpenWalletMeta) | The updated metadata object. The concrete type depends on the button class. |
|
|
562
|
+
|
|
563
|
+
**Example**
|
|
564
|
+
```js
|
|
565
|
+
button.setMeta({ ...meta, amount: 29.99 });
|
|
566
|
+
```
|
|
567
|
+
<a name="OpenWalletButtons+destroy" id="OpenWalletButtons+destroy" href="#OpenWalletButtons+destroy"> </a>
|
|
568
|
+
|
|
569
|
+
### applePayOpenWalletButton.destroy()
|
|
570
|
+
Removes the wallet button from the DOM and cleans up resources.
|
|
571
|
+
Call this method when the wallet button is no longer needed (e.g. navigating away from the payment page).
|
|
572
|
+
|
|
573
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
574
|
+
**Example**
|
|
575
|
+
```js
|
|
576
|
+
button.destroy();
|
|
577
|
+
```
|
|
578
|
+
<a name="OpenWalletButtons+onClick" id="OpenWalletButtons+onClick" href="#OpenWalletButtons+onClick"> </a>
|
|
579
|
+
|
|
580
|
+
### applePayOpenWalletButton.onClick(handler)
|
|
581
|
+
Registers a callback function to be invoked when the wallet button gets clicked.
|
|
582
|
+
The handler controls the wallet payment flow via its return value:
|
|
583
|
+
|
|
584
|
+
- Return `void` (or nothing) to continue the payment flow normally.
|
|
585
|
+
- Return `false` to abort the payment flow.
|
|
586
|
+
- Return a `Promise<void>` to defer the wallet sheet until the promise resolves.
|
|
587
|
+
- Return a `Promise<boolean>` — if it resolves to `false`, the flow is aborted.
|
|
588
|
+
- Throwing an error (sync or async) also aborts the flow.
|
|
589
|
+
|
|
590
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
591
|
+
|
|
592
|
+
**Note:** this callback may be called multiple times as the customer closes the payment
|
|
593
|
+
checkout and re-clicks the button.
|
|
594
|
+
|
|
595
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
596
|
+
|
|
597
|
+
| Param | Type | Description |
|
|
598
|
+
| --- | --- | --- |
|
|
599
|
+
| handler | [<code>OnClickCallback</code>](#OnClickCallback) | Function to be called when the wallet button is clicked. |
|
|
600
|
+
|
|
601
|
+
**Example**
|
|
602
|
+
```js
|
|
603
|
+
// Synchronous usage — continue normally
|
|
604
|
+
button.onClick((event) => {
|
|
605
|
+
performValidationLogic();
|
|
606
|
+
});
|
|
607
|
+
```
|
|
608
|
+
**Example**
|
|
609
|
+
```js
|
|
610
|
+
// Synchronous abort — return false to cancel the payment
|
|
611
|
+
button.onClick((event) => {
|
|
612
|
+
if (!isOrderValid()) return false;
|
|
613
|
+
});
|
|
614
|
+
```
|
|
615
|
+
**Example**
|
|
616
|
+
```js
|
|
617
|
+
// Asynchronous usage — defer wallet sheet until the promise resolves
|
|
618
|
+
button.onClick(async (event) => {
|
|
619
|
+
await fetch('/validate-order').then(res => res.json());
|
|
620
|
+
});
|
|
621
|
+
```
|
|
622
|
+
<a name="OpenWalletButtons+onSuccess" id="OpenWalletButtons+onSuccess" href="#OpenWalletButtons+onSuccess"> </a>
|
|
623
|
+
|
|
624
|
+
### applePayOpenWalletButton.onSuccess(handler)
|
|
625
|
+
Registers a callback function to be invoked when the OTT (One-Time Token) creation was successful.
|
|
626
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
627
|
+
|
|
628
|
+
**Important:** A handler is required. Do not perform thread blocking operations in callback such as `window.alert()` calls.
|
|
629
|
+
|
|
630
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
631
|
+
so that internal processing continues uninterrupted.
|
|
632
|
+
|
|
633
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
634
|
+
|
|
635
|
+
| Param | Type | Description |
|
|
636
|
+
| --- | --- | --- |
|
|
637
|
+
| handler | [<code>OnSuccessCallback</code>](#OnSuccessCallback) | Function to be called when the OTT creation was successful. |
|
|
638
|
+
|
|
639
|
+
**Example**
|
|
640
|
+
```js
|
|
641
|
+
button.onSuccess((event) => {
|
|
642
|
+
console.log('OTT created:', event.data.token.temp_token);
|
|
643
|
+
console.log('Amount:', event.data.amount);
|
|
644
|
+
});
|
|
645
|
+
```
|
|
646
|
+
**Example**
|
|
647
|
+
```js
|
|
648
|
+
// Async handler
|
|
649
|
+
button.onSuccess(async (event) => {
|
|
650
|
+
await submitTokenToServer(event.data.token.temp_token);
|
|
651
|
+
});
|
|
652
|
+
```
|
|
653
|
+
<a name="OpenWalletButtons+onUnavailable" id="OpenWalletButtons+onUnavailable" href="#OpenWalletButtons+onUnavailable"> </a>
|
|
654
|
+
|
|
655
|
+
### applePayOpenWalletButton.onUnavailable(handler)
|
|
656
|
+
Registers a callback function to be invoked when the wallet is not available in the current context.
|
|
657
|
+
This can happen when the wallet service is not supported on the current device or browser.
|
|
658
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
659
|
+
|
|
660
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
661
|
+
so that internal processing continues uninterrupted.
|
|
662
|
+
|
|
663
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
664
|
+
|
|
665
|
+
| Param | Type | Description |
|
|
666
|
+
| --- | --- | --- |
|
|
667
|
+
| handler | [<code>OnUnavailableCallback</code>](#OnUnavailableCallback) | Function to be called when the wallet is not available in the current context. |
|
|
668
|
+
|
|
669
|
+
**Example**
|
|
670
|
+
```js
|
|
671
|
+
button.onUnavailable((event) => {
|
|
672
|
+
console.log('Wallet not available:', event.data.reason);
|
|
673
|
+
});
|
|
674
|
+
```
|
|
675
|
+
<a name="OpenWalletButtons+onError" id="OpenWalletButtons+onError" href="#OpenWalletButtons+onError"> </a>
|
|
676
|
+
|
|
677
|
+
### applePayOpenWalletButton.onError(handler)
|
|
678
|
+
Registers a callback function to be invoked when an error occurs during wallet operation.
|
|
679
|
+
This includes configuration issues, validation errors, and OTT creation failures.
|
|
680
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
681
|
+
|
|
682
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
683
|
+
so that internal processing continues uninterrupted.
|
|
684
|
+
|
|
685
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
686
|
+
|
|
687
|
+
| Param | Type | Description |
|
|
688
|
+
| --- | --- | --- |
|
|
689
|
+
| handler | [<code>OnErrorCallback</code>](#OnErrorCallback) | Function to be called when the wallet has an error. |
|
|
690
|
+
|
|
691
|
+
**Example**
|
|
692
|
+
```js
|
|
693
|
+
button.onError((event) => {
|
|
694
|
+
console.error('Wallet error:', event.data.error.message);
|
|
695
|
+
console.log('Context:', event.data.context);
|
|
696
|
+
});
|
|
697
|
+
```
|
|
698
|
+
<a name="OpenWalletButtons+onCancel" id="OpenWalletButtons+onCancel" href="#OpenWalletButtons+onCancel"> </a>
|
|
699
|
+
|
|
700
|
+
### applePayOpenWalletButton.onCancel(handler)
|
|
701
|
+
Registers a callback function to be invoked when the wallet checkout is cancelled or closed by the user.
|
|
702
|
+
This event is triggered when the user dismisses the wallet payment interface without completing the transaction.
|
|
703
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
704
|
+
|
|
705
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
706
|
+
so that internal processing continues uninterrupted.
|
|
707
|
+
|
|
708
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
709
|
+
|
|
710
|
+
| Param | Type | Description |
|
|
711
|
+
| --- | --- | --- |
|
|
712
|
+
| handler | [<code>OnCancelCallback</code>](#OnCancelCallback) | Function to be called when the wallet checkout is cancelled. |
|
|
713
|
+
|
|
714
|
+
**Example**
|
|
715
|
+
```js
|
|
716
|
+
button.onCancel((event) => {
|
|
717
|
+
console.log('Wallet checkout cancelled', event);
|
|
718
|
+
});
|
|
719
|
+
```
|
|
720
|
+
<a name="OpenWalletButtons+onLoaded" id="OpenWalletButtons+onLoaded" href="#OpenWalletButtons+onLoaded"> </a>
|
|
721
|
+
|
|
722
|
+
### applePayOpenWalletButton.onLoaded(handler)
|
|
723
|
+
Registers a callback function to be invoked when the wallet button has been loaded and rendered in the DOM.
|
|
724
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
725
|
+
|
|
726
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
727
|
+
so that internal processing continues uninterrupted.
|
|
728
|
+
|
|
729
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
730
|
+
|
|
731
|
+
| Param | Type | Description |
|
|
732
|
+
| --- | --- | --- |
|
|
733
|
+
| handler | <code>function</code> | Function to be called when the wallet button is loaded. |
|
|
734
|
+
|
|
735
|
+
**Example**
|
|
736
|
+
```js
|
|
737
|
+
button.onLoaded((event) => {
|
|
738
|
+
console.log('Wallet button loaded');
|
|
739
|
+
});
|
|
740
|
+
```
|
|
741
|
+
<a name="OpenWalletButtons+onShippingAddressChange" id="OpenWalletButtons+onShippingAddressChange" href="#OpenWalletButtons+onShippingAddressChange"> </a>
|
|
742
|
+
|
|
743
|
+
### applePayOpenWalletButton.onShippingAddressChange(handler)
|
|
744
|
+
Registers a callback for when the customer selects or updates their shipping address.
|
|
745
|
+
Use this method to listen for shipping address selection or input from customer when shipping is enabled.
|
|
746
|
+
The event handler should return updated payment information including the new amount and
|
|
747
|
+
available shipping options based on the selected address.
|
|
748
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
749
|
+
|
|
750
|
+
In case of an address validation error, include the `error` field in the response
|
|
751
|
+
to display an appropriate error in the wallet payment sheet.
|
|
752
|
+
|
|
753
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
754
|
+
|
|
755
|
+
| Param | Type | Description |
|
|
756
|
+
| --- | --- | --- |
|
|
757
|
+
| handler | [<code>OnShippingAddressChangeCallback</code>](#OnShippingAddressChangeCallback) | Function to be called when the shipping address data is updated. |
|
|
758
|
+
|
|
759
|
+
**Example**
|
|
760
|
+
```js
|
|
761
|
+
// Async handler
|
|
762
|
+
button.onShippingAddressChange(async (data) => {
|
|
763
|
+
const response = await fetch('https://your-server.com/update-shipping-address', {
|
|
764
|
+
method: 'POST',
|
|
765
|
+
body: JSON.stringify(data),
|
|
766
|
+
});
|
|
767
|
+
const result = await response.json();
|
|
768
|
+
return {
|
|
769
|
+
amount: result.newAmount,
|
|
770
|
+
shipping_options: result.availableShippingOptions,
|
|
771
|
+
};
|
|
772
|
+
});
|
|
773
|
+
```
|
|
774
|
+
**Example**
|
|
775
|
+
```js
|
|
776
|
+
// Sync handler
|
|
777
|
+
button.onShippingAddressChange((data) => {
|
|
778
|
+
return {
|
|
779
|
+
amount: calculateShipping(data.data.address_country),
|
|
780
|
+
shipping_options: getOptionsForCountry(data.data.address_country),
|
|
781
|
+
};
|
|
782
|
+
});
|
|
783
|
+
```
|
|
784
|
+
<a name="OpenWalletButtons+onShippingOptionsChange" id="OpenWalletButtons+onShippingOptionsChange" href="#OpenWalletButtons+onShippingOptionsChange"> </a>
|
|
785
|
+
|
|
786
|
+
### applePayOpenWalletButton.onShippingOptionsChange(handler)
|
|
787
|
+
Registers a callback for when the customer selects a shipping option.
|
|
788
|
+
Use this method to listen for shipping option selection from customer when shipping is enabled.
|
|
789
|
+
The event handler should return the updated payment amount based on the selected shipping option.
|
|
790
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
791
|
+
|
|
792
|
+
**Kind**: instance method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
793
|
+
|
|
794
|
+
| Param | Type | Description |
|
|
795
|
+
| --- | --- | --- |
|
|
796
|
+
| handler | [<code>OnShippingOptionsChangeCallback</code>](#OnShippingOptionsChangeCallback) | Function to be called when the shipping options data is updated. |
|
|
797
|
+
|
|
798
|
+
**Example**
|
|
799
|
+
```js
|
|
800
|
+
// Async handler
|
|
801
|
+
button.onShippingOptionsChange(async (data) => {
|
|
802
|
+
const response = await fetch('https://your-server.com/update-shipping-option', {
|
|
803
|
+
method: 'POST',
|
|
804
|
+
body: JSON.stringify({ shipping_option_id: data.data.shipping_option_id }),
|
|
805
|
+
});
|
|
806
|
+
const result = await response.json();
|
|
807
|
+
return {
|
|
808
|
+
amount: result.newTotalAmount,
|
|
809
|
+
};
|
|
810
|
+
});
|
|
811
|
+
```
|
|
812
|
+
**Example**
|
|
813
|
+
```js
|
|
814
|
+
// Sync handler
|
|
815
|
+
button.onShippingOptionsChange((data) => {
|
|
816
|
+
return {
|
|
817
|
+
amount: lookupShippingCost(data.data.shipping_option_id),
|
|
818
|
+
};
|
|
819
|
+
});
|
|
820
|
+
```
|
|
821
|
+
<a name="GooglePayOpenWalletButton" id="GooglePayOpenWalletButton" href="#GooglePayOpenWalletButton"> </a>
|
|
822
|
+
|
|
823
|
+
## GooglePayOpenWalletButton ⇐ [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
824
|
+
Google Pay wallet button that creates One-Time Tokens (OTT) via Google Pay.
|
|
825
|
+
|
|
826
|
+
Provides a fully typed Google Pay integration with Google Pay-specific metadata
|
|
827
|
+
and validates that the service configuration corresponds to a Google Pay service.
|
|
828
|
+
On `load()`, the button fetches the service configuration and raises an error via `onError`
|
|
829
|
+
if the service type does not match Google Pay.
|
|
830
|
+
|
|
831
|
+
**Kind**: global class
|
|
832
|
+
**Extends**: [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
833
|
+
|
|
834
|
+
* [GooglePayOpenWalletButton](#GooglePayOpenWalletButton) ⇐ [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
835
|
+
* [new GooglePayOpenWalletButton(selector, publicKeyOrAccessToken, serviceId, meta)](#new_GooglePayOpenWalletButton_new)
|
|
836
|
+
* [.load()](#OpenWalletButtons+load)
|
|
837
|
+
* [.setEnv(env, [alias])](#OpenWalletButtons+setEnv)
|
|
838
|
+
* [.setMeta(meta)](#OpenWalletButtons+setMeta)
|
|
839
|
+
* [.destroy()](#OpenWalletButtons+destroy)
|
|
840
|
+
* [.onClick(handler)](#OpenWalletButtons+onClick)
|
|
841
|
+
* [.onSuccess(handler)](#OpenWalletButtons+onSuccess)
|
|
842
|
+
* [.onUnavailable(handler)](#OpenWalletButtons+onUnavailable)
|
|
843
|
+
* [.onError(handler)](#OpenWalletButtons+onError)
|
|
844
|
+
* [.onCancel(handler)](#OpenWalletButtons+onCancel)
|
|
845
|
+
* [.onLoaded(handler)](#OpenWalletButtons+onLoaded)
|
|
846
|
+
* [.onShippingAddressChange(handler)](#OpenWalletButtons+onShippingAddressChange)
|
|
847
|
+
* [.onShippingOptionsChange(handler)](#OpenWalletButtons+onShippingOptionsChange)
|
|
848
|
+
|
|
849
|
+
<a name="new_GooglePayOpenWalletButton_new" id="new_GooglePayOpenWalletButton_new" href="#new_GooglePayOpenWalletButton_new"> </a>
|
|
850
|
+
|
|
851
|
+
### new GooglePayOpenWalletButton(selector, publicKeyOrAccessToken, serviceId, meta)
|
|
852
|
+
|
|
853
|
+
| Param | Type | Description |
|
|
854
|
+
| --- | --- | --- |
|
|
855
|
+
| selector | <code>string</code> | CSS selector of the HTML element that will contain the Google Pay button. |
|
|
856
|
+
| publicKeyOrAccessToken | <code>string</code> | Public key or access token for API authentication. |
|
|
857
|
+
| serviceId | <code>string</code> | The Google Pay service ID configured in PayDock dashboard. |
|
|
858
|
+
| meta | [<code>GooglePayOpenWalletMeta</code>](#GooglePayOpenWalletMeta) | Google Pay-specific metadata (amount, currency, country, card_config, merchant_name, style, etc.). |
|
|
859
|
+
|
|
860
|
+
**Example**
|
|
861
|
+
```js
|
|
862
|
+
const button = new GooglePayOpenWalletButton(
|
|
863
|
+
'#wallet-container',
|
|
864
|
+
publicKeyOrAccessToken,
|
|
865
|
+
serviceId,
|
|
866
|
+
{
|
|
867
|
+
amount: 100,
|
|
868
|
+
currency: 'AUD',
|
|
869
|
+
country: 'AU',
|
|
870
|
+
merchant_name: 'Your Store',
|
|
871
|
+
},
|
|
872
|
+
);
|
|
873
|
+
button.setEnv('sandbox');
|
|
874
|
+
button.onSuccess((data) => console.log('OTT:', data.token));
|
|
875
|
+
button.onError((error) => console.error('Error:', error));
|
|
876
|
+
button.load();
|
|
877
|
+
```
|
|
878
|
+
<a name="OpenWalletButtons+load" id="OpenWalletButtons+load" href="#OpenWalletButtons+load"> </a>
|
|
879
|
+
|
|
880
|
+
### googlePayOpenWalletButton.load()
|
|
881
|
+
Loads and initializes the wallet button based on the service configuration.
|
|
882
|
+
This method fetches the wallet service configuration, validates that the service
|
|
883
|
+
type matches the expected wallet, and creates the appropriate wallet service instance.
|
|
884
|
+
Bear in mind that you must call this method after setting up all event handlers.
|
|
885
|
+
|
|
886
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
887
|
+
**Example**
|
|
888
|
+
```js
|
|
889
|
+
button.onClick((data) => { ... });
|
|
890
|
+
button.onSuccess((data) => { ... });
|
|
891
|
+
button.onError((error) => { ... });
|
|
892
|
+
button.load();
|
|
893
|
+
```
|
|
894
|
+
<a name="OpenWalletButtons+setEnv" id="OpenWalletButtons+setEnv" href="#OpenWalletButtons+setEnv"> </a>
|
|
895
|
+
|
|
896
|
+
### googlePayOpenWalletButton.setEnv(env, [alias])
|
|
897
|
+
Current method can change environment. By default environment = sandbox.
|
|
898
|
+
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
899
|
+
Bear in mind that you must set an environment before calling `button.load()`.
|
|
900
|
+
|
|
901
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
902
|
+
|
|
903
|
+
| Param | Type | Description |
|
|
904
|
+
| --- | --- | --- |
|
|
905
|
+
| env | <code>string</code> | The target environment: `'sandbox'` or `'production'`. |
|
|
906
|
+
| [alias] | <code>string</code> | Own domain alias. |
|
|
907
|
+
|
|
908
|
+
**Example**
|
|
909
|
+
```js
|
|
910
|
+
button.setEnv('production', 'paydock.com');
|
|
911
|
+
```
|
|
912
|
+
<a name="OpenWalletButtons+setMeta" id="OpenWalletButtons+setMeta" href="#OpenWalletButtons+setMeta"> </a>
|
|
913
|
+
|
|
914
|
+
### googlePayOpenWalletButton.setMeta(meta)
|
|
915
|
+
Updates the wallet metadata after initialization.
|
|
916
|
+
Use this when order information changes (e.g. amount, currency) after the button has been rendered.
|
|
917
|
+
Bear in mind that this must be called before the next payment attempt takes effect.
|
|
918
|
+
|
|
919
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
920
|
+
|
|
921
|
+
| Param | Type | Description |
|
|
922
|
+
| --- | --- | --- |
|
|
923
|
+
| meta | [<code>ApplePayOpenWalletMeta</code>](#ApplePayOpenWalletMeta) \| [<code>GooglePayOpenWalletMeta</code>](#GooglePayOpenWalletMeta) | The updated metadata object. The concrete type depends on the button class. |
|
|
924
|
+
|
|
925
|
+
**Example**
|
|
926
|
+
```js
|
|
927
|
+
button.setMeta({ ...meta, amount: 29.99 });
|
|
928
|
+
```
|
|
929
|
+
<a name="OpenWalletButtons+destroy" id="OpenWalletButtons+destroy" href="#OpenWalletButtons+destroy"> </a>
|
|
930
|
+
|
|
931
|
+
### googlePayOpenWalletButton.destroy()
|
|
932
|
+
Removes the wallet button from the DOM and cleans up resources.
|
|
933
|
+
Call this method when the wallet button is no longer needed (e.g. navigating away from the payment page).
|
|
934
|
+
|
|
935
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
936
|
+
**Example**
|
|
937
|
+
```js
|
|
938
|
+
button.destroy();
|
|
939
|
+
```
|
|
940
|
+
<a name="OpenWalletButtons+onClick" id="OpenWalletButtons+onClick" href="#OpenWalletButtons+onClick"> </a>
|
|
941
|
+
|
|
942
|
+
### googlePayOpenWalletButton.onClick(handler)
|
|
943
|
+
Registers a callback function to be invoked when the wallet button gets clicked.
|
|
944
|
+
The handler controls the wallet payment flow via its return value:
|
|
945
|
+
|
|
946
|
+
- Return `void` (or nothing) to continue the payment flow normally.
|
|
947
|
+
- Return `false` to abort the payment flow.
|
|
948
|
+
- Return a `Promise<void>` to defer the wallet sheet until the promise resolves.
|
|
949
|
+
- Return a `Promise<boolean>` — if it resolves to `false`, the flow is aborted.
|
|
950
|
+
- Throwing an error (sync or async) also aborts the flow.
|
|
951
|
+
|
|
952
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
953
|
+
|
|
954
|
+
**Note:** this callback may be called multiple times as the customer closes the payment
|
|
955
|
+
checkout and re-clicks the button.
|
|
956
|
+
|
|
957
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
958
|
+
|
|
959
|
+
| Param | Type | Description |
|
|
960
|
+
| --- | --- | --- |
|
|
961
|
+
| handler | [<code>OnClickCallback</code>](#OnClickCallback) | Function to be called when the wallet button is clicked. |
|
|
962
|
+
|
|
963
|
+
**Example**
|
|
964
|
+
```js
|
|
965
|
+
// Synchronous usage — continue normally
|
|
966
|
+
button.onClick((event) => {
|
|
967
|
+
performValidationLogic();
|
|
968
|
+
});
|
|
969
|
+
```
|
|
970
|
+
**Example**
|
|
971
|
+
```js
|
|
972
|
+
// Synchronous abort — return false to cancel the payment
|
|
973
|
+
button.onClick((event) => {
|
|
974
|
+
if (!isOrderValid()) return false;
|
|
975
|
+
});
|
|
976
|
+
```
|
|
977
|
+
**Example**
|
|
978
|
+
```js
|
|
979
|
+
// Asynchronous usage — defer wallet sheet until the promise resolves
|
|
980
|
+
button.onClick(async (event) => {
|
|
981
|
+
await fetch('/validate-order').then(res => res.json());
|
|
982
|
+
});
|
|
983
|
+
```
|
|
984
|
+
<a name="OpenWalletButtons+onSuccess" id="OpenWalletButtons+onSuccess" href="#OpenWalletButtons+onSuccess"> </a>
|
|
985
|
+
|
|
986
|
+
### googlePayOpenWalletButton.onSuccess(handler)
|
|
987
|
+
Registers a callback function to be invoked when the OTT (One-Time Token) creation was successful.
|
|
988
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
989
|
+
|
|
990
|
+
**Important:** A handler is required. Do not perform thread blocking operations in callback such as `window.alert()` calls.
|
|
991
|
+
|
|
992
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
993
|
+
so that internal processing continues uninterrupted.
|
|
994
|
+
|
|
995
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
996
|
+
|
|
997
|
+
| Param | Type | Description |
|
|
998
|
+
| --- | --- | --- |
|
|
999
|
+
| handler | [<code>OnSuccessCallback</code>](#OnSuccessCallback) | Function to be called when the OTT creation was successful. |
|
|
1000
|
+
|
|
1001
|
+
**Example**
|
|
1002
|
+
```js
|
|
1003
|
+
button.onSuccess((event) => {
|
|
1004
|
+
console.log('OTT created:', event.data.token.temp_token);
|
|
1005
|
+
console.log('Amount:', event.data.amount);
|
|
1006
|
+
});
|
|
1007
|
+
```
|
|
1008
|
+
**Example**
|
|
1009
|
+
```js
|
|
1010
|
+
// Async handler
|
|
1011
|
+
button.onSuccess(async (event) => {
|
|
1012
|
+
await submitTokenToServer(event.data.token.temp_token);
|
|
1013
|
+
});
|
|
1014
|
+
```
|
|
1015
|
+
<a name="OpenWalletButtons+onUnavailable" id="OpenWalletButtons+onUnavailable" href="#OpenWalletButtons+onUnavailable"> </a>
|
|
1016
|
+
|
|
1017
|
+
### googlePayOpenWalletButton.onUnavailable(handler)
|
|
1018
|
+
Registers a callback function to be invoked when the wallet is not available in the current context.
|
|
1019
|
+
This can happen when the wallet service is not supported on the current device or browser.
|
|
1020
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1021
|
+
|
|
1022
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1023
|
+
so that internal processing continues uninterrupted.
|
|
1024
|
+
|
|
1025
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
1026
|
+
|
|
1027
|
+
| Param | Type | Description |
|
|
1028
|
+
| --- | --- | --- |
|
|
1029
|
+
| handler | [<code>OnUnavailableCallback</code>](#OnUnavailableCallback) | Function to be called when the wallet is not available in the current context. |
|
|
1030
|
+
|
|
1031
|
+
**Example**
|
|
1032
|
+
```js
|
|
1033
|
+
button.onUnavailable((event) => {
|
|
1034
|
+
console.log('Wallet not available:', event.data.reason);
|
|
1035
|
+
});
|
|
1036
|
+
```
|
|
1037
|
+
<a name="OpenWalletButtons+onError" id="OpenWalletButtons+onError" href="#OpenWalletButtons+onError"> </a>
|
|
1038
|
+
|
|
1039
|
+
### googlePayOpenWalletButton.onError(handler)
|
|
1040
|
+
Registers a callback function to be invoked when an error occurs during wallet operation.
|
|
1041
|
+
This includes configuration issues, validation errors, and OTT creation failures.
|
|
1042
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1043
|
+
|
|
1044
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1045
|
+
so that internal processing continues uninterrupted.
|
|
1046
|
+
|
|
1047
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
1048
|
+
|
|
1049
|
+
| Param | Type | Description |
|
|
1050
|
+
| --- | --- | --- |
|
|
1051
|
+
| handler | [<code>OnErrorCallback</code>](#OnErrorCallback) | Function to be called when the wallet has an error. |
|
|
1052
|
+
|
|
1053
|
+
**Example**
|
|
1054
|
+
```js
|
|
1055
|
+
button.onError((event) => {
|
|
1056
|
+
console.error('Wallet error:', event.data.error.message);
|
|
1057
|
+
console.log('Context:', event.data.context);
|
|
1058
|
+
});
|
|
1059
|
+
```
|
|
1060
|
+
<a name="OpenWalletButtons+onCancel" id="OpenWalletButtons+onCancel" href="#OpenWalletButtons+onCancel"> </a>
|
|
1061
|
+
|
|
1062
|
+
### googlePayOpenWalletButton.onCancel(handler)
|
|
1063
|
+
Registers a callback function to be invoked when the wallet checkout is cancelled or closed by the user.
|
|
1064
|
+
This event is triggered when the user dismisses the wallet payment interface without completing the transaction.
|
|
1065
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1066
|
+
|
|
1067
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1068
|
+
so that internal processing continues uninterrupted.
|
|
1069
|
+
|
|
1070
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
1071
|
+
|
|
1072
|
+
| Param | Type | Description |
|
|
1073
|
+
| --- | --- | --- |
|
|
1074
|
+
| handler | [<code>OnCancelCallback</code>](#OnCancelCallback) | Function to be called when the wallet checkout is cancelled. |
|
|
1075
|
+
|
|
1076
|
+
**Example**
|
|
1077
|
+
```js
|
|
1078
|
+
button.onCancel((event) => {
|
|
1079
|
+
console.log('Wallet checkout cancelled', event);
|
|
1080
|
+
});
|
|
1081
|
+
```
|
|
1082
|
+
<a name="OpenWalletButtons+onLoaded" id="OpenWalletButtons+onLoaded" href="#OpenWalletButtons+onLoaded"> </a>
|
|
1083
|
+
|
|
1084
|
+
### googlePayOpenWalletButton.onLoaded(handler)
|
|
1085
|
+
Registers a callback function to be invoked when the wallet button has been loaded and rendered in the DOM.
|
|
1086
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1087
|
+
|
|
1088
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1089
|
+
so that internal processing continues uninterrupted.
|
|
1090
|
+
|
|
1091
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
1092
|
+
|
|
1093
|
+
| Param | Type | Description |
|
|
1094
|
+
| --- | --- | --- |
|
|
1095
|
+
| handler | <code>function</code> | Function to be called when the wallet button is loaded. |
|
|
1096
|
+
|
|
1097
|
+
**Example**
|
|
1098
|
+
```js
|
|
1099
|
+
button.onLoaded((event) => {
|
|
1100
|
+
console.log('Wallet button loaded');
|
|
1101
|
+
});
|
|
1102
|
+
```
|
|
1103
|
+
<a name="OpenWalletButtons+onShippingAddressChange" id="OpenWalletButtons+onShippingAddressChange" href="#OpenWalletButtons+onShippingAddressChange"> </a>
|
|
1104
|
+
|
|
1105
|
+
### googlePayOpenWalletButton.onShippingAddressChange(handler)
|
|
1106
|
+
Registers a callback for when the customer selects or updates their shipping address.
|
|
1107
|
+
Use this method to listen for shipping address selection or input from customer when shipping is enabled.
|
|
1108
|
+
The event handler should return updated payment information including the new amount and
|
|
1109
|
+
available shipping options based on the selected address.
|
|
1110
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1111
|
+
|
|
1112
|
+
In case of an address validation error, include the `error` field in the response
|
|
1113
|
+
to display an appropriate error in the wallet payment sheet.
|
|
1114
|
+
|
|
1115
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
1116
|
+
|
|
1117
|
+
| Param | Type | Description |
|
|
1118
|
+
| --- | --- | --- |
|
|
1119
|
+
| handler | [<code>OnShippingAddressChangeCallback</code>](#OnShippingAddressChangeCallback) | Function to be called when the shipping address data is updated. |
|
|
1120
|
+
|
|
1121
|
+
**Example**
|
|
1122
|
+
```js
|
|
1123
|
+
// Async handler
|
|
1124
|
+
button.onShippingAddressChange(async (data) => {
|
|
1125
|
+
const response = await fetch('https://your-server.com/update-shipping-address', {
|
|
1126
|
+
method: 'POST',
|
|
1127
|
+
body: JSON.stringify(data),
|
|
1128
|
+
});
|
|
1129
|
+
const result = await response.json();
|
|
1130
|
+
return {
|
|
1131
|
+
amount: result.newAmount,
|
|
1132
|
+
shipping_options: result.availableShippingOptions,
|
|
1133
|
+
};
|
|
1134
|
+
});
|
|
1135
|
+
```
|
|
1136
|
+
**Example**
|
|
1137
|
+
```js
|
|
1138
|
+
// Sync handler
|
|
1139
|
+
button.onShippingAddressChange((data) => {
|
|
1140
|
+
return {
|
|
1141
|
+
amount: calculateShipping(data.data.address_country),
|
|
1142
|
+
shipping_options: getOptionsForCountry(data.data.address_country),
|
|
1143
|
+
};
|
|
1144
|
+
});
|
|
1145
|
+
```
|
|
1146
|
+
<a name="OpenWalletButtons+onShippingOptionsChange" id="OpenWalletButtons+onShippingOptionsChange" href="#OpenWalletButtons+onShippingOptionsChange"> </a>
|
|
1147
|
+
|
|
1148
|
+
### googlePayOpenWalletButton.onShippingOptionsChange(handler)
|
|
1149
|
+
Registers a callback for when the customer selects a shipping option.
|
|
1150
|
+
Use this method to listen for shipping option selection from customer when shipping is enabled.
|
|
1151
|
+
The event handler should return the updated payment amount based on the selected shipping option.
|
|
1152
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1153
|
+
|
|
1154
|
+
**Kind**: instance method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
1155
|
+
|
|
1156
|
+
| Param | Type | Description |
|
|
1157
|
+
| --- | --- | --- |
|
|
1158
|
+
| handler | [<code>OnShippingOptionsChangeCallback</code>](#OnShippingOptionsChangeCallback) | Function to be called when the shipping options data is updated. |
|
|
1159
|
+
|
|
1160
|
+
**Example**
|
|
1161
|
+
```js
|
|
1162
|
+
// Async handler
|
|
1163
|
+
button.onShippingOptionsChange(async (data) => {
|
|
1164
|
+
const response = await fetch('https://your-server.com/update-shipping-option', {
|
|
1165
|
+
method: 'POST',
|
|
1166
|
+
body: JSON.stringify({ shipping_option_id: data.data.shipping_option_id }),
|
|
1167
|
+
});
|
|
1168
|
+
const result = await response.json();
|
|
1169
|
+
return {
|
|
1170
|
+
amount: result.newTotalAmount,
|
|
1171
|
+
};
|
|
1172
|
+
});
|
|
1173
|
+
```
|
|
1174
|
+
**Example**
|
|
1175
|
+
```js
|
|
1176
|
+
// Sync handler
|
|
1177
|
+
button.onShippingOptionsChange((data) => {
|
|
1178
|
+
return {
|
|
1179
|
+
amount: lookupShippingCost(data.data.shipping_option_id),
|
|
1180
|
+
};
|
|
1181
|
+
});
|
|
1182
|
+
```
|
|
1183
|
+
<a name="OpenWalletButtons" id="OpenWalletButtons" href="#OpenWalletButtons"> </a>
|
|
1184
|
+
|
|
1185
|
+
## *OpenWalletButtons*
|
|
1186
|
+
Abstract base class for Open Wallet buttons. **Do not instantiate directly.**
|
|
1187
|
+
Use [ApplePayOpenWalletButton](#ApplePayOpenWalletButton) or [GooglePayOpenWalletButton](#GooglePayOpenWalletButton) instead.
|
|
1188
|
+
|
|
1189
|
+
Use one of the concrete implementations instead:
|
|
1190
|
+
- [ApplePayOpenWalletButton](#ApplePayOpenWalletButton) for Apple Pay integration
|
|
1191
|
+
- [GooglePayOpenWalletButton](#GooglePayOpenWalletButton) for Google Pay integration
|
|
1192
|
+
|
|
1193
|
+
These subclasses inherit all event handlers and lifecycle methods documented below.
|
|
1194
|
+
|
|
1195
|
+
**Kind**: global abstract class
|
|
1196
|
+
|
|
1197
|
+
* *[OpenWalletButtons](#OpenWalletButtons)*
|
|
1198
|
+
* *[.load()](#OpenWalletButtons+load)*
|
|
1199
|
+
* *[.setEnv(env, [alias])](#OpenWalletButtons+setEnv)*
|
|
1200
|
+
* *[.setMeta(meta)](#OpenWalletButtons+setMeta)*
|
|
1201
|
+
* *[.destroy()](#OpenWalletButtons+destroy)*
|
|
1202
|
+
* *[.onClick(handler)](#OpenWalletButtons+onClick)*
|
|
1203
|
+
* *[.onSuccess(handler)](#OpenWalletButtons+onSuccess)*
|
|
1204
|
+
* *[.onUnavailable(handler)](#OpenWalletButtons+onUnavailable)*
|
|
1205
|
+
* *[.onError(handler)](#OpenWalletButtons+onError)*
|
|
1206
|
+
* *[.onCancel(handler)](#OpenWalletButtons+onCancel)*
|
|
1207
|
+
* *[.onLoaded(handler)](#OpenWalletButtons+onLoaded)*
|
|
1208
|
+
* *[.onShippingAddressChange(handler)](#OpenWalletButtons+onShippingAddressChange)*
|
|
1209
|
+
* *[.onShippingOptionsChange(handler)](#OpenWalletButtons+onShippingOptionsChange)*
|
|
1210
|
+
|
|
1211
|
+
<a name="OpenWalletButtons+load" id="OpenWalletButtons+load" href="#OpenWalletButtons+load"> </a>
|
|
1212
|
+
|
|
1213
|
+
### *openWalletButtons.load()*
|
|
1214
|
+
Loads and initializes the wallet button based on the service configuration.
|
|
1215
|
+
This method fetches the wallet service configuration, validates that the service
|
|
1216
|
+
type matches the expected wallet, and creates the appropriate wallet service instance.
|
|
1217
|
+
Bear in mind that you must call this method after setting up all event handlers.
|
|
1218
|
+
|
|
1219
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1220
|
+
**Example**
|
|
1221
|
+
```js
|
|
1222
|
+
button.onClick((data) => { ... });
|
|
1223
|
+
button.onSuccess((data) => { ... });
|
|
1224
|
+
button.onError((error) => { ... });
|
|
1225
|
+
button.load();
|
|
1226
|
+
```
|
|
1227
|
+
<a name="OpenWalletButtons+setEnv" id="OpenWalletButtons+setEnv" href="#OpenWalletButtons+setEnv"> </a>
|
|
1228
|
+
|
|
1229
|
+
### *openWalletButtons.setEnv(env, [alias])*
|
|
1230
|
+
Current method can change environment. By default environment = sandbox.
|
|
1231
|
+
Also we can change domain alias for this environment. By default domain_alias = paydock.com
|
|
1232
|
+
Bear in mind that you must set an environment before calling `button.load()`.
|
|
1233
|
+
|
|
1234
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1235
|
+
|
|
1236
|
+
| Param | Type | Description |
|
|
1237
|
+
| --- | --- | --- |
|
|
1238
|
+
| env | <code>string</code> | The target environment: `'sandbox'` or `'production'`. |
|
|
1239
|
+
| [alias] | <code>string</code> | Own domain alias. |
|
|
1240
|
+
|
|
1241
|
+
**Example**
|
|
1242
|
+
```js
|
|
1243
|
+
button.setEnv('production', 'paydock.com');
|
|
1244
|
+
```
|
|
1245
|
+
<a name="OpenWalletButtons+setMeta" id="OpenWalletButtons+setMeta" href="#OpenWalletButtons+setMeta"> </a>
|
|
1246
|
+
|
|
1247
|
+
### *openWalletButtons.setMeta(meta)*
|
|
1248
|
+
Updates the wallet metadata after initialization.
|
|
1249
|
+
Use this when order information changes (e.g. amount, currency) after the button has been rendered.
|
|
1250
|
+
Bear in mind that this must be called before the next payment attempt takes effect.
|
|
1251
|
+
|
|
1252
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1253
|
+
|
|
1254
|
+
| Param | Type | Description |
|
|
1255
|
+
| --- | --- | --- |
|
|
1256
|
+
| meta | [<code>ApplePayOpenWalletMeta</code>](#ApplePayOpenWalletMeta) \| [<code>GooglePayOpenWalletMeta</code>](#GooglePayOpenWalletMeta) | The updated metadata object. The concrete type depends on the button class. |
|
|
1257
|
+
|
|
1258
|
+
**Example**
|
|
1259
|
+
```js
|
|
1260
|
+
button.setMeta({ ...meta, amount: 29.99 });
|
|
1261
|
+
```
|
|
1262
|
+
<a name="OpenWalletButtons+destroy" id="OpenWalletButtons+destroy" href="#OpenWalletButtons+destroy"> </a>
|
|
1263
|
+
|
|
1264
|
+
### *openWalletButtons.destroy()*
|
|
1265
|
+
Removes the wallet button from the DOM and cleans up resources.
|
|
1266
|
+
Call this method when the wallet button is no longer needed (e.g. navigating away from the payment page).
|
|
1267
|
+
|
|
1268
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1269
|
+
**Example**
|
|
1270
|
+
```js
|
|
1271
|
+
button.destroy();
|
|
1272
|
+
```
|
|
1273
|
+
<a name="OpenWalletButtons+onClick" id="OpenWalletButtons+onClick" href="#OpenWalletButtons+onClick"> </a>
|
|
1274
|
+
|
|
1275
|
+
### *openWalletButtons.onClick(handler)*
|
|
1276
|
+
Registers a callback function to be invoked when the wallet button gets clicked.
|
|
1277
|
+
The handler controls the wallet payment flow via its return value:
|
|
1278
|
+
|
|
1279
|
+
- Return `void` (or nothing) to continue the payment flow normally.
|
|
1280
|
+
- Return `false` to abort the payment flow.
|
|
1281
|
+
- Return a `Promise<void>` to defer the wallet sheet until the promise resolves.
|
|
1282
|
+
- Return a `Promise<boolean>` — if it resolves to `false`, the flow is aborted.
|
|
1283
|
+
- Throwing an error (sync or async) also aborts the flow.
|
|
1284
|
+
|
|
1285
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1286
|
+
|
|
1287
|
+
**Note:** this callback may be called multiple times as the customer closes the payment
|
|
1288
|
+
checkout and re-clicks the button.
|
|
1289
|
+
|
|
1290
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1291
|
+
|
|
1292
|
+
| Param | Type | Description |
|
|
1293
|
+
| --- | --- | --- |
|
|
1294
|
+
| handler | [<code>OnClickCallback</code>](#OnClickCallback) | Function to be called when the wallet button is clicked. |
|
|
1295
|
+
|
|
1296
|
+
**Example**
|
|
1297
|
+
```js
|
|
1298
|
+
// Synchronous usage — continue normally
|
|
1299
|
+
button.onClick((event) => {
|
|
1300
|
+
performValidationLogic();
|
|
1301
|
+
});
|
|
1302
|
+
```
|
|
1303
|
+
**Example**
|
|
1304
|
+
```js
|
|
1305
|
+
// Synchronous abort — return false to cancel the payment
|
|
1306
|
+
button.onClick((event) => {
|
|
1307
|
+
if (!isOrderValid()) return false;
|
|
1308
|
+
});
|
|
1309
|
+
```
|
|
1310
|
+
**Example**
|
|
1311
|
+
```js
|
|
1312
|
+
// Asynchronous usage — defer wallet sheet until the promise resolves
|
|
1313
|
+
button.onClick(async (event) => {
|
|
1314
|
+
await fetch('/validate-order').then(res => res.json());
|
|
1315
|
+
});
|
|
1316
|
+
```
|
|
1317
|
+
<a name="OpenWalletButtons+onSuccess" id="OpenWalletButtons+onSuccess" href="#OpenWalletButtons+onSuccess"> </a>
|
|
1318
|
+
|
|
1319
|
+
### *openWalletButtons.onSuccess(handler)*
|
|
1320
|
+
Registers a callback function to be invoked when the OTT (One-Time Token) creation was successful.
|
|
1321
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1322
|
+
|
|
1323
|
+
**Important:** A handler is required. Do not perform thread blocking operations in callback such as `window.alert()` calls.
|
|
1324
|
+
|
|
1325
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1326
|
+
so that internal processing continues uninterrupted.
|
|
1327
|
+
|
|
1328
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1329
|
+
|
|
1330
|
+
| Param | Type | Description |
|
|
1331
|
+
| --- | --- | --- |
|
|
1332
|
+
| handler | [<code>OnSuccessCallback</code>](#OnSuccessCallback) | Function to be called when the OTT creation was successful. |
|
|
1333
|
+
|
|
1334
|
+
**Example**
|
|
1335
|
+
```js
|
|
1336
|
+
button.onSuccess((event) => {
|
|
1337
|
+
console.log('OTT created:', event.data.token.temp_token);
|
|
1338
|
+
console.log('Amount:', event.data.amount);
|
|
1339
|
+
});
|
|
1340
|
+
```
|
|
1341
|
+
**Example**
|
|
1342
|
+
```js
|
|
1343
|
+
// Async handler
|
|
1344
|
+
button.onSuccess(async (event) => {
|
|
1345
|
+
await submitTokenToServer(event.data.token.temp_token);
|
|
1346
|
+
});
|
|
1347
|
+
```
|
|
1348
|
+
<a name="OpenWalletButtons+onUnavailable" id="OpenWalletButtons+onUnavailable" href="#OpenWalletButtons+onUnavailable"> </a>
|
|
1349
|
+
|
|
1350
|
+
### *openWalletButtons.onUnavailable(handler)*
|
|
1351
|
+
Registers a callback function to be invoked when the wallet is not available in the current context.
|
|
1352
|
+
This can happen when the wallet service is not supported on the current device or browser.
|
|
1353
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1354
|
+
|
|
1355
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1356
|
+
so that internal processing continues uninterrupted.
|
|
1357
|
+
|
|
1358
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1359
|
+
|
|
1360
|
+
| Param | Type | Description |
|
|
1361
|
+
| --- | --- | --- |
|
|
1362
|
+
| handler | [<code>OnUnavailableCallback</code>](#OnUnavailableCallback) | Function to be called when the wallet is not available in the current context. |
|
|
1363
|
+
|
|
1364
|
+
**Example**
|
|
1365
|
+
```js
|
|
1366
|
+
button.onUnavailable((event) => {
|
|
1367
|
+
console.log('Wallet not available:', event.data.reason);
|
|
1368
|
+
});
|
|
1369
|
+
```
|
|
1370
|
+
<a name="OpenWalletButtons+onError" id="OpenWalletButtons+onError" href="#OpenWalletButtons+onError"> </a>
|
|
1371
|
+
|
|
1372
|
+
### *openWalletButtons.onError(handler)*
|
|
1373
|
+
Registers a callback function to be invoked when an error occurs during wallet operation.
|
|
1374
|
+
This includes configuration issues, validation errors, and OTT creation failures.
|
|
1375
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1376
|
+
|
|
1377
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1378
|
+
so that internal processing continues uninterrupted.
|
|
1379
|
+
|
|
1380
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1381
|
+
|
|
1382
|
+
| Param | Type | Description |
|
|
1383
|
+
| --- | --- | --- |
|
|
1384
|
+
| handler | [<code>OnErrorCallback</code>](#OnErrorCallback) | Function to be called when the wallet has an error. |
|
|
1385
|
+
|
|
1386
|
+
**Example**
|
|
1387
|
+
```js
|
|
1388
|
+
button.onError((event) => {
|
|
1389
|
+
console.error('Wallet error:', event.data.error.message);
|
|
1390
|
+
console.log('Context:', event.data.context);
|
|
1391
|
+
});
|
|
1392
|
+
```
|
|
1393
|
+
<a name="OpenWalletButtons+onCancel" id="OpenWalletButtons+onCancel" href="#OpenWalletButtons+onCancel"> </a>
|
|
1394
|
+
|
|
1395
|
+
### *openWalletButtons.onCancel(handler)*
|
|
1396
|
+
Registers a callback function to be invoked when the wallet checkout is cancelled or closed by the user.
|
|
1397
|
+
This event is triggered when the user dismisses the wallet payment interface without completing the transaction.
|
|
1398
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1399
|
+
|
|
1400
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1401
|
+
so that internal processing continues uninterrupted.
|
|
1402
|
+
|
|
1403
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1404
|
+
|
|
1405
|
+
| Param | Type | Description |
|
|
1406
|
+
| --- | --- | --- |
|
|
1407
|
+
| handler | [<code>OnCancelCallback</code>](#OnCancelCallback) | Function to be called when the wallet checkout is cancelled. |
|
|
1408
|
+
|
|
1409
|
+
**Example**
|
|
1410
|
+
```js
|
|
1411
|
+
button.onCancel((event) => {
|
|
1412
|
+
console.log('Wallet checkout cancelled', event);
|
|
1413
|
+
});
|
|
1414
|
+
```
|
|
1415
|
+
<a name="OpenWalletButtons+onLoaded" id="OpenWalletButtons+onLoaded" href="#OpenWalletButtons+onLoaded"> </a>
|
|
1416
|
+
|
|
1417
|
+
### *openWalletButtons.onLoaded(handler)*
|
|
1418
|
+
Registers a callback function to be invoked when the wallet button has been loaded and rendered in the DOM.
|
|
1419
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1420
|
+
|
|
1421
|
+
**Error handling:** If the handler throws (sync or async), the error is logged and swallowed
|
|
1422
|
+
so that internal processing continues uninterrupted.
|
|
1423
|
+
|
|
1424
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1425
|
+
|
|
1426
|
+
| Param | Type | Description |
|
|
1427
|
+
| --- | --- | --- |
|
|
1428
|
+
| handler | <code>function</code> | Function to be called when the wallet button is loaded. |
|
|
1429
|
+
|
|
1430
|
+
**Example**
|
|
1431
|
+
```js
|
|
1432
|
+
button.onLoaded((event) => {
|
|
1433
|
+
console.log('Wallet button loaded');
|
|
1434
|
+
});
|
|
1435
|
+
```
|
|
1436
|
+
<a name="OpenWalletButtons+onShippingAddressChange" id="OpenWalletButtons+onShippingAddressChange" href="#OpenWalletButtons+onShippingAddressChange"> </a>
|
|
1437
|
+
|
|
1438
|
+
### *openWalletButtons.onShippingAddressChange(handler)*
|
|
1439
|
+
Registers a callback for when the customer selects or updates their shipping address.
|
|
1440
|
+
Use this method to listen for shipping address selection or input from customer when shipping is enabled.
|
|
1441
|
+
The event handler should return updated payment information including the new amount and
|
|
1442
|
+
available shipping options based on the selected address.
|
|
1443
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1444
|
+
|
|
1445
|
+
In case of an address validation error, include the `error` field in the response
|
|
1446
|
+
to display an appropriate error in the wallet payment sheet.
|
|
1447
|
+
|
|
1448
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1449
|
+
|
|
1450
|
+
| Param | Type | Description |
|
|
1451
|
+
| --- | --- | --- |
|
|
1452
|
+
| handler | [<code>OnShippingAddressChangeCallback</code>](#OnShippingAddressChangeCallback) | Function to be called when the shipping address data is updated. |
|
|
1453
|
+
|
|
1454
|
+
**Example**
|
|
1455
|
+
```js
|
|
1456
|
+
// Async handler
|
|
1457
|
+
button.onShippingAddressChange(async (data) => {
|
|
1458
|
+
const response = await fetch('https://your-server.com/update-shipping-address', {
|
|
1459
|
+
method: 'POST',
|
|
1460
|
+
body: JSON.stringify(data),
|
|
1461
|
+
});
|
|
1462
|
+
const result = await response.json();
|
|
1463
|
+
return {
|
|
1464
|
+
amount: result.newAmount,
|
|
1465
|
+
shipping_options: result.availableShippingOptions,
|
|
1466
|
+
};
|
|
1467
|
+
});
|
|
1468
|
+
```
|
|
1469
|
+
**Example**
|
|
1470
|
+
```js
|
|
1471
|
+
// Sync handler
|
|
1472
|
+
button.onShippingAddressChange((data) => {
|
|
1473
|
+
return {
|
|
1474
|
+
amount: calculateShipping(data.data.address_country),
|
|
1475
|
+
shipping_options: getOptionsForCountry(data.data.address_country),
|
|
1476
|
+
};
|
|
1477
|
+
});
|
|
1478
|
+
```
|
|
1479
|
+
<a name="OpenWalletButtons+onShippingOptionsChange" id="OpenWalletButtons+onShippingOptionsChange" href="#OpenWalletButtons+onShippingOptionsChange"> </a>
|
|
1480
|
+
|
|
1481
|
+
### *openWalletButtons.onShippingOptionsChange(handler)*
|
|
1482
|
+
Registers a callback for when the customer selects a shipping option.
|
|
1483
|
+
Use this method to listen for shipping option selection from customer when shipping is enabled.
|
|
1484
|
+
The event handler should return the updated payment amount based on the selected shipping option.
|
|
1485
|
+
Both synchronous and asynchronous (async) handlers are supported.
|
|
1486
|
+
|
|
1487
|
+
**Kind**: instance method of [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
1488
|
+
|
|
1489
|
+
| Param | Type | Description |
|
|
1490
|
+
| --- | --- | --- |
|
|
1491
|
+
| handler | [<code>OnShippingOptionsChangeCallback</code>](#OnShippingOptionsChangeCallback) | Function to be called when the shipping options data is updated. |
|
|
1492
|
+
|
|
1493
|
+
**Example**
|
|
1494
|
+
```js
|
|
1495
|
+
// Async handler
|
|
1496
|
+
button.onShippingOptionsChange(async (data) => {
|
|
1497
|
+
const response = await fetch('https://your-server.com/update-shipping-option', {
|
|
1498
|
+
method: 'POST',
|
|
1499
|
+
body: JSON.stringify({ shipping_option_id: data.data.shipping_option_id }),
|
|
1500
|
+
});
|
|
1501
|
+
const result = await response.json();
|
|
1502
|
+
return {
|
|
1503
|
+
amount: result.newTotalAmount,
|
|
1504
|
+
};
|
|
1505
|
+
});
|
|
1506
|
+
```
|
|
1507
|
+
**Example**
|
|
1508
|
+
```js
|
|
1509
|
+
// Sync handler
|
|
1510
|
+
button.onShippingOptionsChange((data) => {
|
|
1511
|
+
return {
|
|
1512
|
+
amount: lookupShippingCost(data.data.shipping_option_id),
|
|
1513
|
+
};
|
|
1514
|
+
});
|
|
1515
|
+
```
|
|
1516
|
+
<a name="EVENT" id="EVENT" href="#EVENT"> </a>
|
|
1517
|
+
|
|
1518
|
+
## EVENT : <code>object</code>
|
|
1519
|
+
List of available event names in the Open Wallet button lifecycle.
|
|
1520
|
+
|
|
1521
|
+
**Kind**: global constant
|
|
1522
|
+
|
|
1523
|
+
| Param | Type | Default | Description |
|
|
1524
|
+
| --- | --- | --- | --- |
|
|
1525
|
+
| ON_CLICK | <code>string</code> | <code>"onClick"</code> | Emitted when the wallet button is clicked. |
|
|
1526
|
+
| SUCCESS | <code>string</code> | <code>"success"</code> | Emitted when OTT creation succeeds. |
|
|
1527
|
+
| UNAVAILABLE | <code>string</code> | <code>"unavailable"</code> | Emitted when the wallet is not available. |
|
|
1528
|
+
| ERROR | <code>string</code> | <code>"error"</code> | Emitted when an error occurs. |
|
|
1529
|
+
| LOADED | <code>string</code> | <code>"loaded"</code> | Emitted when the button is rendered. |
|
|
1530
|
+
| CHECKOUT_CLOSE | <code>string</code> | <code>"checkoutClose"</code> | Emitted when the wallet checkout is cancelled. |
|
|
1531
|
+
| ON_SHIPPING_ADDRESS_CHANGE | <code>string</code> | <code>"onShippingAddressChange"</code> | Emitted when shipping address changes. |
|
|
1532
|
+
| ON_SHIPPING_OPTIONS_CHANGE | <code>string</code> | <code>"onShippingOptionsChange"</code> | Emitted when shipping option changes. |
|
|
1533
|
+
|
|
1534
|
+
<a name="WALLET_TYPES" id="WALLET_TYPES" href="#WALLET_TYPES"> </a>
|
|
1535
|
+
|
|
1536
|
+
## WALLET\_TYPES : <code>object</code>
|
|
1537
|
+
Enum of available wallet types.
|
|
1538
|
+
|
|
1539
|
+
**Kind**: global constant
|
|
1540
|
+
|
|
1541
|
+
| Param | Type | Default | Description |
|
|
1542
|
+
| --- | --- | --- | --- |
|
|
1543
|
+
| APPLE_PAY | <code>string</code> | <code>"apple"</code> | Apple Pay wallet. |
|
|
1544
|
+
| GOOGLE_PAY | <code>string</code> | <code>"google"</code> | Google Pay wallet. |
|
|
1545
|
+
|
|
1546
|
+
<a name="TOKEN_TYPE" id="TOKEN_TYPE" href="#TOKEN_TYPE"> </a>
|
|
1547
|
+
|
|
1548
|
+
## TOKEN\_TYPE : <code>object</code>
|
|
1549
|
+
Token types returned in the OTT (One-Time Token) creation response.
|
|
1550
|
+
|
|
1551
|
+
**Kind**: global constant
|
|
1552
|
+
|
|
1553
|
+
| Param | Type | Default | Description |
|
|
1554
|
+
| --- | --- | --- | --- |
|
|
1555
|
+
| CARD | <code>string</code> | <code>"card"</code> | FPAN (Funding Primary Account Number). Available for Google Pay only. |
|
|
1556
|
+
| CARD_SCHEME_TOKEN | <code>string</code> | <code>"card_scheme_token"</code> | DPAN (Device Primary Account Number). Available for both Apple Pay and Google Pay. |
|
|
1557
|
+
|
|
1558
|
+
<a name="ERROR_OPERATION" id="ERROR_OPERATION" href="#ERROR_OPERATION"> </a>
|
|
1559
|
+
|
|
1560
|
+
## ERROR\_OPERATION : <code>object</code>
|
|
1561
|
+
Operations that can fail during the wallet lifecycle.
|
|
1562
|
+
Used in the `context.operation` field of [OnErrorEventData](#OnErrorEventData).
|
|
1563
|
+
|
|
1564
|
+
**Kind**: global constant
|
|
1565
|
+
|
|
1566
|
+
| Param | Type | Default | Description |
|
|
1567
|
+
| --- | --- | --- | --- |
|
|
1568
|
+
| WALLET_OPERATION | <code>string</code> | <code>"wallet_operation"</code> | General wallet lifecycle operation (default). |
|
|
1569
|
+
| CONFIGURATION | <code>string</code> | <code>"configuration"</code> | Loading or validating the wallet service configuration (e.g. network fetch failure, card config validation). |
|
|
1570
|
+
| HANDLER_REGISTRATION | <code>string</code> | <code>"handler_registration"</code> | A required event handler was not registered before calling load(). |
|
|
1571
|
+
| SHIPPING_UPDATE | <code>string</code> | <code>"shipping_update"</code> | Processing a shipping address or shipping option update failed. |
|
|
1572
|
+
|
|
1573
|
+
<a name="OnClickCallback" id="OnClickCallback" href="#OnClickCallback"> </a>
|
|
1574
|
+
|
|
1575
|
+
## OnClickCallback ⇒ <code>boolean</code> \| <code>void</code> \| <code>Promise.<(boolean\|void)></code>
|
|
1576
|
+
Callback for onClick method.
|
|
1577
|
+
|
|
1578
|
+
**Kind**: global typedef
|
|
1579
|
+
**Returns**: <code>boolean</code> \| <code>void</code> \| <code>Promise.<(boolean\|void)></code> - Return `false` to abort, or a Promise to defer.
|
|
1580
|
+
|
|
1581
|
+
| Param | Type | Description |
|
|
1582
|
+
| --- | --- | --- |
|
|
1583
|
+
| data | [<code>OnClickEventData</code>](#OnClickEventData) | The click event data. |
|
|
1584
|
+
|
|
1585
|
+
<a name="OnSuccessCallback" id="OnSuccessCallback" href="#OnSuccessCallback"> </a>
|
|
1586
|
+
|
|
1587
|
+
## OnSuccessCallback : <code>function</code>
|
|
1588
|
+
Callback for onSuccess method.
|
|
1589
|
+
|
|
1590
|
+
**Kind**: global typedef
|
|
1591
|
+
|
|
1592
|
+
| Param | Type | Description |
|
|
1593
|
+
| --- | --- | --- |
|
|
1594
|
+
| data | [<code>OnCreateOTTSuccessfulEventData</code>](#OnCreateOTTSuccessfulEventData) | The OTT creation result including the token, amount, and address data. |
|
|
1595
|
+
|
|
1596
|
+
<a name="OnUnavailableCallback" id="OnUnavailableCallback" href="#OnUnavailableCallback"> </a>
|
|
1597
|
+
|
|
1598
|
+
## OnUnavailableCallback : <code>function</code>
|
|
1599
|
+
Callback for onUnavailable method.
|
|
1600
|
+
|
|
1601
|
+
**Kind**: global typedef
|
|
1602
|
+
|
|
1603
|
+
| Param | Type | Description |
|
|
1604
|
+
| --- | --- | --- |
|
|
1605
|
+
| data | [<code>OnUnavailableEventData</code>](#OnUnavailableEventData) | Data describing why the wallet is unavailable. |
|
|
1606
|
+
|
|
1607
|
+
<a name="OnErrorCallback" id="OnErrorCallback" href="#OnErrorCallback"> </a>
|
|
1608
|
+
|
|
1609
|
+
## OnErrorCallback : <code>function</code>
|
|
1610
|
+
Callback for onError method.
|
|
1611
|
+
|
|
1612
|
+
**Kind**: global typedef
|
|
1613
|
+
|
|
1614
|
+
| Param | Type | Description |
|
|
1615
|
+
| --- | --- | --- |
|
|
1616
|
+
| data | [<code>OnErrorEventData</code>](#OnErrorEventData) | The error event data including the Error object and context. |
|
|
1617
|
+
|
|
1618
|
+
<a name="OnCancelCallback" id="OnCancelCallback" href="#OnCancelCallback"> </a>
|
|
1619
|
+
|
|
1620
|
+
## OnCancelCallback : <code>function</code>
|
|
1621
|
+
Callback for onCancel method.
|
|
1622
|
+
|
|
1623
|
+
**Kind**: global typedef
|
|
1624
|
+
|
|
1625
|
+
| Param | Type | Description |
|
|
1626
|
+
| --- | --- | --- |
|
|
1627
|
+
| data | [<code>OnCancelEventData</code>](#OnCancelEventData) | Data associated with the cancellation event. |
|
|
1628
|
+
|
|
1629
|
+
<a name="OnShippingAddressChangeCallback" id="OnShippingAddressChangeCallback" href="#OnShippingAddressChangeCallback"> </a>
|
|
1630
|
+
|
|
1631
|
+
## OnShippingAddressChangeCallback ⇒ [<code>OnShippingAddressChangeEventResponse</code>](#OnShippingAddressChangeEventResponse) \| [<code>Promise.<OnShippingAddressChangeEventResponse></code>](#OnShippingAddressChangeEventResponse)
|
|
1632
|
+
Callback for onShippingAddressChange method.
|
|
1633
|
+
|
|
1634
|
+
**Kind**: global typedef
|
|
1635
|
+
**Returns**: [<code>OnShippingAddressChangeEventResponse</code>](#OnShippingAddressChangeEventResponse) \| [<code>Promise.<OnShippingAddressChangeEventResponse></code>](#OnShippingAddressChangeEventResponse) - Address update result containing updated amount, shipping options, and optional error.
|
|
1636
|
+
|
|
1637
|
+
| Param | Type | Description |
|
|
1638
|
+
| --- | --- | --- |
|
|
1639
|
+
| data | [<code>OnShippingAddressChangeEventData</code>](#OnShippingAddressChangeEventData) | The shipping address data from the wallet. |
|
|
1640
|
+
|
|
1641
|
+
<a name="OnShippingOptionsChangeCallback" id="OnShippingOptionsChangeCallback" href="#OnShippingOptionsChangeCallback"> </a>
|
|
1642
|
+
|
|
1643
|
+
## OnShippingOptionsChangeCallback ⇒ [<code>OnShippingOptionChangeEventResponse</code>](#OnShippingOptionChangeEventResponse) \| [<code>Promise.<OnShippingOptionChangeEventResponse></code>](#OnShippingOptionChangeEventResponse)
|
|
1644
|
+
Callback for onShippingOptionsChange method.
|
|
1645
|
+
|
|
1646
|
+
**Kind**: global typedef
|
|
1647
|
+
**Returns**: [<code>OnShippingOptionChangeEventResponse</code>](#OnShippingOptionChangeEventResponse) \| [<code>Promise.<OnShippingOptionChangeEventResponse></code>](#OnShippingOptionChangeEventResponse) - Shipping options update result containing the updated amount.
|
|
1648
|
+
|
|
1649
|
+
| Param | Type | Description |
|
|
1650
|
+
| --- | --- | --- |
|
|
1651
|
+
| data | [<code>OnShippingOptionChangeEventData</code>](#OnShippingOptionChangeEventData) | The selected shipping option data. |
|
|
1652
|
+
|