@paydock/client-sdk 1.144.1-beta → 1.147.0
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 +551 -32
- package/bundles/index.cjs +2683 -599
- package/bundles/index.cjs.d.ts +322 -21
- package/bundles/index.mjs +2683 -600
- package/bundles/index.mjs.d.ts +322 -21
- package/bundles/types/api/api-base.d.ts +6 -0
- package/bundles/types/api/api-base.d.ts.map +1 -1
- package/bundles/types/api/api-charge-internal.d.ts +1 -5
- package/bundles/types/api/api-charge-internal.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts +50 -0
- package/bundles/types/canvas-3ds/canvas-3ds-event-map.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts +7 -5
- package/bundles/types/canvas-3ds/canvas-3ds.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/index.d.ts +1 -1
- package/bundles/types/canvas-3ds/index.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts +117 -2
- package/bundles/types/canvas-3ds/services/gpayments-service.d.ts.map +1 -1
- package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts +6 -0
- package/bundles/types/canvas-3ds/services/standalone3ds-service.d.ts.map +1 -1
- package/bundles/types/components/iframe-event.d.ts +4 -3
- package/bundles/types/components/iframe-event.d.ts.map +1 -1
- package/bundles/types/components/iframe.d.ts +5 -0
- package/bundles/types/components/iframe.d.ts.map +1 -1
- package/bundles/types/components/param.d.ts +19 -0
- package/bundles/types/components/param.d.ts.map +1 -1
- package/bundles/types/helper/browser.d.ts.map +1 -1
- package/bundles/types/helper/element-id.d.ts +3 -1
- package/bundles/types/helper/element-id.d.ts.map +1 -1
- package/bundles/types/helper/uuid.d.ts.map +1 -1
- package/bundles/types/index-cba.d.ts +1 -1
- package/bundles/types/index-cba.d.ts.map +1 -1
- package/bundles/types/index.d.ts +2 -2
- package/bundles/types/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts +41 -0
- package/bundles/types/open-wallets/apple-pay-open-wallet-button.d.ts.map +1 -1
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts +10 -0
- package/bundles/types/open-wallets/base/open-wallet-buttons.d.ts.map +1 -1
- package/bundles/types/open-wallets/base/service-config-cache.d.ts +23 -0
- package/bundles/types/open-wallets/base/service-config-cache.d.ts.map +1 -0
- package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts +33 -1
- package/bundles/types/open-wallets/google-pay-open-wallet-button.d.ts.map +1 -1
- package/bundles/types/open-wallets/index.d.ts +82 -1
- package/bundles/types/open-wallets/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-availability.interface.d.ts +41 -0
- package/bundles/types/open-wallets/interfaces/apple-pay/apple-pay-availability.interface.d.ts.map +1 -0
- package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts +1 -0
- package/bundles/types/open-wallets/interfaces/apple-pay/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/google-pay/google-pay-availability.interface.d.ts +25 -0
- package/bundles/types/open-wallets/interfaces/google-pay/google-pay-availability.interface.d.ts.map +1 -0
- package/bundles/types/open-wallets/interfaces/google-pay/index.d.ts +1 -0
- package/bundles/types/open-wallets/interfaces/google-pay/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/index.d.ts +3 -0
- package/bundles/types/open-wallets/interfaces/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/interfaces/open-wallet-availability.interface.d.ts +31 -0
- package/bundles/types/open-wallets/interfaces/open-wallet-availability.interface.d.ts.map +1 -0
- package/bundles/types/open-wallets/services/apple-pay/apple-pay-availability.d.ts +58 -0
- package/bundles/types/open-wallets/services/apple-pay/apple-pay-availability.d.ts.map +1 -0
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts +8 -10
- package/bundles/types/open-wallets/services/apple-pay/apple-pay.open-wallet.service.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/apple-pay/index.d.ts +1 -0
- package/bundles/types/open-wallets/services/apple-pay/index.d.ts.map +1 -1
- package/bundles/types/open-wallets/services/google-pay/google-pay-availability.d.ts +53 -0
- package/bundles/types/open-wallets/services/google-pay/google-pay-availability.d.ts.map +1 -0
- 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/index.d.ts +1 -0
- package/bundles/types/open-wallets/services/google-pay/index.d.ts.map +1 -1
- package/bundles/types/widget/multi-widget.d.ts +19 -0
- package/bundles/types/widget/multi-widget.d.ts.map +1 -1
- package/bundles/widget.umd.js +2683 -599
- package/bundles/widget.umd.js.d.ts +322 -21
- package/bundles/widget.umd.js.min.d.ts +322 -21
- package/bundles/widget.umd.min.js +1 -1
- package/docs/api-canvas3ds.md +10 -8
- package/docs/api-checkout-button.md +15 -0
- package/docs/api-ps-widget.md +15 -0
- package/docs/api-widget.md +15 -0
- package/docs/canvas3ds-examples.md +43 -1
- package/docs/open-wallet-buttons-examples.md +170 -2
- package/docs/open-wallet-buttons.md +252 -29
- package/docs/widget-examples.md +41 -0
- package/package.json +20 -11
- package/slate.md +254 -3
|
@@ -100,6 +100,37 @@ Apple will determine if the device has an ApplePay wallet available and at least
|
|
|
100
100
|
<dt><a href="#GooglePayOpenWalletMeta">GooglePayOpenWalletMeta</a> : <code>object</code></dt>
|
|
101
101
|
<dd><p>Interface for Google Pay-specific metadata.</p>
|
|
102
102
|
</dd>
|
|
103
|
+
<dt><a href="#OpenWalletAvailabilityOptions">OpenWalletAvailabilityOptions</a> : <code>object</code></dt>
|
|
104
|
+
<dd><p>Base options shared by every wallet's static availability check
|
|
105
|
+
(e.g. <a href="#ApplePayOpenWalletButton">ApplePayOpenWalletButton</a>.checkAvailability). Wallet-specific option
|
|
106
|
+
interfaces (such as <a href="#ApplePayAvailabilityOptions">ApplePayAvailabilityOptions</a>) extend this.</p>
|
|
107
|
+
</dd>
|
|
108
|
+
<dt><a href="#OpenWalletAvailabilityResult">OpenWalletAvailabilityResult</a> : <code>object</code></dt>
|
|
109
|
+
<dd><p>Base result shared by every wallet's static availability check. Wallet-specific
|
|
110
|
+
result interfaces (such as <a href="#ApplePayAvailabilityResult">ApplePayAvailabilityResult</a>) extend this.</p>
|
|
111
|
+
</dd>
|
|
112
|
+
<dt><a href="#ApplePayAvailabilityOptions">ApplePayAvailabilityOptions</a> : <code>object</code></dt>
|
|
113
|
+
<dd><p>Options for <code>ApplePayOpenWalletButton.checkAvailability</code>. Extends
|
|
114
|
+
<a href="#OpenWalletAvailabilityOptions">OpenWalletAvailabilityOptions</a>. Provide <code>merchant_id</code> directly to skip the network
|
|
115
|
+
call, <strong>or</strong> provide <code>public_key_or_access_token</code> + <code>service_id</code> to resolve the merchant
|
|
116
|
+
identifier from the service configuration.</p>
|
|
117
|
+
</dd>
|
|
118
|
+
<dt><a href="#ApplePayAvailabilityResult">ApplePayAvailabilityResult</a> : <code>object</code></dt>
|
|
119
|
+
<dd><p>Result of <code>ApplePayOpenWalletButton.checkAvailability</code>. Extends
|
|
120
|
+
<a href="#OpenWalletAvailabilityResult">OpenWalletAvailabilityResult</a>.</p>
|
|
121
|
+
<p>Infer the transport (Apple does not expose it directly): <code>available && has_native_session</code>
|
|
122
|
+
⇒ native sheet likely; <code>available && !has_native_session</code> ⇒ cross-device / QR handoff likely.</p>
|
|
123
|
+
</dd>
|
|
124
|
+
<dt><a href="#GooglePayAvailabilityOptions">GooglePayAvailabilityOptions</a> : <code>object</code></dt>
|
|
125
|
+
<dd><p>Options for <code>GooglePayOpenWalletButton.checkAvailability</code>. Extends
|
|
126
|
+
<a href="#OpenWalletAvailabilityOptions">OpenWalletAvailabilityOptions</a>. All fields are optional — Google Pay's
|
|
127
|
+
<code>isReadyToPay</code> check does not require a merchant identifier. Supplying
|
|
128
|
+
<code>public_key_or_access_token</code> + <code>service_id</code> additionally validates the service type.</p>
|
|
129
|
+
</dd>
|
|
130
|
+
<dt><a href="#GooglePayAvailabilityResult">GooglePayAvailabilityResult</a> : <code>object</code></dt>
|
|
131
|
+
<dd><p>Result of <code>GooglePayOpenWalletButton.checkAvailability</code>. Extends
|
|
132
|
+
<a href="#OpenWalletAvailabilityResult">OpenWalletAvailabilityResult</a>.</p>
|
|
133
|
+
</dd>
|
|
103
134
|
<dt><a href="#OnClickEventData">OnClickEventData</a> : <code>object</code></dt>
|
|
104
135
|
<dd><p>Interface for OnClickEventData.
|
|
105
136
|
Emitted when the wallet button is clicked.</p>
|
|
@@ -187,7 +218,7 @@ Apple will determine if the device has an ApplePay wallet available and at least
|
|
|
187
218
|
| [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`. |
|
|
188
219
|
| [show_billing_address] | <code>boolean</code> | Show billing address fields in the Apple Pay sheet. |
|
|
189
220
|
| store_name | <code>string</code> | The merchant's store name displayed during payment. |
|
|
190
|
-
| [apple_pay_capabilities] | <code>Array.<('credentials\_available'\|'credentials\_status\_unknown'\|'credentials\_unavailable')></code> | Device
|
|
221
|
+
| [apple_pay_capabilities] | <code>Array.<('credentials\_available'\|'credentials\_status\_unknown'\|'credentials\_unavailable')></code> | Device credential statuses that make the button render. Defaults to `['credentials_available', 'credentials_status_unknown']`: `credentials_available` means the device has a confirmed Apple Pay card ready to use; `credentials_status_unknown` means a local card can't be confirmed but Apple Pay can still proceed (e.g. the cross-device QR flow used by Chrome, Edge and Firefox). Narrow to `['credentials_available']` to require a confirmed local card. |
|
|
191
222
|
| [merchant_capabilities] | <code>Array.<('supports3DS'\|'supportsEMV'\|'supportsCredit'\|'supportsDebit')></code> | Array of merchant capabilities influencing the transaction processing features available. |
|
|
192
223
|
| [supported_networks] | <code>Array.<('visa'\|'masterCard'\|'amex'\|'chinaUnionPay'\|'discover'\|'interac'\|'jcb'\|'privateLabel')></code> | List of payment networks supported for Apple Pay transactions. |
|
|
193
224
|
| [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. |
|
|
@@ -221,6 +252,105 @@ Interface for Google Pay-specific metadata.
|
|
|
221
252
|
| [style.button_color] | <code>GooglePayButtonColor</code> | The color of the Google Pay button (`'default'`, `'black'`, `'white'`). |
|
|
222
253
|
| [style.button_size_mode] | <code>GooglePayButtonSizeMode</code> | The size mode (`'static'`, `'fill'`). |
|
|
223
254
|
|
|
255
|
+
<a name="OpenWalletAvailabilityOptions" id="OpenWalletAvailabilityOptions" href="#OpenWalletAvailabilityOptions"> </a>
|
|
256
|
+
|
|
257
|
+
## OpenWalletAvailabilityOptions : <code>object</code>
|
|
258
|
+
Base options shared by every wallet's static availability check
|
|
259
|
+
(e.g. [ApplePayOpenWalletButton](#ApplePayOpenWalletButton).checkAvailability). Wallet-specific option
|
|
260
|
+
interfaces (such as [ApplePayAvailabilityOptions](#ApplePayAvailabilityOptions)) extend this.
|
|
261
|
+
|
|
262
|
+
**Kind**: global interface
|
|
263
|
+
|
|
264
|
+
| Param | Type | Description |
|
|
265
|
+
| --- | --- | --- |
|
|
266
|
+
| [public_key_or_access_token] | <code>string</code> | Public key or access token used to fetch the service config when needed. |
|
|
267
|
+
| [service_id] | <code>string</code> | Service ID — used with `public_key_or_access_token` to resolve the wallet configuration. |
|
|
268
|
+
| [env] | <code>string</code> | Environment for the config fetch (e.g. `'sandbox'`). Defaults to the SDK default. |
|
|
269
|
+
| [sync] | <code>boolean</code> | When `true`, performs only the cheap, network-free synchronous check and resolves immediately — no config fetch, SDK load, or remote capability query. |
|
|
270
|
+
|
|
271
|
+
<a name="OpenWalletAvailabilityResult" id="OpenWalletAvailabilityResult" href="#OpenWalletAvailabilityResult"> </a>
|
|
272
|
+
|
|
273
|
+
## OpenWalletAvailabilityResult : <code>object</code>
|
|
274
|
+
Base result shared by every wallet's static availability check. Wallet-specific
|
|
275
|
+
result interfaces (such as [ApplePayAvailabilityResult](#ApplePayAvailabilityResult)) extend this.
|
|
276
|
+
|
|
277
|
+
**Kind**: global interface
|
|
278
|
+
|
|
279
|
+
| Param | Type | Description |
|
|
280
|
+
| --- | --- | --- |
|
|
281
|
+
| available | <code>boolean</code> | Convenience verdict: the wallet is usable for a payment in the current context. |
|
|
282
|
+
| supported | <code>boolean</code> | Whether the wallet is supported here at all (may be available via a fallback flow). |
|
|
283
|
+
| [reason] | <code>string</code> | Machine-readable reason when not available. |
|
|
284
|
+
|
|
285
|
+
<a name="ApplePayAvailabilityOptions" id="ApplePayAvailabilityOptions" href="#ApplePayAvailabilityOptions"> </a>
|
|
286
|
+
|
|
287
|
+
## ApplePayAvailabilityOptions : <code>object</code>
|
|
288
|
+
Options for `ApplePayOpenWalletButton.checkAvailability`. Extends
|
|
289
|
+
[OpenWalletAvailabilityOptions](#OpenWalletAvailabilityOptions). Provide `merchant_id` directly to skip the network
|
|
290
|
+
call, **or** provide `public_key_or_access_token` + `service_id` to resolve the merchant
|
|
291
|
+
identifier from the service configuration.
|
|
292
|
+
|
|
293
|
+
**Kind**: global interface
|
|
294
|
+
**Extends**: [<code>OpenWalletAvailabilityOptions</code>](#OpenWalletAvailabilityOptions)
|
|
295
|
+
|
|
296
|
+
| Param | Type | Description |
|
|
297
|
+
| --- | --- | --- |
|
|
298
|
+
| [merchant_id] | <code>string</code> | Apple merchant identifier. Provide this OR (`public_key_or_access_token` + `service_id`). |
|
|
299
|
+
| [apple_pay_capabilities] | <code>Array.<('credentials\_available'\|'credentials\_status\_unknown'\|'credentials\_unavailable')></code> | Device credential statuses that count as available. Defaults to `['credentials_available', 'credentials_status_unknown']` — `credentials_status_unknown` is what third-party / cross-device (QR) browsers report, so the default keeps Apple Pay visible outside Safari. |
|
|
300
|
+
| [sync] | <code>boolean</code> | When `true`, runs only the synchronous native same-device check (`window.ApplePaySession` + `canMakePayments()`) and resolves immediately — no merchant resolution, SDK load, or `applePayCapabilities()` query. In this mode `available` reflects the native session only and `payment_credential_status` is `undefined`; it is **not** authoritative for cross-browser / QR availability. |
|
|
301
|
+
|
|
302
|
+
<a name="ApplePayAvailabilityResult" id="ApplePayAvailabilityResult" href="#ApplePayAvailabilityResult"> </a>
|
|
303
|
+
|
|
304
|
+
## ApplePayAvailabilityResult : <code>object</code>
|
|
305
|
+
Result of `ApplePayOpenWalletButton.checkAvailability`. Extends
|
|
306
|
+
[OpenWalletAvailabilityResult](#OpenWalletAvailabilityResult).
|
|
307
|
+
|
|
308
|
+
Infer the transport (Apple does not expose it directly): `available && has_native_session`
|
|
309
|
+
⇒ native sheet likely; `available && !has_native_session` ⇒ cross-device / QR handoff likely.
|
|
310
|
+
|
|
311
|
+
**Kind**: global interface
|
|
312
|
+
**Extends**: [<code>OpenWalletAvailabilityResult</code>](#OpenWalletAvailabilityResult)
|
|
313
|
+
|
|
314
|
+
| Param | Type | Description |
|
|
315
|
+
| --- | --- | --- |
|
|
316
|
+
| available | <code>boolean</code> | Whether the device credential status is within the allowed capability set. |
|
|
317
|
+
| supported | <code>boolean</code> | Whether Apple Pay is usable here at all (incl. the cross-device QR flow). Derived from `payment_credential_status` (anything other than `applePayUnsupported`); falls back to the native `canMakePayments()` signal when the capabilities query could not run. |
|
|
318
|
+
| has_native_session | <code>boolean</code> | Whether a native, same-device Apple Pay session is present right now (`ApplePaySession` exists and `canMakePayments()` is `true`). |
|
|
319
|
+
| [payment_credential_status] | <code>'paymentCredentialsAvailable'</code> \| <code>'paymentCredentialStatusUnknown'</code> \| <code>'paymentCredentialsUnavailable'</code> \| <code>'applePayUnsupported'</code> | The raw device-reported credential status. Undefined when unsupported or not queried. |
|
|
320
|
+
| [reason] | <code>string</code> | Machine-readable reason when not available: `'unsupported_browser'`, `'missing_merchant_id'`, `'service_type_mismatch'`, `'config_fetch_failed'`, `'sdk_load_failed'`, `'query_failed'`, `'no_credentials'`, or `'no_native_session'` (only from the synchronous `sync: true` check). |
|
|
321
|
+
|
|
322
|
+
<a name="GooglePayAvailabilityOptions" id="GooglePayAvailabilityOptions" href="#GooglePayAvailabilityOptions"> </a>
|
|
323
|
+
|
|
324
|
+
## GooglePayAvailabilityOptions : <code>object</code>
|
|
325
|
+
Options for `GooglePayOpenWalletButton.checkAvailability`. Extends
|
|
326
|
+
[OpenWalletAvailabilityOptions](#OpenWalletAvailabilityOptions). All fields are optional — Google Pay's
|
|
327
|
+
`isReadyToPay` check does not require a merchant identifier. Supplying
|
|
328
|
+
`public_key_or_access_token` + `service_id` additionally validates the service type.
|
|
329
|
+
|
|
330
|
+
**Kind**: global interface
|
|
331
|
+
**Extends**: [<code>OpenWalletAvailabilityOptions</code>](#OpenWalletAvailabilityOptions)
|
|
332
|
+
|
|
333
|
+
| Param | Type | Description |
|
|
334
|
+
| --- | --- | --- |
|
|
335
|
+
| [merchant_id] | <code>string</code> | Google Pay gateway merchant identifier. Optional; the readiness check runs without it. |
|
|
336
|
+
| [sync] | <code>boolean</code> | When `true`, reports only whether the Google Pay JS API is already present in the page (no `isReadyToPay` call). It does **not** run the device/card readiness check. |
|
|
337
|
+
|
|
338
|
+
<a name="GooglePayAvailabilityResult" id="GooglePayAvailabilityResult" href="#GooglePayAvailabilityResult"> </a>
|
|
339
|
+
|
|
340
|
+
## GooglePayAvailabilityResult : <code>object</code>
|
|
341
|
+
Result of `GooglePayOpenWalletButton.checkAvailability`. Extends
|
|
342
|
+
[OpenWalletAvailabilityResult](#OpenWalletAvailabilityResult).
|
|
343
|
+
|
|
344
|
+
**Kind**: global interface
|
|
345
|
+
**Extends**: [<code>OpenWalletAvailabilityResult</code>](#OpenWalletAvailabilityResult)
|
|
346
|
+
|
|
347
|
+
| Param | Type | Description |
|
|
348
|
+
| --- | --- | --- |
|
|
349
|
+
| available | <code>boolean</code> | Whether Google Pay is ready to pay in the current context (from `isReadyToPay().result`). |
|
|
350
|
+
| supported | <code>boolean</code> | Whether the Google Pay JS API is present and the readiness query could run. |
|
|
351
|
+
| [payment_method_present] | <code>boolean</code> | Google's `isReadyToPay` `paymentMethodPresent` — whether the buyer already has a usable payment method. Undefined when not reported. |
|
|
352
|
+
| [reason] | <code>string</code> | Machine-readable reason when not available: `'unsupported_browser'`, `'service_type_mismatch'`, `'config_fetch_failed'`, `'sdk_load_failed'`, `'query_failed'`, `'no_payment_method'`, or `'api_not_loaded'` (only from the synchronous `sync: true` check). |
|
|
353
|
+
|
|
224
354
|
<a name="OnClickEventData" id="OnClickEventData" href="#OnClickEventData"> </a>
|
|
225
355
|
|
|
226
356
|
## OnClickEventData : <code>object</code>
|
|
@@ -487,20 +617,23 @@ if the service type does not match Apple Pay.
|
|
|
487
617
|
|
|
488
618
|
* [ApplePayOpenWalletButton](#ApplePayOpenWalletButton) ⇐ [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
489
619
|
* [new ApplePayOpenWalletButton(selector, publicKeyOrAccessToken, serviceId, meta)](#new_ApplePayOpenWalletButton_new)
|
|
490
|
-
*
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
620
|
+
* _instance_
|
|
621
|
+
* [.load()](#OpenWalletButtons+load)
|
|
622
|
+
* [.enable()](#OpenWalletButtons+enable)
|
|
623
|
+
* [.disable()](#OpenWalletButtons+disable)
|
|
624
|
+
* [.setEnv(env, [alias])](#OpenWalletButtons+setEnv)
|
|
625
|
+
* [.setMeta(meta)](#OpenWalletButtons+setMeta)
|
|
626
|
+
* [.destroy()](#OpenWalletButtons+destroy)
|
|
627
|
+
* [.onClick(handler)](#OpenWalletButtons+onClick)
|
|
628
|
+
* [.onSuccess(handler)](#OpenWalletButtons+onSuccess)
|
|
629
|
+
* [.onUnavailable(handler)](#OpenWalletButtons+onUnavailable)
|
|
630
|
+
* [.onError(handler)](#OpenWalletButtons+onError)
|
|
631
|
+
* [.onCancel(handler)](#OpenWalletButtons+onCancel)
|
|
632
|
+
* [.onLoaded(handler)](#OpenWalletButtons+onLoaded)
|
|
633
|
+
* [.onShippingAddressChange(handler)](#OpenWalletButtons+onShippingAddressChange)
|
|
634
|
+
* [.onShippingOptionsChange(handler)](#OpenWalletButtons+onShippingOptionsChange)
|
|
635
|
+
* _static_
|
|
636
|
+
* [.checkAvailability([options])](#ApplePayOpenWalletButton.checkAvailability) ⇒ [<code>Promise.<ApplePayAvailabilityResult></code>](#ApplePayAvailabilityResult)
|
|
504
637
|
|
|
505
638
|
<a name="new_ApplePayOpenWalletButton_new" id="new_ApplePayOpenWalletButton_new" href="#new_ApplePayOpenWalletButton_new"> </a>
|
|
506
639
|
|
|
@@ -873,6 +1006,54 @@ button.onShippingOptionsChange((data) => {
|
|
|
873
1006
|
};
|
|
874
1007
|
});
|
|
875
1008
|
```
|
|
1009
|
+
<a name="ApplePayOpenWalletButton.checkAvailability" id="ApplePayOpenWalletButton.checkAvailability" href="#ApplePayOpenWalletButton.checkAvailability"> </a>
|
|
1010
|
+
|
|
1011
|
+
### ApplePayOpenWalletButton.checkAvailability([options]) ⇒ [<code>Promise.<ApplePayAvailabilityResult></code>](#ApplePayAvailabilityResult)
|
|
1012
|
+
Checks Apple Pay availability **without instantiating the button** — the single,
|
|
1013
|
+
authoritative, cross-browser-aware availability entry point.
|
|
1014
|
+
|
|
1015
|
+
Resolves the merchant identifier (either supplied directly or fetched from the
|
|
1016
|
+
service configuration), loads Apple's web SDK if needed, then queries
|
|
1017
|
+
`ApplePaySession.applePayCapabilities()`. Returns a convenience `available` verdict
|
|
1018
|
+
(computed against `apple_pay_capabilities`), the raw device-reported
|
|
1019
|
+
`payment_credential_status`, and `has_native_session` so callers can infer the transport:
|
|
1020
|
+
`available && has_native_session` ⇒ native sheet likely; `available && !has_native_session`
|
|
1021
|
+
⇒ cross-device / QR handoff likely.
|
|
1022
|
+
|
|
1023
|
+
Pass `{ sync: true }` for a cheap, network-free native same-device pre-check that
|
|
1024
|
+
resolves immediately (see [ApplePayAvailabilityOptions.sync](ApplePayAvailabilityOptions.sync)).
|
|
1025
|
+
|
|
1026
|
+
**Kind**: static method of [<code>ApplePayOpenWalletButton</code>](#ApplePayOpenWalletButton)
|
|
1027
|
+
**Returns**: [<code>Promise.<ApplePayAvailabilityResult></code>](#ApplePayAvailabilityResult) - The availability result.
|
|
1028
|
+
|
|
1029
|
+
| Param | Type | Description |
|
|
1030
|
+
| --- | --- | --- |
|
|
1031
|
+
| [options] | [<code>ApplePayAvailabilityOptions</code>](#ApplePayAvailabilityOptions) | Merchant context, allowed capabilities, and mode. |
|
|
1032
|
+
|
|
1033
|
+
**Example**
|
|
1034
|
+
```js
|
|
1035
|
+
// Lightest path — no network, when you already know the merchant identifier:
|
|
1036
|
+
const result = await ApplePayOpenWalletButton.checkAvailability({ merchant_id });
|
|
1037
|
+
```
|
|
1038
|
+
**Example**
|
|
1039
|
+
```js
|
|
1040
|
+
// Resolve the merchant identifier from the service configuration:
|
|
1041
|
+
const result = await ApplePayOpenWalletButton.checkAvailability({
|
|
1042
|
+
public_key_or_access_token,
|
|
1043
|
+
service_id,
|
|
1044
|
+
env: 'sandbox',
|
|
1045
|
+
});
|
|
1046
|
+
if (result.available) {
|
|
1047
|
+
// Render the Apple Pay button (native sheet or cross-device QR, per has_native_session).
|
|
1048
|
+
} else {
|
|
1049
|
+
console.log('Unavailable:', result.reason, result.payment_credential_status);
|
|
1050
|
+
}
|
|
1051
|
+
```
|
|
1052
|
+
**Example**
|
|
1053
|
+
```js
|
|
1054
|
+
// Synchronous native-only fast check (no network / SDK load):
|
|
1055
|
+
const { has_native_session } = await ApplePayOpenWalletButton.checkAvailability({ sync: true });
|
|
1056
|
+
```
|
|
876
1057
|
<a name="GooglePayOpenWalletButton" id="GooglePayOpenWalletButton" href="#GooglePayOpenWalletButton"> </a>
|
|
877
1058
|
|
|
878
1059
|
## GooglePayOpenWalletButton ⇐ [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
@@ -888,20 +1069,23 @@ if the service type does not match Google Pay.
|
|
|
888
1069
|
|
|
889
1070
|
* [GooglePayOpenWalletButton](#GooglePayOpenWalletButton) ⇐ [<code>OpenWalletButtons</code>](#OpenWalletButtons)
|
|
890
1071
|
* [new GooglePayOpenWalletButton(selector, publicKeyOrAccessToken, serviceId, meta)](#new_GooglePayOpenWalletButton_new)
|
|
891
|
-
*
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
1072
|
+
* _instance_
|
|
1073
|
+
* [.load()](#OpenWalletButtons+load)
|
|
1074
|
+
* [.enable()](#OpenWalletButtons+enable)
|
|
1075
|
+
* [.disable()](#OpenWalletButtons+disable)
|
|
1076
|
+
* [.setEnv(env, [alias])](#OpenWalletButtons+setEnv)
|
|
1077
|
+
* [.setMeta(meta)](#OpenWalletButtons+setMeta)
|
|
1078
|
+
* [.destroy()](#OpenWalletButtons+destroy)
|
|
1079
|
+
* [.onClick(handler)](#OpenWalletButtons+onClick)
|
|
1080
|
+
* [.onSuccess(handler)](#OpenWalletButtons+onSuccess)
|
|
1081
|
+
* [.onUnavailable(handler)](#OpenWalletButtons+onUnavailable)
|
|
1082
|
+
* [.onError(handler)](#OpenWalletButtons+onError)
|
|
1083
|
+
* [.onCancel(handler)](#OpenWalletButtons+onCancel)
|
|
1084
|
+
* [.onLoaded(handler)](#OpenWalletButtons+onLoaded)
|
|
1085
|
+
* [.onShippingAddressChange(handler)](#OpenWalletButtons+onShippingAddressChange)
|
|
1086
|
+
* [.onShippingOptionsChange(handler)](#OpenWalletButtons+onShippingOptionsChange)
|
|
1087
|
+
* _static_
|
|
1088
|
+
* [.checkAvailability([options])](#GooglePayOpenWalletButton.checkAvailability) ⇒ [<code>Promise.<GooglePayAvailabilityResult></code>](#GooglePayAvailabilityResult)
|
|
905
1089
|
|
|
906
1090
|
<a name="new_GooglePayOpenWalletButton_new" id="new_GooglePayOpenWalletButton_new" href="#new_GooglePayOpenWalletButton_new"> </a>
|
|
907
1091
|
|
|
@@ -1272,6 +1456,45 @@ button.onShippingOptionsChange((data) => {
|
|
|
1272
1456
|
};
|
|
1273
1457
|
});
|
|
1274
1458
|
```
|
|
1459
|
+
<a name="GooglePayOpenWalletButton.checkAvailability" id="GooglePayOpenWalletButton.checkAvailability" href="#GooglePayOpenWalletButton.checkAvailability"> </a>
|
|
1460
|
+
|
|
1461
|
+
### GooglePayOpenWalletButton.checkAvailability([options]) ⇒ [<code>Promise.<GooglePayAvailabilityResult></code>](#GooglePayAvailabilityResult)
|
|
1462
|
+
Checks Google Pay availability **without instantiating the button** — the static
|
|
1463
|
+
availability entry point.
|
|
1464
|
+
|
|
1465
|
+
Loads the Google Pay JS SDK if needed, then runs `PaymentsClient.isReadyToPay()` using
|
|
1466
|
+
the **default** card configuration (a button instance with a custom `card_config` may
|
|
1467
|
+
produce a different result). All options are optional — unlike Apple Pay, Google Pay's
|
|
1468
|
+
readiness check does not require a merchant identifier; supplying `service_id` +
|
|
1469
|
+
`public_key_or_access_token` additionally validates that the service is a Google Pay service.
|
|
1470
|
+
|
|
1471
|
+
Pass `{ sync: true }` for a cheap, network-free check that only reports whether the
|
|
1472
|
+
Google Pay JS API is already present (see [GooglePayAvailabilityOptions.sync](GooglePayAvailabilityOptions.sync)).
|
|
1473
|
+
|
|
1474
|
+
**Kind**: static method of [<code>GooglePayOpenWalletButton</code>](#GooglePayOpenWalletButton)
|
|
1475
|
+
**Returns**: [<code>Promise.<GooglePayAvailabilityResult></code>](#GooglePayAvailabilityResult) - The availability result.
|
|
1476
|
+
|
|
1477
|
+
| Param | Type | Description |
|
|
1478
|
+
| --- | --- | --- |
|
|
1479
|
+
| [options] | [<code>GooglePayAvailabilityOptions</code>](#GooglePayAvailabilityOptions) | Optional merchant context and mode. |
|
|
1480
|
+
|
|
1481
|
+
**Example**
|
|
1482
|
+
```js
|
|
1483
|
+
// Simplest form — no merchant context needed:
|
|
1484
|
+
const result = await GooglePayOpenWalletButton.checkAvailability();
|
|
1485
|
+
if (result.available) {
|
|
1486
|
+
// Render the Google Pay button.
|
|
1487
|
+
}
|
|
1488
|
+
```
|
|
1489
|
+
**Example**
|
|
1490
|
+
```js
|
|
1491
|
+
// Validate the service is a Google Pay service while checking:
|
|
1492
|
+
const result = await GooglePayOpenWalletButton.checkAvailability({
|
|
1493
|
+
public_key_or_access_token,
|
|
1494
|
+
service_id,
|
|
1495
|
+
env: 'sandbox',
|
|
1496
|
+
});
|
|
1497
|
+
```
|
|
1275
1498
|
<a name="OpenWalletButtons" id="OpenWalletButtons" href="#OpenWalletButtons"> </a>
|
|
1276
1499
|
|
|
1277
1500
|
## *OpenWalletButtons*
|
package/docs/widget-examples.md
CHANGED
|
@@ -94,8 +94,48 @@ widget.setRefId('id'); // your unique identifier to identify the data
|
|
|
94
94
|
widget.setFormFields(['phone', 'email']); // add additional fields for form of widget
|
|
95
95
|
|
|
96
96
|
widget.setSupportedCardIcons(['mastercard', 'visa']); // add icons of supported card types
|
|
97
|
+
|
|
98
|
+
widget.setAllowedCardSchemes(['mastercard', 'visa']); // restrict which card schemes the card number field accepts
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Restricting accepted card schemes
|
|
102
|
+
|
|
103
|
+
`setAllowedCardSchemes(schemes)` restricts which card schemes the card number field accepts, **without** changing
|
|
104
|
+
which card icons the widget displays. Call it before `load()`.
|
|
105
|
+
|
|
106
|
+
```javascript
|
|
107
|
+
widget.setAllowedCardSchemes(['visa', 'mastercard']);
|
|
97
108
|
```
|
|
98
109
|
|
|
110
|
+
Accepted identifiers — the schemes the widget can resolve from a card number:
|
|
111
|
+
|
|
112
|
+
`amex`, `ausbc`, `diners`, `discover`, `eftpos`, `japcb`, `mastercard`, `solo`, `unionpay`, `visa`
|
|
113
|
+
|
|
114
|
+
Behaviour:
|
|
115
|
+
|
|
116
|
+
- **Not called, or an empty array** — every scheme is accepted. Existing integrations are unaffected.
|
|
117
|
+
- **Case-insensitive**, and surrounding whitespace is ignored: `' Visa '` and `'MASTERCARD'` both work. Note that
|
|
118
|
+
`setSupportedCardIcons` matches case-**sensitively**; the two methods differ here.
|
|
119
|
+
- **Unsupported identifiers are ignored with a `console.warn`** naming the value, and never throw. A list in which
|
|
120
|
+
every identifier is unsupported therefore applies **no restriction at all** — check the console if a restriction
|
|
121
|
+
seems to have no effect. The icon-only values `visa_white` and `eftpos_white` are not schemes and are rejected,
|
|
122
|
+
as are `laser` and `maestro`, which the widget can never resolve from a card number.
|
|
123
|
+
- **Takes precedence over `setSupportedCardIcons`.** When a non-empty list is supplied here, it is the only list
|
|
124
|
+
used for validation, and the second argument of `setSupportedCardIcons` no longer affects validation. Icons keep
|
|
125
|
+
coming from `setSupportedCardIcons`, so a scheme can legitimately be shown as an icon and still be rejected —
|
|
126
|
+
make sure that is what you intend:
|
|
127
|
+
|
|
128
|
+
```javascript
|
|
129
|
+
widget.setSupportedCardIcons(['visa', 'mastercard', 'amex'], true);
|
|
130
|
+
widget.setAllowedCardSchemes(['visa', 'mastercard']);
|
|
131
|
+
// three icons are displayed; an Amex card is rejected
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
- **Calling it again replaces the previous list** rather than merging with it.
|
|
135
|
+
- A card of a rejected scheme shows `Card type not accepted.` on the card number field, the submit button is
|
|
136
|
+
disabled, and the submit handler refuses the card even if the button is re-enabled outside the widget. The same
|
|
137
|
+
message is shown for a card whose scheme cannot be resolved at all.
|
|
138
|
+
|
|
99
139
|
This example shows how you can use a lot of other methods to settings your form
|
|
100
140
|
|
|
101
141
|
### Error handling
|
|
@@ -255,6 +295,7 @@ When handling errors, consider:
|
|
|
255
295
|
var widget = new paydock.HtmlWidget('#widget', 'publicKey', 'gatewayId');
|
|
256
296
|
|
|
257
297
|
widget.setSupportedCardIcons(['mastercard', 'visa']);
|
|
298
|
+
widget.setAllowedCardSchemes(['mastercard', 'visa']);
|
|
258
299
|
widget.setFormFields(['phone', 'email']);
|
|
259
300
|
widget.setRefId('custom-ref-id');
|
|
260
301
|
widget.onFinishInsert('input[name="payment_source_token"]', 'payment_source');
|
package/package.json
CHANGED
|
@@ -104,7 +104,7 @@
|
|
|
104
104
|
}
|
|
105
105
|
},
|
|
106
106
|
"name": "@paydock/client-sdk",
|
|
107
|
-
"version": "1.
|
|
107
|
+
"version": "1.147.0",
|
|
108
108
|
"scripts": {
|
|
109
109
|
"build:doc": "node docs/html/marked.js",
|
|
110
110
|
"build:js": "rollup --config rollup.config.ts --configPlugin @rollup/plugin-typescript",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@babel/cli": "7.24.5",
|
|
148
|
-
"@babel/core": "7.
|
|
148
|
+
"@babel/core": "7.29.6",
|
|
149
149
|
"@babel/plugin-external-helpers": "7.24.1",
|
|
150
150
|
"@babel/plugin-transform-modules-umd": "7.24.1",
|
|
151
151
|
"@babel/plugin-transform-object-assign": "7.24.1",
|
|
@@ -180,7 +180,6 @@
|
|
|
180
180
|
"buffer": "5.7.1",
|
|
181
181
|
"cross-fetch": "4.1.0",
|
|
182
182
|
"dotenv": "16.4.5",
|
|
183
|
-
"fs": "0.0.2",
|
|
184
183
|
"grunt": "1.6.1",
|
|
185
184
|
"grunt-cli": "1.4.3",
|
|
186
185
|
"grunt-jsdoc-to-markdown": "6.0.0",
|
|
@@ -214,35 +213,45 @@
|
|
|
214
213
|
"tsify": "3.0.4",
|
|
215
214
|
"tslib": "2.6.2",
|
|
216
215
|
"typescript": "5.4.5",
|
|
217
|
-
"vitest": "3.
|
|
216
|
+
"vitest": "3.2.6",
|
|
218
217
|
"zod": "3.23.8"
|
|
219
218
|
},
|
|
220
219
|
"overrides": {
|
|
221
220
|
"sha.js@>=2.0.0 <=2.4.11": "2.4.12",
|
|
222
221
|
"pbkdf2": ">=3.1.3",
|
|
223
|
-
"form-data": ">=4.0.
|
|
222
|
+
"form-data": ">=4.0.6",
|
|
224
223
|
"qs": ">=6.15.2",
|
|
224
|
+
"js-yaml": "4.3.1",
|
|
225
225
|
"@babel/plugin-transform-modules-systemjs": ">=7.29.4",
|
|
226
|
-
"fast-uri": "
|
|
226
|
+
"fast-uri": "3.1.7",
|
|
227
227
|
"tmp": ">=0.2.6",
|
|
228
228
|
"ws": ">=8.20.1",
|
|
229
229
|
"minimatch@^3": "3.1.5",
|
|
230
230
|
"minimatch@^5": "5.1.9",
|
|
231
231
|
"minimatch@^9": "9.0.9",
|
|
232
232
|
"@isaacs/brace-expansion": ">=5.0.1",
|
|
233
|
+
"brace-expansion@1": "1.1.18",
|
|
234
|
+
"brace-expansion@2": "2.1.4",
|
|
235
|
+
"postcss": "8.5.23",
|
|
233
236
|
"bn.js": ">=5.2.3",
|
|
234
237
|
"ajv": "8.18.0",
|
|
235
238
|
"serialize-javascript": ">=7.0.3",
|
|
236
239
|
"underscore": ">=1.13.8",
|
|
237
|
-
"dompurify": "
|
|
238
|
-
"immutable": "
|
|
240
|
+
"dompurify": "3.4.13",
|
|
241
|
+
"immutable": "5.1.8",
|
|
239
242
|
"flatted": ">=3.4.2",
|
|
240
243
|
"node-forge": ">=1.4.0",
|
|
241
244
|
"picomatch": ">=2.3.2",
|
|
242
|
-
"socket.io-parser": "
|
|
245
|
+
"socket.io-parser": "4.2.7",
|
|
246
|
+
"engine.io": "6.6.9",
|
|
243
247
|
"lodash": ">=4.18.0",
|
|
244
|
-
"vite": ">=6.4.2",
|
|
245
|
-
"follow-redirects": ">=1.16.0"
|
|
248
|
+
"vite": ">=6.4.2 <7",
|
|
249
|
+
"follow-redirects": ">=1.16.0",
|
|
250
|
+
"shell-quote": "1.9.0",
|
|
251
|
+
"esbuild": ">=0.28.1",
|
|
252
|
+
"linkify-it": "5.0.2",
|
|
253
|
+
"body-parser": "1.20.6",
|
|
254
|
+
"nanoid": "3.3.18"
|
|
246
255
|
},
|
|
247
256
|
"engines": {
|
|
248
257
|
"node": ">=16.0.0"
|