@paydock/client-sdk 1.147.0 → 1.148.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.
@@ -2316,298 +2316,6 @@ declare class Api extends ApiBase {
2316
2316
  charge(): ApiCharge;
2317
2317
  }
2318
2318
 
2319
- /**
2320
- * Decoded payload of the Standalone 3DS charge token (the JWT body) the SDK
2321
- * receives in `Canvas3ds`'s constructor when the token format is `standalone_3ds`.
2322
- *
2323
- * This shape is set by the Paydock backend when minting the token. Integrators
2324
- * who decode the token themselves can use this interface to type the result.
2325
- */
2326
- interface ITokenStandalone3DS {
2327
- /** Optional merchant-side correlation identifier carried through from the original charge request. */
2328
- external_id?: string;
2329
- /** URL of the first iframe the SDK loads to bootstrap the 3DS provider's authentication flow. */
2330
- initialization_url: string;
2331
- /**
2332
- * @deprecated No longer read by the Standalone 3DS flow. The field is kept
2333
- * on the interface for backwards compatibility with tokens minted by older
2334
- * API versions; it will be removed in a future major release. Prefer
2335
- * `initialization_url` + `secondary_url`.
2336
- */
2337
- authorization_url?: string;
2338
- /** Optional URL of a secondary iframe used by some providers (e.g. GPayments) for monitoring/polling alongside the main flow. */
2339
- secondary_url?: string;
2340
- /** The Paydock 3DS charge identifier this token authorizes. Echoed back in every event payload emitted during the flow. */
2341
- charge_3ds_id: string;
2342
- /** Identifier of the 3DS gateway the SDK should delegate to. Currently only `'GPayments'` is handled; other values fall through. */
2343
- service_type: string;
2344
- }
2345
- declare class Standalone3dsService {
2346
- protected container: Container;
2347
- protected eventEmitter: EventEmitter;
2348
- protected env: string;
2349
- protected alias: string;
2350
- constructor(container: Container, eventEmitter: any);
2351
- load(token: string, options: {
2352
- title: string;
2353
- }): void;
2354
- /**
2355
- * Origins allowed to deliver a processed 3DS outcome to the page via postMessage: the Paydock API
2356
- * (inline callback page) and the Paydock widget (remote-app landing page), for the current env/alias.
2357
- */
2358
- protected getTrustedMessageOrigins(api: ApiBase): string[];
2359
- setEnv(env: string, alias?: string): void;
2360
- }
2361
-
2362
- /**
2363
- * Payload emitted by the Standalone 3DS flow for auth-related events
2364
- * (chargeAuthSuccess, chargeAuthReject, chargeAuthChallenge, chargeAuthDecoupled).
2365
- */
2366
- interface Canvas3dsAuthPayload {
2367
- /** The Paydock 3DS charge identifier (e.g. `'chrg_3ds_xxxxx'`) used to correlate the authentication with the underlying charge. */
2368
- charge_3ds_id: string;
2369
- /** Authentication outcome status reported by the 3DS provider (e.g. `'authenticated'`, `'rejected'`, `'pending'`). */
2370
- status: string;
2371
- /** Optional result details. Present when the 3DS provider returns additional context for the outcome. */
2372
- result?: {
2373
- /** Human-readable description of the outcome (e.g. `'frictionless'`). */
2374
- description?: string;
2375
- };
2376
- }
2377
- /**
2378
- * Payload of `chargeAuthChallengeLoaded` (Standalone 3DS, challenge flow only).
2379
- * Emitted exactly once per challenge, after `chargeAuthChallenge`.
2380
- */
2381
- interface Canvas3dsChallengeLoadedPayload {
2382
- /** The Paydock 3DS charge identifier the challenge belongs to. */
2383
- charge_3ds_id: string;
2384
- /**
2385
- * `'load'` — the challenge iframe fired its first `load`: the ACS page has painted.
2386
- * `'timeout'` — no `load` arrived within the SDK's 2.5 s safety fallback; the event is emitted anyway so a
2387
- * loader is never held forever (the page may still be loading and will paint on its own). Useful for
2388
- * analytics (how often the fallback fires) — you do not need to handle the two differently.
2389
- */
2390
- reason: 'load' | 'timeout';
2391
- }
2392
- /**
2393
- * Payload of `chargeAuthChallengeCompleted` (Standalone 3DS, challenge and decoupled flows).
2394
- * Emitted at most once per authentication, after the shopper finished the challenge (or approved a decoupled
2395
- * authentication) and always before the terminal event.
2396
- */
2397
- interface Canvas3dsChallengeCompletedPayload {
2398
- /** The Paydock 3DS charge identifier the authentication belongs to. */
2399
- charge_3ds_id: string;
2400
- /**
2401
- * How the SDK learned that the issuer delivered the result:
2402
- * `'poll'` — the 3DS Server's result monitor reported it (the usual case: it flips as soon as the issuer's
2403
- * result reaches the 3DS Server, before the challenge iframe has even left the bank's page);
2404
- * `'callback'` — the callback message carrying the outcome arrived first (the terminal event follows
2405
- * immediately). Informational only — handle both the same way.
2406
- */
2407
- source: 'poll' | 'callback';
2408
- }
2409
- /**
2410
- * Payload emitted by the Standalone 3DS flow for error events.
2411
- * `error` is intentionally `unknown` — upstream emitters do not guarantee a shape.
2412
- */
2413
- interface Canvas3dsErrorPayload {
2414
- /** The Paydock 3DS charge identifier associated with the failed authentication attempt. */
2415
- charge_3ds_id: string;
2416
- /** The underlying error. Typed as `unknown` to force the consumer to narrow it before use. */
2417
- error: unknown;
2418
- }
2419
- /**
2420
- * Payload emitted by the iframe-based 3DS flow for auth-related events
2421
- * (`chargeAuth`, `chargeAuthSuccess`, `chargeAuthReject`).
2422
- *
2423
- * Extends `IEventData` with optional 3DS-specific fields that the widget
2424
- * merges into the message envelope for charge correlation.
2425
- */
2426
- interface Canvas3dsChargeAuthEventPayload extends IEventData$1 {
2427
- /** The Paydock 3DS charge identifier. Present when the widget correlates the event with a charge. */
2428
- charge_3ds_id?: string;
2429
- /** Authentication outcome status reported by the widget (e.g. `'authenticated'`, `'server_error'`). */
2430
- status?: string;
2431
- /** Optional result details forwarded from the 3DS provider. */
2432
- result?: {
2433
- /** Human-readable description of the outcome (e.g. `'frictionless'`). */
2434
- description?: string;
2435
- };
2436
- }
2437
- /**
2438
- * Payload emitted by the iframe-based 3DS flow for error events.
2439
- * Extends `IEventData` with optional 3DS-specific fields for charge correlation.
2440
- */
2441
- interface Canvas3dsErrorEventPayload extends IEventData$1 {
2442
- /** The Paydock 3DS charge identifier associated with the error. */
2443
- charge_3ds_id?: string;
2444
- }
2445
- /**
2446
- * Maps Canvas3ds event names to their callback data types.
2447
- *
2448
- * Events that can fire from both the iframe (html/url) and standalone flows
2449
- * use a union to accommodate both shapes. Standalone-only and iframe-only events
2450
- * use a single payload type.
2451
- */
2452
- interface Canvas3dsEventMap {
2453
- /** Successful authentication. Standalone path emits `Canvas3dsAuthPayload`; iframe path emits `Canvas3dsChargeAuthEventPayload`. Narrow with `'event' in data` for iframe vs standalone. */
2454
- chargeAuthSuccess: Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload;
2455
- /** Rejected authentication. Same dual-emit pattern as `chargeAuthSuccess`. */
2456
- chargeAuthReject: Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload;
2457
- /** Authentication or processing error. Standalone path emits `Canvas3dsErrorPayload`; iframe path emits `Canvas3dsErrorEventPayload`. */
2458
- error: Canvas3dsErrorPayload | Canvas3dsErrorEventPayload;
2459
- /** Challenge required — issuer demands user interaction (OTP, biometric, etc.). Standalone-only. */
2460
- chargeAuthChallenge: Canvas3dsAuthPayload;
2461
- /**
2462
- * The challenge iframe has painted (first `load`), or the 2.5 s fallback elapsed — see `reason`. Standalone-only,
2463
- * challenge flow only (never emitted for decoupled challenges). Fires once, after `chargeAuthChallenge`.
2464
- *
2465
- * Recommended loader pattern: show a loader before the charge POST, keep it through `chargeAuthChallenge`,
2466
- * reveal the challenge on this event, cover it with "Completing verification" on `chargeAuthChallengeCompleted`,
2467
- * and finish on `chargeAuthSuccess` / `chargeAuthReject` / `error`.
2468
- */
2469
- chargeAuthChallengeLoaded: Canvas3dsChallengeLoadedPayload;
2470
- /**
2471
- * The shopper finished the challenge (or approved a decoupled authentication): the issuer delivered the final
2472
- * result to the 3DS Server and the SDK is obtaining the outcome. Cover the challenge iframe with your own
2473
- * "Completing verification" state — whatever the bank or the 3DS Server render from here on is plumbing, not
2474
- * UX. Standalone-only. Fires at most once per authentication, always before `chargeAuthSuccess` /
2475
- * `chargeAuthReject` / `error`, and never after them. A wrong OTP or a further interactive step does NOT fire
2476
- * it (no result has been delivered yet), so no grace timer or reveal fallback is needed on your side.
2477
- */
2478
- chargeAuthChallengeCompleted: Canvas3dsChallengeCompletedPayload;
2479
- /** Decoupled authentication — issuer will authenticate out-of-band and notify later. Standalone-only. */
2480
- chargeAuthDecoupled: Canvas3dsAuthPayload;
2481
- /** Iframe-path authentication event. Extends `IEventData` with optional 3DS correlation fields (`charge_3ds_id`, `status`). */
2482
- chargeAuth: Canvas3dsChargeAuthEventPayload;
2483
- /** User cancelled the authentication flow before completion. Iframe-only. */
2484
- chargeAuthCancelled: IEventData$1;
2485
- /** Additional data collection step completed successfully. Iframe-only. */
2486
- additionalDataCollectSuccess: IEventData$1;
2487
- /** Additional data collection step was rejected. Iframe-only. */
2488
- additionalDataCollectReject: IEventData$1;
2489
- }
2490
- /** Union of all known Canvas3ds event names. */
2491
- type Canvas3dsEventName = keyof Canvas3dsEventMap;
2492
- /**
2493
- * Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
2494
- * Mirrors the string values of that enum without exposing the private enum itself.
2495
- */
2496
- declare const Canvas3dsTokenFormat: {
2497
- /** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
2498
- readonly HTML: "html";
2499
- /** Token whose `content` is a URL. The SDK loads it inside an iframe. */
2500
- readonly URL: "url";
2501
- /** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
2502
- readonly STANDALONE_3DS: "standalone_3ds";
2503
- };
2504
- type Canvas3dsTokenFormat = (typeof Canvas3dsTokenFormat)[keyof typeof Canvas3dsTokenFormat];
2505
-
2506
- /**
2507
- * List of available token's content formats
2508
- * @enum TOKEN_FORMAT
2509
- *
2510
- * @type {object}
2511
- * @param {string} HTML=html
2512
- */
2513
- declare enum TOKEN_FORMAT {
2514
- HTML = "html",
2515
- URL = "url",
2516
- STANDALONE_3DS = "standalone_3ds"
2517
- }
2518
- /**
2519
- * List of available event's name
2520
- * @const EVENT
2521
- *
2522
- * @type {object}
2523
- * @param {string} CHARGE_AUTH_SUCCESS=chargeAuthSuccess
2524
- * @param {string} CHARGE_AUTH_REJECT=chargeAuthReject
2525
- * @param {string} ADDITIONAL_DATA_SUCCESS=additionalDataCollectSuccess
2526
- * @param {string} ADDITIONAL_DATA_REJECT=additionalDataCollectReject
2527
- * @param {string} CHARGE_AUTH=chargeAuth
2528
- */
2529
- /**
2530
- * List of available event's name for Standalone 3ds flow
2531
- * @const STANDALONE_3DS_EVENT
2532
- *
2533
- * @type {object}
2534
- * @param {string} AUTH_SUCCESS=chargeAuthSuccess
2535
- * @param {string} AUTH_ERROR=chargeAuthReject
2536
- * @param {string} DECOUPLED=chargeAuthDecoupled
2537
- * @param {string} CHALLENGE=chargeAuthChallenge
2538
- * @param {string} CHALLENGE_LOADED=chargeAuthChallengeLoaded - challenge iframe painted (first `load`, or 2.5 s fallback); reveal your challenge UI here
2539
- * @param {string} CHALLENGE_COMPLETED=chargeAuthChallengeCompleted - the shopper finished the challenge (issuer result delivered to the 3DS Server); cover the challenge iframe with your own loader until the terminal event
2540
- * @param {string} INFO=chargeAuthInfo
2541
- * @param {string} ERROR=error
2542
- */
2543
- /**
2544
- * Class Canvas3ds include method for working on html
2545
- * @constructor
2546
- *
2547
- * @param {string} selector - Selector of html element. Container for widget
2548
- * @param {string} token - Pre authorized token
2549
- * @example
2550
- * var widget = new Canvas3ds('#widget', 'token');
2551
- *
2552
- *
2553
- */
2554
- declare class Canvas3ds {
2555
- protected link: Link;
2556
- protected configs: Configuration[];
2557
- protected publicKey: string;
2558
- protected token: {
2559
- content: string;
2560
- format: TOKEN_FORMAT;
2561
- charge_3ds_id: string;
2562
- };
2563
- protected standalone3dsService: Standalone3dsService;
2564
- protected container: Container;
2565
- protected iFrame: IFrame;
2566
- protected event: IFrameEvent;
2567
- protected eventEmitter: EventEmitter;
2568
- /** @constructs */ constructor(selector: string, token: string);
2569
- protected static extractToken(token: string): {
2570
- content: string;
2571
- format: TOKEN_FORMAT;
2572
- charge_3ds_id: string;
2573
- };
2574
- /**
2575
- * The final method to beginning, the load process of widget to html
2576
- *
2577
- */
2578
- load(): void;
2579
- /**
2580
- * Current method can change environment. By default environment = sandbox.
2581
- * Also we can change domain alias for this environment. By default domain_alias = paydock.com
2582
- *
2583
- * @example
2584
- * widget.setEnv('production');
2585
- * @param {string} env - sandbox, production
2586
- * @param {string} [alias] - Own domain alias
2587
- */
2588
- setEnv(env: string, alias?: string): void;
2589
- getEnv(): string;
2590
- on<E extends keyof Canvas3dsEventMap>(eventName: E, cb: (data: Canvas3dsEventMap[E]) => void): void;
2591
- on<E extends keyof Canvas3dsEventMap>(eventName: E): Promise<Canvas3dsEventMap[E]>;
2592
- on(eventName: string, cb: (data: IEventData$1) => void): void;
2593
- on(eventName: string): Promise<IEventData$1>;
2594
- /**
2595
- * Using this method you can hide widget after load
2596
- * @param {boolean} [saveSize=false] - using this param you can save iframe's size
2597
- */
2598
- hide(saveSize: boolean): void;
2599
- /**
2600
- * Using this method you can show widget after using hide method
2601
- *
2602
- */
2603
- show(): void;
2604
- /**
2605
- * Using this method you can reload widget
2606
- *
2607
- */
2608
- reload(): void;
2609
- }
2610
-
2611
2319
  /**
2612
2320
  * Canonical shared response shapes used by both Charge and Checkout internal APIs.
2613
2321
  * Extracted here to remove the prior duplicated definitions in
@@ -2660,353 +2368,821 @@ interface ProcessAuthenticationResponse {
2660
2368
  description?: string;
2661
2369
  };
2662
2370
  }
2663
-
2664
- declare class ApiChargeInternal {
2665
- protected api: ApiInternal;
2666
- constructor(api: ApiInternal);
2667
- walletCapture(payload: WalletCaptureBody): Promise<WalletCaptureResponse>;
2668
- walletCallback(payload: WalletCallbackBody): Promise<WalletCallbackResponse>;
2669
- standalone3dsHandle(): Promise<HandleResponseInterface>;
2371
+
2372
+ declare class ApiChargeInternal {
2373
+ protected api: ApiInternal;
2374
+ constructor(api: ApiInternal);
2375
+ walletCapture(payload: WalletCaptureBody): Promise<WalletCaptureResponse>;
2376
+ walletCallback(payload: WalletCallbackBody): Promise<WalletCallbackResponse>;
2377
+ /** Two-step mode: runs the deferred Standalone 3DS authentication (AReq). Charge-token auth, like `standalone3dsHandle`. */
2378
+ standalone3dsProcess(payload: Standalone3dsProcessBody): Promise<ProcessAuthenticationResponse>;
2379
+ standalone3dsHandle(): Promise<HandleResponseInterface>;
2380
+ }
2381
+ interface WalletCaptureResponse {
2382
+ id: string;
2383
+ amount: number;
2384
+ currency: string;
2385
+ status: string;
2386
+ }
2387
+ interface WalletCaptureBody {
2388
+ payment_method_id?: string;
2389
+ customer?: {
2390
+ payment_source?: {
2391
+ type?: string;
2392
+ card_name?: string;
2393
+ card_scheme?: string;
2394
+ card_number_last4?: string;
2395
+ expire_month?: number;
2396
+ expire_year?: number;
2397
+ address_line1?: string;
2398
+ address_line2?: string;
2399
+ address_city?: string;
2400
+ address_postcode?: string;
2401
+ address_state?: string;
2402
+ address_country?: string;
2403
+ external_payer_id?: string;
2404
+ ref_token?: string;
2405
+ wallet_express?: boolean;
2406
+ };
2407
+ };
2408
+ }
2409
+ interface WalletCallbackBody {
2410
+ request_type: string;
2411
+ }
2412
+ interface Standalone3dsProcessBody {
2413
+ charge_3ds_id: string;
2414
+ }
2415
+ interface WalletCallbackResponse {
2416
+ id: string;
2417
+ status: string;
2418
+ callback_method: string;
2419
+ callback_rel: string;
2420
+ callback_url: string;
2421
+ }
2422
+
2423
+ declare class ApiCheckoutInternal {
2424
+ protected api: ApiInternal;
2425
+ constructor(api: ApiInternal);
2426
+ instructions(): Observable<object>;
2427
+ private getInstructionLink;
2428
+ callback(payload: Object): Promise<Object>;
2429
+ status(id: string): Promise<Object>;
2430
+ }
2431
+
2432
+ declare class ApiGatewayInternal {
2433
+ protected api: ApiInternal;
2434
+ constructor(api: ApiInternal);
2435
+ getWalletConfig(gateway_id: string): Promise<GetWalletConfigResponse>;
2436
+ }
2437
+ interface GetWalletConfigResponse {
2438
+ type: string;
2439
+ mode: string;
2440
+ credentials?: object;
2441
+ }
2442
+
2443
+ declare class ApiServiceInternal {
2444
+ protected api: ApiInternal;
2445
+ constructor(api: ApiInternal);
2446
+ getConfig(service_id: string): Promise<GetConfigResponse>;
2447
+ }
2448
+ interface GetConfigResponse {
2449
+ type: SERVICE_TYPES;
2450
+ merchant: string;
2451
+ username: string;
2452
+ password: string;
2453
+ certificate: string;
2454
+ certificate_passphrase: string;
2455
+ }
2456
+ declare enum SERVICE_TYPES {
2457
+ ACCERTIFY = "Accertify",
2458
+ BOOKING = "Booking",
2459
+ GPAYMENTS = "GPayments",
2460
+ CLICK_TO_PAY = "ClickToPay",
2461
+ MASTERCARD_NT = "MastercardSCOF",
2462
+ VISA_NT = "VisaVTS",
2463
+ FORTER = "Forter",
2464
+ APPLE_PAY = "ApplePay",
2465
+ GOOGLE_PAY = "GooglePay"
2466
+ }
2467
+
2468
+ declare enum PAYLOAD_FORMAT {
2469
+ ENCRYPTED_STRING = "encrypted_string"
2470
+ }
2471
+
2472
+ declare enum SERVICE_GROUP {
2473
+ CLICK_TO_PAY = "click_to_pay",
2474
+ WALLET = "wallet"
2475
+ }
2476
+
2477
+ /**
2478
+ * Token types returned in the OTT (One-Time Token) creation response.
2479
+ */
2480
+ declare enum TOKEN_TYPE {
2481
+ /** FPAN - Funding Primary Account Number (Google Pay only). */
2482
+ CARD = "card",
2483
+ /** DPAN - Device Primary Account Number (Apple Pay & Google Pay). */
2484
+ CARD_SCHEME_TOKEN = "card_scheme_token"
2485
+ }
2486
+
2487
+ type WalletType = WALLET_TYPES;
2488
+ declare enum WALLET_TYPES {
2489
+ APPLE_PAY = "apple",
2490
+ GOOGLE_PAY = "google"
2491
+ }
2492
+
2493
+ /**
2494
+ * The created One-Time Token (OTT) returned by the SDK after the user authorizes
2495
+ * a wallet payment. Use `temp_token` server-side to create the actual charge via
2496
+ * `POST /v1/charges` (or equivalent).
2497
+ */
2498
+ interface CreateOTTResponse {
2499
+ /** The temporary one-time token string. Single use, short TTL — exchange it server-side immediately. */
2500
+ temp_token: string;
2501
+ /** Token classification. `CARD` for FPAN (Google Pay only); `CARD_SCHEME_TOKEN` for DPAN (Apple Pay & Google Pay). */
2502
+ token_type: TOKEN_TYPE;
2503
+ }
2504
+ /**
2505
+ * Billing address captured from the wallet payment sheet, when requested via
2506
+ * `required_billing_contact_fields` (Apple Pay) or equivalent (Google Pay).
2507
+ */
2508
+ interface Billing {
2509
+ /** First street address line. */
2510
+ address_line1: string;
2511
+ /** Second street address line. Empty string when the wallet did not provide it. */
2512
+ address_line2: string;
2513
+ /** ISO 3166-1 alpha-2 country code (e.g. `'AU'`, `'US'`). */
2514
+ address_country: string;
2515
+ /** City. */
2516
+ address_city: string;
2517
+ /** Postal/ZIP code. */
2518
+ address_postcode: string;
2519
+ /** State or administrative area (e.g. `'NSW'`, `'CA'`). */
2520
+ address_state: string;
2670
2521
  }
2671
- interface WalletCaptureResponse {
2672
- id: string;
2522
+ /**
2523
+ * Card details captured when the wallet returns a card-scheme token (DPAN).
2524
+ * Only the non-sensitive metadata is exposed — full card numbers never reach the SDK.
2525
+ */
2526
+ interface CardInfo {
2527
+ /** Card network identifier from the wallet (e.g. `'visa'`, `'mastercard'`, `'amex'`). */
2528
+ card_scheme: string;
2529
+ /** Last 4 digits of the card, when the wallet provider exposes them. */
2530
+ card_number_last4?: string;
2531
+ }
2532
+ /**
2533
+ * Internal payload the SDK sends to Paydock when creating a One-Time Token.
2534
+ * Exposed publicly so integrators can construct fixtures for testing.
2535
+ */
2536
+ interface CreateOTTData {
2537
+ /** Charge amount as a number (e.g. `19.99`). */
2673
2538
  amount: number;
2674
- currency: string;
2675
- status: string;
2539
+ /** Shipping address and contact info captured from the wallet. */
2540
+ shipping: Shipping;
2541
+ /** Billing address captured from the wallet. */
2542
+ billing: Billing;
2543
+ /** Card metadata captured from the wallet (network, last 4). */
2544
+ card_info: CardInfo;
2545
+ /** Wallet-provider reference token (DPAN/FPAN payload) used by Paydock to settle the charge. */
2546
+ ref_token: string;
2676
2547
  }
2677
- interface WalletCaptureBody {
2678
- payment_method_id?: string;
2679
- customer?: {
2680
- payment_source?: {
2681
- type?: string;
2682
- card_name?: string;
2683
- card_scheme?: string;
2684
- card_number_last4?: string;
2685
- expire_month?: number;
2686
- expire_year?: number;
2687
- address_line1?: string;
2688
- address_line2?: string;
2689
- address_city?: string;
2690
- address_postcode?: string;
2691
- address_state?: string;
2692
- address_country?: string;
2693
- external_payer_id?: string;
2694
- ref_token?: string;
2695
- wallet_express?: boolean;
2696
- };
2697
- };
2548
+ /**
2549
+ * Request body used internally when calling Paydock's OTT-creation endpoint.
2550
+ * Exposed publicly so integrators can mirror the shape if they need to. */
2551
+ interface CreateOTTRequest {
2552
+ /** The Paydock service ID configured in the merchant dashboard for this wallet. */
2553
+ service_id: string;
2554
+ /** Wallet type identifier (Apple Pay, Google Pay, etc.). */
2555
+ service_type: SERVICE_TYPES;
2556
+ /** Service group classification (e.g. `'WALLET'`). */
2557
+ service_group: SERVICE_GROUP;
2558
+ /** Encrypted/encoded payload from the wallet (DPAN/FPAN data). */
2559
+ payload: string;
2560
+ /** Encoding format of `payload` — currently `'encrypted_string'`. */
2561
+ payload_format: PAYLOAD_FORMAT;
2698
2562
  }
2699
- interface WalletCallbackBody {
2700
- request_type: string;
2563
+ /**
2564
+ * Request body sent when initiating a wallet session against Paydock
2565
+ * (used by the Apple Pay merchant validation flow).
2566
+ */
2567
+ interface CreateSessionRequest {
2568
+ /** The Paydock service ID for the wallet. */
2569
+ service_id: string;
2570
+ /** Caller-controlled session identifier — Paydock binds the session to this id. */
2571
+ session_id: string;
2572
+ /** Whether the wallet sheet should ask the user for shipping. */
2573
+ request_shipping?: boolean;
2574
+ /** Merchant store name displayed in the wallet sheet. */
2575
+ store_name: string;
2701
2576
  }
2702
- interface WalletCallbackResponse {
2577
+ /**
2578
+ * Response returned by Paydock after creating a wallet session.
2579
+ * Used internally by the SDK to drive merchant validation; rarely consumed directly.
2580
+ */
2581
+ interface CreateSessionResponse {
2582
+ /** Paydock session identifier. */
2703
2583
  id: string;
2584
+ /** Session status (e.g. `'active'`). */
2704
2585
  status: string;
2586
+ /** HTTP method the SDK should use to invoke the callback URL. */
2705
2587
  callback_method: string;
2588
+ /** Relation/role of the callback (e.g. `'merchant_validation'`). */
2706
2589
  callback_rel: string;
2590
+ /** URL the SDK calls to complete the merchant validation step. */
2707
2591
  callback_url: string;
2708
2592
  }
2709
-
2710
- declare class ApiCheckoutInternal {
2711
- protected api: ApiInternal;
2712
- constructor(api: ApiInternal);
2713
- instructions(): Observable<object>;
2714
- private getInstructionLink;
2715
- callback(payload: Object): Promise<Object>;
2716
- status(id: string): Promise<Object>;
2593
+ /**
2594
+ * Union of the native wallet authorization payloads the SDK may receive
2595
+ * from Apple Pay or Google Pay at the moment of payment authorization.
2596
+ * Used internally; rarely exposed to integrators directly.
2597
+ */
2598
+ type CheckoutResponse = ApplePayJS.ApplePayPaymentAuthorizedEvent | google.payments.api.PaymentAuthorizationResult | google.payments.api.PaymentData;
2599
+ /**
2600
+ * Action codes returned by the SDK during the wallet checkout lifecycle.
2601
+ * Mirrors the ApplePay payment authorization completion codes used internally
2602
+ * to decide what UI/state transition to perform next.
2603
+ */
2604
+ declare enum CheckoutActionCode {
2605
+ /** Payment completed successfully. */
2606
+ COMPLETE = "COMPLETE",
2607
+ /** User cancelled the wallet sheet. */
2608
+ CANCEL = "CANCEL",
2609
+ /** An error occurred during payment authorization. */
2610
+ ERROR = "ERROR",
2611
+ /** User opted to switch to a different card in the wallet. */
2612
+ CHANGE_CARD = "CHANGE_CARD",
2613
+ /** User opted to add a new card to the wallet. */
2614
+ ADD_CARD = "ADD_CARD",
2615
+ /** User switched to a different consumer (Click to Pay flow). */
2616
+ SWITCH_CONSUMER = "SWITCH_CONSUMER"
2617
+ }
2618
+ /**
2619
+ * Token response shape returned by Paydock after creating an OTT.
2620
+ * Used by the SDK to decide whether a follow-up 3DS step is required.
2621
+ */
2622
+ interface OTTResponse {
2623
+ /** The OTT string. */
2624
+ token: string;
2625
+ /** Token type identifier (string form of {@link TOKEN_TYPE}). */
2626
+ token_type: string;
2627
+ /** When `true`, the integrator must invoke a Canvas3DS step before settling the charge. */
2628
+ three_ds_required?: boolean;
2629
+ /** Which wallet produced the token (Apple Pay or Google Pay). */
2630
+ wallet_type: WalletType;
2631
+ }
2632
+ /**
2633
+ * Shipping address and contact information captured from the wallet payment sheet,
2634
+ * when requested via `request_shipping` (and friends) on the wallet meta.
2635
+ *
2636
+ * All fields are optional because each wallet provider returns a different subset.
2637
+ * Address line fields are typically Apple Pay-only (Google Pay returns a coarser shape).
2638
+ */
2639
+ interface Shipping {
2640
+ /** Selected shipping method identifier (e.g. `'standard'`, `'express'`). */
2641
+ method?: string;
2642
+ /** Updated shipping options that were available when the user made their selection. */
2643
+ options?: IShippingOption[];
2644
+ /** First street address line (Apple Pay only). */
2645
+ address_line1?: string;
2646
+ /** Second street address line (Apple Pay only). */
2647
+ address_line2?: string;
2648
+ /** City. */
2649
+ address_city?: string;
2650
+ /** Postal/ZIP code. */
2651
+ address_postcode?: string;
2652
+ /** State or administrative area. */
2653
+ address_state?: string;
2654
+ /** ISO 3166-1 alpha-2 country code. */
2655
+ address_country?: string;
2656
+ /** Company name on the address (when the wallet captured it). */
2657
+ address_company?: string;
2658
+ /** Origin postal code — used for shipping calculations when the merchant ships from a fixed location. */
2659
+ address_origin_postcode?: string;
2660
+ /** Shipping contact information (Apple Pay only). */
2661
+ contact?: {
2662
+ /** Contact first name. */
2663
+ first_name?: string;
2664
+ /** Contact last name. */
2665
+ last_name?: string;
2666
+ /** Contact email address. */
2667
+ email?: string;
2668
+ /** Contact phone number. */
2669
+ phone?: string;
2670
+ /** Contact secondary phone number. */
2671
+ phone2?: string;
2672
+ };
2717
2673
  }
2718
2674
 
2719
- declare class ApiGatewayInternal {
2675
+ declare class ApiPaymentSourceInternal {
2720
2676
  protected api: ApiInternal;
2721
2677
  constructor(api: ApiInternal);
2722
- getWalletConfig(gateway_id: string): Promise<GetWalletConfigResponse>;
2678
+ createOTT(payload: CreateOTTRequest): Promise<CreateOTTResponse>;
2679
+ createSession(payload: CreateSessionRequest): Promise<CreateSessionResponse>;
2723
2680
  }
2724
- interface GetWalletConfigResponse {
2725
- type: string;
2726
- mode: string;
2727
- credentials?: object;
2681
+
2682
+ declare class ApiInternal extends ApiBase {
2683
+ charge(): ApiChargeInternal;
2684
+ service(): ApiServiceInternal;
2685
+ checkout(): ApiCheckoutInternal;
2686
+ gateway(): ApiGatewayInternal;
2687
+ paymentSource(): ApiPaymentSourceInternal;
2728
2688
  }
2729
2689
 
2730
- declare class ApiServiceInternal {
2690
+ /**
2691
+ * Public alias for GPAYMENTS_EVENT. Same object reference — no behavioral change.
2692
+ * Prefer `CANVAS_3DS_EVENT` in public-facing code; `GPAYMENTS_EVENT` remains for
2693
+ * backwards-compatible internal usage.
2694
+ */
2695
+ declare const CANVAS_3DS_EVENT: {
2696
+ /** Authentication succeeded. Payload: `Canvas3dsAuthPayload`. */
2697
+ readonly AUTH_SUCCESS: "chargeAuthSuccess";
2698
+ /** Authentication failed — covers issuer rejection, iframe timeout (`AuthTimedOut`), and invalid-event outcomes. Payload: `Canvas3dsAuthPayload`. */
2699
+ readonly AUTH_ERROR: "chargeAuthReject";
2700
+ /** Decoupled authentication — issuer will authenticate out-of-band. Payload: `Canvas3dsAuthPayload`. */
2701
+ readonly DECOUPLED: "chargeAuthDecoupled";
2702
+ /** Challenge required — issuer demands user interaction. Payload: `Canvas3dsAuthPayload`. */
2703
+ readonly CHALLENGE: "chargeAuthChallenge";
2704
+ /**
2705
+ * Two-step mode only: fingerprint done, SDK waiting for `Canvas3ds.authenticate()`. Emitted once, before any
2706
+ * outcome event (`INFO` may precede it); never for a one-step charge. Payload: `Canvas3dsReadyPayload`.
2707
+ */
2708
+ readonly READY: "chargeAuthReady";
2709
+ /**
2710
+ * The challenge iframe fired its FIRST `load` after `chargeAuthChallenge` (the ACS page has painted),
2711
+ * or the `CHALLENGE_LOADED_FALLBACK_MS` safety fallback elapsed without one. Emitted exactly once per
2712
+ * challenge; never emitted for a decoupled challenge (no challenge iframe). Payload: `Canvas3dsChallengeLoadedPayload`.
2713
+ */
2714
+ readonly CHALLENGE_LOADED: "chargeAuthChallengeLoaded";
2715
+ /**
2716
+ * The issuer delivered the final authentication result to the 3DS Server (the shopper finished the
2717
+ * challenge, or approved a decoupled authentication) and the SDK is now obtaining the outcome. Emitted at
2718
+ * most once per authentication, always before the terminal event. Detected through the `secondary_url`
2719
+ * result monitor (`source: 'poll'`) or, when the callback message arrives first, right before the outcome
2720
+ * it carries (`source: 'callback'`). Payload: `Canvas3dsChallengeCompletedPayload`.
2721
+ */
2722
+ readonly CHALLENGE_COMPLETED: "chargeAuthChallengeCompleted";
2723
+ /** Informational signal emitted by the GPayments flow. Internal — not part of the public typed surface. */
2724
+ readonly INFO: "chargeAuthInfo";
2725
+ /** Error during the flow (network, parsing, etc.). Payload: `Canvas3dsErrorPayload`. */
2726
+ readonly ERROR: "error";
2727
+ };
2728
+ declare class GPaymentsService {
2729
+ protected container: Container;
2731
2730
  protected api: ApiInternal;
2732
- constructor(api: ApiInternal);
2733
- getConfig(service_id: string): Promise<GetConfigResponse>;
2734
- }
2735
- interface GetConfigResponse {
2736
- type: SERVICE_TYPES;
2737
- merchant: string;
2738
- username: string;
2739
- password: string;
2740
- certificate: string;
2741
- certificate_passphrase: string;
2742
- }
2743
- declare enum SERVICE_TYPES {
2744
- ACCERTIFY = "Accertify",
2745
- BOOKING = "Booking",
2746
- GPAYMENTS = "GPayments",
2747
- CLICK_TO_PAY = "ClickToPay",
2748
- MASTERCARD_NT = "MastercardSCOF",
2749
- VISA_NT = "VisaVTS",
2750
- FORTER = "Forter",
2751
- APPLE_PAY = "ApplePay",
2752
- GOOGLE_PAY = "GooglePay"
2731
+ protected eventEmitter: EventEmitter;
2732
+ /** Origins allowed to deliver a processed outcome (`process_status`) via postMessage. */
2733
+ protected trustedOrigins: string[];
2734
+ protected browserAndChallengeContainer: Container;
2735
+ protected iFrameAuthorization: IFrame;
2736
+ protected monitoringContainer: Container;
2737
+ protected iFrameSecondaryUrl?: IFrame;
2738
+ protected iFrameEvent: IFrameEvent;
2739
+ protected resultRead: boolean;
2740
+ /** `chargeAuthChallengeLoaded` already emitted for the current challenge (by `load` or by the fallback). */
2741
+ protected challengeLoadedEmitted: boolean;
2742
+ /** `chargeAuthChallengeCompleted` already emitted for the current authentication (poll or callback). */
2743
+ protected challengeCompletedEmitted: boolean;
2744
+ /** Set once a terminal event was emitted: no lifecycle event may follow (reset when a new challenge starts). */
2745
+ protected challengeLifecycleClosed: boolean;
2746
+ protected challengeLoadedTimer: ReturnType<typeof setTimeout> | null;
2747
+ protected resultPollTimer: ReturnType<typeof setTimeout> | null;
2748
+ /** One-shot guard for the `chargeAuth` leg — the callback message may be delivered more than once. */
2749
+ protected authHandled: boolean;
2750
+ /** Two-step mode: `charge_3ds_id` of the deferred callback message; `null` until it arrives (always for one-step). */
2751
+ protected deferredCharge3dsId: string | null;
2752
+ /** `authenticate()` latch; consumed when the deferred message arrives, reset only after a `/process` transport failure. */
2753
+ protected authenticateRequested: boolean;
2754
+ /** One `/process` call per widget instance (a transport failure allows one more `authenticate()`). */
2755
+ protected authenticationStarted: boolean;
2756
+ /** The single `/process` retry after a transport failure has been granted; the next failure is final. */
2757
+ protected authenticationRetryUsed: boolean;
2758
+ constructor(container: Container, api: ApiInternal, eventEmitter: EventEmitter,
2759
+ /** Origins allowed to deliver a processed outcome (`process_status`) via postMessage. */
2760
+ trustedOrigins?: string[]);
2761
+ load({ initialization_url, secondary_url, charge_3ds_id }: ITokenStandalone3DS, title: string): void;
2762
+ private initializeIFrames;
2763
+ private hideIframes;
2764
+ private setupIFrameEvents;
2765
+ /**
2766
+ * Two-step mode: run the deferred authentication (`POST /standalone-3ds/process`). Never throws: runs now if
2767
+ * the deferred message already arrived, otherwise as soon as it does; a no-op on one-step charges, repeated
2768
+ * calls or after a terminal outcome. The outcome flows through the usual events.
2769
+ */
2770
+ authenticate(): void;
2771
+ /**
2772
+ * Calls `/process` once per instance (reachable from both the deferred message and `authenticate()`). The
2773
+ * response has the callback-outcome shape, so the challenge / decoupled / result legs are shared with
2774
+ * one-step. A rejection surfaces as `error`, with the same error object shape as the one-step callback
2775
+ * (`toOutcomeError`). An API answer (stale session, rejected authentication…) is terminal. The first transport
2776
+ * failure is not: the AReq may have run with its response lost, so the latches are reset and the merchant may
2777
+ * call `authenticate()` once more — `/process` is idempotent and replays the stored outcome. A failure of that
2778
+ * retry, of any kind, is final.
2779
+ */
2780
+ private performAuthentication;
2781
+ /**
2782
+ * A message carries a processed outcome only when it has `process_status` AND comes from a trusted
2783
+ * origin. Used by the result leg: an untrusted `process_status` is never acted upon — the SDK falls
2784
+ * back to `GET /handle` (still needed for decoupled challenges / polling). The authentication leg
2785
+ * ignores untrusted senders outright, before this check.
2786
+ */
2787
+ private hasChainedOutcome;
2788
+ private isTrustedOrigin;
2789
+ private removeIframes;
2790
+ private clearChallengeLoadedTimer;
2791
+ /**
2792
+ * Challenge iframe lifecycle (`chargeAuthChallengeLoaded`).
2793
+ *
2794
+ * The challenge iframe is cross-origin, but its `load` event still fires when the ACS page finishes loading:
2795
+ * the first one means the page painted (merchants can drop their loader). A fallback timer
2796
+ * (`armChallengeLoadedFallback`) guarantees `chargeAuthChallengeLoaded` within `CHALLENGE_LOADED_FALLBACK_MS`
2797
+ * even if no `load` ever fires; a late paint after that is simply ignored. Later `load`s are NOT a usable
2798
+ * signal for "the shopper submitted": the post-submit hops are HTTP redirects and self-submitting pages whose
2799
+ * loads abort, and the final callback page posts its message before its own `load` — so the post-submit
2800
+ * moment is `chargeAuthChallengeCompleted`, driven by the `secondary_url` result monitor instead.
2801
+ *
2802
+ * Nothing is emitted once the flow reached a terminal outcome (`finishChallengeLifecycle`), and a
2803
+ * decoupled challenge (no challenge iframe) never emits `chargeAuthChallengeLoaded`.
2804
+ *
2805
+ * Resets the per-challenge state and returns the `load` handler to attach to the challenge iframe.
2806
+ */
2807
+ private startChallengeLifecycle;
2808
+ /**
2809
+ * Arms the `chargeAuthChallengeLoaded` fallback — only when a challenge iframe actually exists (the
2810
+ * container may be gone, or `IFrame.load` may have no-op'd on an already-present iframe).
2811
+ */
2812
+ private armChallengeLoadedFallback;
2813
+ private emitChallengeLoaded;
2814
+ /**
2815
+ * `chargeAuthChallengeCompleted` — once per authentication, never after a terminal event. Idempotent so the
2816
+ * poll and the callback message can both call it: the first transport to notice the issuer's result wins.
2817
+ */
2818
+ private emitChallengeCompleted;
2819
+ /** Call before emitting any terminal event: no lifecycle event may follow it, and the result poll stops. */
2820
+ private finishChallengeLifecycle;
2821
+ private stopResultPolling;
2822
+ private parseResultData;
2823
+ private parseHandleResponse;
2824
+ private parseError;
2825
+ private processResult;
2826
+ /** Final (post-challenge) outcome delivered by the API through the callback message. */
2827
+ private handleResultOutcome;
2828
+ private externalAPI;
2829
+ /**
2830
+ * Polls the GPayments result monitor (`secondary_url`) until `AuthResultReady`. It is the primary source of
2831
+ * `chargeAuthChallengeCompleted` (the monitor flips as soon as the issuer's RReq reaches the 3DS Server) and
2832
+ * the fallback transport for the outcome itself (`GET /handle`) when the callback message never arrives —
2833
+ * the only transport for decoupled challenges. Stops once an outcome was obtained or the lifecycle closed.
2834
+ * Transport failures are retried on the same cadence; an unparsable body or an unknown event is fatal.
2835
+ */
2836
+ private doPolling;
2837
+ /**
2838
+ * Branches on the authentication outcome — delivered by the API through the callback message
2839
+ * (`process_status` → `status`) or, in two-step mode, returned by `/process` (same shape).
2840
+ */
2841
+ private handleAuthenticationOutcome;
2753
2842
  }
2754
2843
 
2755
- declare enum PAYLOAD_FORMAT {
2756
- ENCRYPTED_STRING = "encrypted_string"
2844
+ /**
2845
+ * Decoded payload of the Standalone 3DS charge token (the JWT body) the SDK
2846
+ * receives in `Canvas3ds`'s constructor when the token format is `standalone_3ds`.
2847
+ *
2848
+ * This shape is set by the Paydock backend when minting the token. Integrators
2849
+ * who decode the token themselves can use this interface to type the result.
2850
+ */
2851
+ interface ITokenStandalone3DS {
2852
+ /** Optional merchant-side correlation identifier carried through from the original charge request. */
2853
+ external_id?: string;
2854
+ /** URL of the first iframe the SDK loads to bootstrap the 3DS provider's authentication flow. */
2855
+ initialization_url: string;
2856
+ /**
2857
+ * @deprecated No longer read by the Standalone 3DS flow. The field is kept
2858
+ * on the interface for backwards compatibility with tokens minted by older
2859
+ * API versions; it will be removed in a future major release. Prefer
2860
+ * `initialization_url` + `secondary_url`.
2861
+ */
2862
+ authorization_url?: string;
2863
+ /** Optional URL of a secondary iframe used by some providers (e.g. GPayments) for monitoring/polling alongside the main flow. */
2864
+ secondary_url?: string;
2865
+ /** The Paydock 3DS charge identifier this token authorizes. Echoed back in every event payload emitted during the flow. */
2866
+ charge_3ds_id: string;
2867
+ /** Identifier of the 3DS gateway the SDK should delegate to. Currently only `'GPayments'` is handled; other values fall through. */
2868
+ service_type: string;
2757
2869
  }
2758
-
2759
- declare enum SERVICE_GROUP {
2760
- CLICK_TO_PAY = "click_to_pay",
2761
- WALLET = "wallet"
2870
+ declare class Standalone3dsService {
2871
+ protected container: Container;
2872
+ protected eventEmitter: EventEmitter;
2873
+ protected env: string;
2874
+ protected alias: string;
2875
+ /** Provider flow created by `load()`; `undefined` before it. */
2876
+ protected gpaymentsService?: GPaymentsService;
2877
+ constructor(container: Container, eventEmitter: any);
2878
+ load(token: string, options: {
2879
+ title: string;
2880
+ }): void;
2881
+ /**
2882
+ * Two-step mode: forwards `Canvas3ds.authenticate()` to the provider flow. Calling it before `load()` is an
2883
+ * integration bug (nothing to authenticate yet): it emits `error` and is not remembered.
2884
+ */
2885
+ authenticate(token: string): void;
2886
+ /** `charge_3ds_id` from the standalone 3DS charge token, `undefined` when it cannot be decoded. */
2887
+ private static readCharge3dsId;
2888
+ /**
2889
+ * Origins allowed to deliver a processed 3DS outcome to the page via postMessage: the Paydock API
2890
+ * (inline callback page) and the Paydock widget (remote-app landing page), for the current env/alias.
2891
+ */
2892
+ protected getTrustedMessageOrigins(api: ApiBase): string[];
2893
+ setEnv(env: string, alias?: string): void;
2762
2894
  }
2763
2895
 
2764
2896
  /**
2765
- * Token types returned in the OTT (One-Time Token) creation response.
2897
+ * Payload emitted by the Standalone 3DS flow for auth-related events
2898
+ * (chargeAuthSuccess, chargeAuthReject, chargeAuthChallenge, chargeAuthDecoupled).
2766
2899
  */
2767
- declare enum TOKEN_TYPE {
2768
- /** FPAN - Funding Primary Account Number (Google Pay only). */
2769
- CARD = "card",
2770
- /** DPAN - Device Primary Account Number (Apple Pay & Google Pay). */
2771
- CARD_SCHEME_TOKEN = "card_scheme_token"
2900
+ interface Canvas3dsAuthPayload {
2901
+ /** The Paydock 3DS charge identifier (e.g. `'chrg_3ds_xxxxx'`) used to correlate the authentication with the underlying charge. */
2902
+ charge_3ds_id: string;
2903
+ /** Authentication outcome status reported by the 3DS provider (e.g. `'authenticated'`, `'rejected'`, `'pending'`). */
2904
+ status: string;
2905
+ /** Optional result details. Present when the 3DS provider returns additional context for the outcome. */
2906
+ result?: {
2907
+ /** Human-readable description of the outcome (e.g. `'frictionless'`). */
2908
+ description?: string;
2909
+ };
2772
2910
  }
2773
-
2774
- type WalletType = WALLET_TYPES;
2775
- declare enum WALLET_TYPES {
2776
- APPLE_PAY = "apple",
2777
- GOOGLE_PAY = "google"
2911
+ /** Payload of `chargeAuthReady` (two-step Standalone 3DS only): fingerprint done, SDK waiting for `Canvas3ds.authenticate()`. */
2912
+ interface Canvas3dsReadyPayload {
2913
+ /** Paydock 3DS charge id of the deferred authentication. */
2914
+ charge_3ds_id: string;
2778
2915
  }
2779
-
2780
2916
  /**
2781
- * The created One-Time Token (OTT) returned by the SDK after the user authorizes
2782
- * a wallet payment. Use `temp_token` server-side to create the actual charge via
2783
- * `POST /v1/charges` (or equivalent).
2917
+ * Payload of `chargeAuthChallengeLoaded` (Standalone 3DS, challenge flow only).
2918
+ * Emitted exactly once per challenge, after `chargeAuthChallenge`.
2784
2919
  */
2785
- interface CreateOTTResponse {
2786
- /** The temporary one-time token string. Single use, short TTL — exchange it server-side immediately. */
2787
- temp_token: string;
2788
- /** Token classification. `CARD` for FPAN (Google Pay only); `CARD_SCHEME_TOKEN` for DPAN (Apple Pay & Google Pay). */
2789
- token_type: TOKEN_TYPE;
2920
+ interface Canvas3dsChallengeLoadedPayload {
2921
+ /** The Paydock 3DS charge identifier the challenge belongs to. */
2922
+ charge_3ds_id: string;
2923
+ /**
2924
+ * `'load'` — the challenge iframe fired its first `load`: the ACS page has painted.
2925
+ * `'timeout'` — no `load` arrived within the SDK's 2.5 s safety fallback; the event is emitted anyway so a
2926
+ * loader is never held forever (the page may still be loading and will paint on its own). Useful for
2927
+ * analytics (how often the fallback fires) — you do not need to handle the two differently.
2928
+ */
2929
+ reason: 'load' | 'timeout';
2790
2930
  }
2791
2931
  /**
2792
- * Billing address captured from the wallet payment sheet, when requested via
2793
- * `required_billing_contact_fields` (Apple Pay) or equivalent (Google Pay).
2932
+ * Payload of `chargeAuthChallengeCompleted` (Standalone 3DS, challenge and decoupled flows).
2933
+ * Emitted at most once per authentication, after the shopper finished the challenge (or approved a decoupled
2934
+ * authentication) and always before the terminal event.
2794
2935
  */
2795
- interface Billing {
2796
- /** First street address line. */
2797
- address_line1: string;
2798
- /** Second street address line. Empty string when the wallet did not provide it. */
2799
- address_line2: string;
2800
- /** ISO 3166-1 alpha-2 country code (e.g. `'AU'`, `'US'`). */
2801
- address_country: string;
2802
- /** City. */
2803
- address_city: string;
2804
- /** Postal/ZIP code. */
2805
- address_postcode: string;
2806
- /** State or administrative area (e.g. `'NSW'`, `'CA'`). */
2807
- address_state: string;
2936
+ interface Canvas3dsChallengeCompletedPayload {
2937
+ /** The Paydock 3DS charge identifier the authentication belongs to. */
2938
+ charge_3ds_id: string;
2939
+ /**
2940
+ * How the SDK learned that the issuer delivered the result:
2941
+ * `'poll'` — the 3DS Server's result monitor reported it (the usual case: it flips as soon as the issuer's
2942
+ * result reaches the 3DS Server, before the challenge iframe has even left the bank's page);
2943
+ * `'callback'` — the callback message carrying the outcome arrived first (the terminal event follows
2944
+ * immediately). Informational only — handle both the same way.
2945
+ */
2946
+ source: 'poll' | 'callback';
2808
2947
  }
2809
2948
  /**
2810
- * Card details captured when the wallet returns a card-scheme token (DPAN).
2811
- * Only the non-sensitive metadata is exposed — full card numbers never reach the SDK.
2949
+ * Payload emitted by the Standalone 3DS flow for error events.
2950
+ * `error` is intentionally `unknown` — upstream emitters do not guarantee a shape.
2812
2951
  */
2813
- interface CardInfo {
2814
- /** Card network identifier from the wallet (e.g. `'visa'`, `'mastercard'`, `'amex'`). */
2815
- card_scheme: string;
2816
- /** Last 4 digits of the card, when the wallet provider exposes them. */
2817
- card_number_last4?: string;
2952
+ interface Canvas3dsErrorPayload {
2953
+ /** The Paydock 3DS charge identifier associated with the failed authentication attempt. */
2954
+ charge_3ds_id: string;
2955
+ /** The underlying error. Typed as `unknown` to force the consumer to narrow it before use. */
2956
+ error: unknown;
2818
2957
  }
2819
2958
  /**
2820
- * Internal payload the SDK sends to Paydock when creating a One-Time Token.
2821
- * Exposed publicly so integrators can construct fixtures for testing.
2959
+ * Payload emitted by the iframe-based 3DS flow for auth-related events
2960
+ * (`chargeAuth`, `chargeAuthSuccess`, `chargeAuthReject`).
2961
+ *
2962
+ * Extends `IEventData` with optional 3DS-specific fields that the widget
2963
+ * merges into the message envelope for charge correlation.
2822
2964
  */
2823
- interface CreateOTTData {
2824
- /** Charge amount as a number (e.g. `19.99`). */
2825
- amount: number;
2826
- /** Shipping address and contact info captured from the wallet. */
2827
- shipping: Shipping;
2828
- /** Billing address captured from the wallet. */
2829
- billing: Billing;
2830
- /** Card metadata captured from the wallet (network, last 4). */
2831
- card_info: CardInfo;
2832
- /** Wallet-provider reference token (DPAN/FPAN payload) used by Paydock to settle the charge. */
2833
- ref_token: string;
2965
+ interface Canvas3dsChargeAuthEventPayload extends IEventData$1 {
2966
+ /** The Paydock 3DS charge identifier. Present when the widget correlates the event with a charge. */
2967
+ charge_3ds_id?: string;
2968
+ /** Authentication outcome status reported by the widget (e.g. `'authenticated'`, `'server_error'`). */
2969
+ status?: string;
2970
+ /** Optional result details forwarded from the 3DS provider. */
2971
+ result?: {
2972
+ /** Human-readable description of the outcome (e.g. `'frictionless'`). */
2973
+ description?: string;
2974
+ };
2834
2975
  }
2835
2976
  /**
2836
- * Request body used internally when calling Paydock's OTT-creation endpoint.
2837
- * Exposed publicly so integrators can mirror the shape if they need to. */
2838
- interface CreateOTTRequest {
2839
- /** The Paydock service ID configured in the merchant dashboard for this wallet. */
2840
- service_id: string;
2841
- /** Wallet type identifier (Apple Pay, Google Pay, etc.). */
2842
- service_type: SERVICE_TYPES;
2843
- /** Service group classification (e.g. `'WALLET'`). */
2844
- service_group: SERVICE_GROUP;
2845
- /** Encrypted/encoded payload from the wallet (DPAN/FPAN data). */
2846
- payload: string;
2847
- /** Encoding format of `payload` — currently `'encrypted_string'`. */
2848
- payload_format: PAYLOAD_FORMAT;
2977
+ * Payload emitted by the iframe-based 3DS flow for error events.
2978
+ * Extends `IEventData` with optional 3DS-specific fields for charge correlation.
2979
+ */
2980
+ interface Canvas3dsErrorEventPayload extends IEventData$1 {
2981
+ /** The Paydock 3DS charge identifier associated with the error. */
2982
+ charge_3ds_id?: string;
2983
+ }
2984
+ /**
2985
+ * Maps Canvas3ds event names to their callback data types.
2986
+ *
2987
+ * Events that can fire from both the iframe (html/url) and standalone flows
2988
+ * use a union to accommodate both shapes. Standalone-only and iframe-only events
2989
+ * use a single payload type.
2990
+ */
2991
+ interface Canvas3dsEventMap {
2992
+ /** Successful authentication. Standalone path emits `Canvas3dsAuthPayload`; iframe path emits `Canvas3dsChargeAuthEventPayload`. Narrow with `'event' in data` for iframe vs standalone. */
2993
+ chargeAuthSuccess: Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload;
2994
+ /** Rejected authentication. Same dual-emit pattern as `chargeAuthSuccess`. */
2995
+ chargeAuthReject: Canvas3dsAuthPayload | Canvas3dsChargeAuthEventPayload;
2996
+ /** Authentication or processing error. Standalone path emits `Canvas3dsErrorPayload`; iframe path emits `Canvas3dsErrorEventPayload`. */
2997
+ error: Canvas3dsErrorPayload | Canvas3dsErrorEventPayload;
2998
+ /** Challenge required — issuer demands user interaction (OTP, biometric, etc.). Standalone-only. */
2999
+ chargeAuthChallenge: Canvas3dsAuthPayload;
3000
+ /**
3001
+ * Two-step mode only (`_3ds.authentication_flow: 'two_step'`): the background fingerprint is done and the SDK waits for
3002
+ * `Canvas3ds.authenticate()`. Standalone-only; fires once, after `load()` and before any outcome event
3003
+ * (`chargeAuthInfo` may precede it); never fires for a one-step charge, nor for inbuilt 3DS (`html` / `url`)
3004
+ * tokens (no event at all for those).
3005
+ *
3006
+ * Pattern: `load()` in a hidden container when the review page opens, `authenticate()` on Pay (a call before
3007
+ * `chargeAuthReady` is remembered; one before `load()` emits `error`), reveal the container only on `chargeAuthChallenge`, finish on the outcome events.
3008
+ */
3009
+ chargeAuthReady: Canvas3dsReadyPayload;
3010
+ /**
3011
+ * The challenge iframe has painted (first `load`), or the 2.5 s fallback elapsed — see `reason`. Standalone-only,
3012
+ * challenge flow only (never emitted for decoupled challenges). Fires once, after `chargeAuthChallenge`.
3013
+ *
3014
+ * Recommended loader pattern: show a loader before the charge POST, keep it through `chargeAuthChallenge`,
3015
+ * reveal the challenge on this event, cover it with "Completing verification" on `chargeAuthChallengeCompleted`,
3016
+ * and finish on `chargeAuthSuccess` / `chargeAuthReject` / `error`.
3017
+ */
3018
+ chargeAuthChallengeLoaded: Canvas3dsChallengeLoadedPayload;
3019
+ /**
3020
+ * The shopper finished the challenge (or approved a decoupled authentication): the issuer delivered the final
3021
+ * result to the 3DS Server and the SDK is obtaining the outcome. Cover the challenge iframe with your own
3022
+ * "Completing verification" state — whatever the bank or the 3DS Server render from here on is plumbing, not
3023
+ * UX. Standalone-only. Fires at most once per authentication, always before `chargeAuthSuccess` /
3024
+ * `chargeAuthReject` / `error`, and never after them. A wrong OTP or a further interactive step does NOT fire
3025
+ * it (no result has been delivered yet), so no grace timer or reveal fallback is needed on your side.
3026
+ */
3027
+ chargeAuthChallengeCompleted: Canvas3dsChallengeCompletedPayload;
3028
+ /** Decoupled authentication — issuer will authenticate out-of-band and notify later. Standalone-only. */
3029
+ chargeAuthDecoupled: Canvas3dsAuthPayload;
3030
+ /** Iframe-path authentication event. Extends `IEventData` with optional 3DS correlation fields (`charge_3ds_id`, `status`). */
3031
+ chargeAuth: Canvas3dsChargeAuthEventPayload;
3032
+ /** User cancelled the authentication flow before completion. Iframe-only. */
3033
+ chargeAuthCancelled: IEventData$1;
3034
+ /** Additional data collection step completed successfully. Iframe-only. */
3035
+ additionalDataCollectSuccess: IEventData$1;
3036
+ /** Additional data collection step was rejected. Iframe-only. */
3037
+ additionalDataCollectReject: IEventData$1;
2849
3038
  }
3039
+ /** Union of all known Canvas3ds event names. */
3040
+ type Canvas3dsEventName = keyof Canvas3dsEventMap;
2850
3041
  /**
2851
- * Request body sent when initiating a wallet session against Paydock
2852
- * (used by the Apple Pay merchant validation flow).
3042
+ * Public, tree-shakeable alias for the internal `TOKEN_FORMAT` enum in canvas-3ds.ts.
3043
+ * Mirrors the string values of that enum without exposing the private enum itself.
2853
3044
  */
2854
- interface CreateSessionRequest {
2855
- /** The Paydock service ID for the wallet. */
2856
- service_id: string;
2857
- /** Caller-controlled session identifier — Paydock binds the session to this id. */
2858
- session_id: string;
2859
- /** Whether the wallet sheet should ask the user for shipping. */
2860
- request_shipping?: boolean;
2861
- /** Merchant store name displayed in the wallet sheet. */
2862
- store_name: string;
2863
- }
3045
+ declare const Canvas3dsTokenFormat: {
3046
+ /** Token whose `content` is a complete HTML page. The SDK renders it inside an iframe. */
3047
+ readonly HTML: "html";
3048
+ /** Token whose `content` is a URL. The SDK loads it inside an iframe. */
3049
+ readonly URL: "url";
3050
+ /** Token whose `content` describes a standalone 3DS service (e.g. GPayments). The SDK delegates to that service's flow. */
3051
+ readonly STANDALONE_3DS: "standalone_3ds";
3052
+ };
3053
+ type Canvas3dsTokenFormat = (typeof Canvas3dsTokenFormat)[keyof typeof Canvas3dsTokenFormat];
3054
+
2864
3055
  /**
2865
- * Response returned by Paydock after creating a wallet session.
2866
- * Used internally by the SDK to drive merchant validation; rarely consumed directly.
3056
+ * List of available token's content formats
3057
+ * @enum TOKEN_FORMAT
3058
+ *
3059
+ * @type {object}
3060
+ * @param {string} HTML=html
2867
3061
  */
2868
- interface CreateSessionResponse {
2869
- /** Paydock session identifier. */
2870
- id: string;
2871
- /** Session status (e.g. `'active'`). */
2872
- status: string;
2873
- /** HTTP method the SDK should use to invoke the callback URL. */
2874
- callback_method: string;
2875
- /** Relation/role of the callback (e.g. `'merchant_validation'`). */
2876
- callback_rel: string;
2877
- /** URL the SDK calls to complete the merchant validation step. */
2878
- callback_url: string;
3062
+ declare enum TOKEN_FORMAT {
3063
+ HTML = "html",
3064
+ URL = "url",
3065
+ STANDALONE_3DS = "standalone_3ds"
2879
3066
  }
2880
3067
  /**
2881
- * Union of the native wallet authorization payloads the SDK may receive
2882
- * from Apple Pay or Google Pay at the moment of payment authorization.
2883
- * Used internally; rarely exposed to integrators directly.
2884
- */
2885
- type CheckoutResponse = ApplePayJS.ApplePayPaymentAuthorizedEvent | google.payments.api.PaymentAuthorizationResult | google.payments.api.PaymentData;
2886
- /**
2887
- * Action codes returned by the SDK during the wallet checkout lifecycle.
2888
- * Mirrors the ApplePay payment authorization completion codes used internally
2889
- * to decide what UI/state transition to perform next.
3068
+ * List of available event's name
3069
+ * @const EVENT
3070
+ *
3071
+ * @type {object}
3072
+ * @param {string} CHARGE_AUTH_SUCCESS=chargeAuthSuccess
3073
+ * @param {string} CHARGE_AUTH_REJECT=chargeAuthReject
3074
+ * @param {string} ADDITIONAL_DATA_SUCCESS=additionalDataCollectSuccess
3075
+ * @param {string} ADDITIONAL_DATA_REJECT=additionalDataCollectReject
3076
+ * @param {string} CHARGE_AUTH=chargeAuth
2890
3077
  */
2891
- declare enum CheckoutActionCode {
2892
- /** Payment completed successfully. */
2893
- COMPLETE = "COMPLETE",
2894
- /** User cancelled the wallet sheet. */
2895
- CANCEL = "CANCEL",
2896
- /** An error occurred during payment authorization. */
2897
- ERROR = "ERROR",
2898
- /** User opted to switch to a different card in the wallet. */
2899
- CHANGE_CARD = "CHANGE_CARD",
2900
- /** User opted to add a new card to the wallet. */
2901
- ADD_CARD = "ADD_CARD",
2902
- /** User switched to a different consumer (Click to Pay flow). */
2903
- SWITCH_CONSUMER = "SWITCH_CONSUMER"
2904
- }
2905
3078
  /**
2906
- * Token response shape returned by Paydock after creating an OTT.
2907
- * Used by the SDK to decide whether a follow-up 3DS step is required.
3079
+ * List of available event's name for Standalone 3ds flow
3080
+ * @const STANDALONE_3DS_EVENT
3081
+ *
3082
+ * @type {object}
3083
+ * @param {string} AUTH_SUCCESS=chargeAuthSuccess
3084
+ * @param {string} AUTH_ERROR=chargeAuthReject
3085
+ * @param {string} DECOUPLED=chargeAuthDecoupled
3086
+ * @param {string} CHALLENGE=chargeAuthChallenge
3087
+ * @param {string} READY=chargeAuthReady - two-step mode only: fingerprint done, waiting for `authenticate()`
3088
+ * @param {string} CHALLENGE_LOADED=chargeAuthChallengeLoaded - challenge iframe painted (first `load`, or 2.5 s fallback); reveal your challenge UI here
3089
+ * @param {string} CHALLENGE_COMPLETED=chargeAuthChallengeCompleted - the shopper finished the challenge (issuer result delivered to the 3DS Server); cover the challenge iframe with your own loader until the terminal event
3090
+ * @param {string} INFO=chargeAuthInfo
3091
+ * @param {string} ERROR=error
2908
3092
  */
2909
- interface OTTResponse {
2910
- /** The OTT string. */
2911
- token: string;
2912
- /** Token type identifier (string form of {@link TOKEN_TYPE}). */
2913
- token_type: string;
2914
- /** When `true`, the integrator must invoke a Canvas3DS step before settling the charge. */
2915
- three_ds_required?: boolean;
2916
- /** Which wallet produced the token (Apple Pay or Google Pay). */
2917
- wallet_type: WalletType;
2918
- }
2919
3093
  /**
2920
- * Shipping address and contact information captured from the wallet payment sheet,
2921
- * when requested via `request_shipping` (and friends) on the wallet meta.
3094
+ * Class Canvas3ds include method for working on html
3095
+ * @constructor
3096
+ *
3097
+ * @param {string} selector - Selector of html element. Container for widget
3098
+ * @param {string} token - Pre authorized token
3099
+ * @example
3100
+ * var widget = new Canvas3ds('#widget', 'token');
3101
+ *
2922
3102
  *
2923
- * All fields are optional because each wallet provider returns a different subset.
2924
- * Address line fields are typically Apple Pay-only (Google Pay returns a coarser shape).
2925
3103
  */
2926
- interface Shipping {
2927
- /** Selected shipping method identifier (e.g. `'standard'`, `'express'`). */
2928
- method?: string;
2929
- /** Updated shipping options that were available when the user made their selection. */
2930
- options?: IShippingOption[];
2931
- /** First street address line (Apple Pay only). */
2932
- address_line1?: string;
2933
- /** Second street address line (Apple Pay only). */
2934
- address_line2?: string;
2935
- /** City. */
2936
- address_city?: string;
2937
- /** Postal/ZIP code. */
2938
- address_postcode?: string;
2939
- /** State or administrative area. */
2940
- address_state?: string;
2941
- /** ISO 3166-1 alpha-2 country code. */
2942
- address_country?: string;
2943
- /** Company name on the address (when the wallet captured it). */
2944
- address_company?: string;
2945
- /** Origin postal code — used for shipping calculations when the merchant ships from a fixed location. */
2946
- address_origin_postcode?: string;
2947
- /** Shipping contact information (Apple Pay only). */
2948
- contact?: {
2949
- /** Contact first name. */
2950
- first_name?: string;
2951
- /** Contact last name. */
2952
- last_name?: string;
2953
- /** Contact email address. */
2954
- email?: string;
2955
- /** Contact phone number. */
2956
- phone?: string;
2957
- /** Contact secondary phone number. */
2958
- phone2?: string;
3104
+ declare class Canvas3ds {
3105
+ protected link: Link;
3106
+ protected configs: Configuration[];
3107
+ protected publicKey: string;
3108
+ protected token: {
3109
+ content: string;
3110
+ format: TOKEN_FORMAT;
3111
+ charge_3ds_id: string;
3112
+ };
3113
+ protected standalone3dsService: Standalone3dsService;
3114
+ protected container: Container;
3115
+ protected iFrame: IFrame;
3116
+ protected event: IFrameEvent;
3117
+ protected eventEmitter: EventEmitter;
3118
+ /** @constructs */ constructor(selector: string, token: string);
3119
+ protected static extractToken(token: string): {
3120
+ content: string;
3121
+ format: TOKEN_FORMAT;
3122
+ charge_3ds_id: string;
2959
3123
  };
2960
- }
2961
-
2962
- declare class ApiPaymentSourceInternal {
2963
- protected api: ApiInternal;
2964
- constructor(api: ApiInternal);
2965
- createOTT(payload: CreateOTTRequest): Promise<CreateOTTResponse>;
2966
- createSession(payload: CreateSessionRequest): Promise<CreateSessionResponse>;
2967
- }
2968
-
2969
- declare class ApiInternal extends ApiBase {
2970
- charge(): ApiChargeInternal;
2971
- service(): ApiServiceInternal;
2972
- checkout(): ApiCheckoutInternal;
2973
- gateway(): ApiGatewayInternal;
2974
- paymentSource(): ApiPaymentSourceInternal;
2975
- }
2976
-
2977
- /**
2978
- * Public alias for GPAYMENTS_EVENT. Same object reference — no behavioral change.
2979
- * Prefer `CANVAS_3DS_EVENT` in public-facing code; `GPAYMENTS_EVENT` remains for
2980
- * backwards-compatible internal usage.
2981
- */
2982
- declare const CANVAS_3DS_EVENT: {
2983
- /** Authentication succeeded. Payload: `Canvas3dsAuthPayload`. */
2984
- readonly AUTH_SUCCESS: "chargeAuthSuccess";
2985
- /** Authentication failed — covers issuer rejection, iframe timeout (`AuthTimedOut`), and invalid-event outcomes. Payload: `Canvas3dsAuthPayload`. */
2986
- readonly AUTH_ERROR: "chargeAuthReject";
2987
- /** Decoupled authentication — issuer will authenticate out-of-band. Payload: `Canvas3dsAuthPayload`. */
2988
- readonly DECOUPLED: "chargeAuthDecoupled";
2989
- /** Challenge required — issuer demands user interaction. Payload: `Canvas3dsAuthPayload`. */
2990
- readonly CHALLENGE: "chargeAuthChallenge";
2991
3124
  /**
2992
- * The challenge iframe fired its FIRST `load` after `chargeAuthChallenge` (the ACS page has painted),
2993
- * or the `CHALLENGE_LOADED_FALLBACK_MS` safety fallback elapsed without one. Emitted exactly once per
2994
- * challenge; never emitted for a decoupled challenge (no challenge iframe). Payload: `Canvas3dsChallengeLoadedPayload`.
3125
+ * The final method to beginning, the load process of widget to html
3126
+ *
2995
3127
  */
2996
- readonly CHALLENGE_LOADED: "chargeAuthChallengeLoaded";
3128
+ load(): void;
2997
3129
  /**
2998
- * The issuer delivered the final authentication result to the 3DS Server (the shopper finished the
2999
- * challenge, or approved a decoupled authentication) and the SDK is now obtaining the outcome. Emitted at
3000
- * most once per authentication, always before the terminal event. Detected through the `secondary_url`
3001
- * result monitor (`source: 'poll'`) or, when the callback message arrives first, right before the outcome
3002
- * it carries (`source: 'callback'`). Payload: `Canvas3dsChallengeCompletedPayload`.
3130
+ * Current method can change environment. By default environment = sandbox.
3131
+ * Also we can change domain alias for this environment. By default domain_alias = paydock.com
3132
+ *
3133
+ * @example
3134
+ * widget.setEnv('production');
3135
+ * @param {string} env - sandbox, production
3136
+ * @param {string} [alias] - Own domain alias
3003
3137
  */
3004
- readonly CHALLENGE_COMPLETED: "chargeAuthChallengeCompleted";
3005
- /** Informational signal emitted by the GPayments flow. Internal — not part of the public typed surface. */
3006
- readonly INFO: "chargeAuthInfo";
3007
- /** Error during the flow (network, parsing, etc.). Payload: `Canvas3dsErrorPayload`. */
3008
- readonly ERROR: "error";
3009
- };
3138
+ setEnv(env: string, alias?: string): void;
3139
+ getEnv(): string;
3140
+ on<E extends keyof Canvas3dsEventMap>(eventName: E, cb: (data: Canvas3dsEventMap[E]) => void): void;
3141
+ on<E extends keyof Canvas3dsEventMap>(eventName: E): Promise<Canvas3dsEventMap[E]>;
3142
+ on(eventName: string, cb: (data: IEventData$1) => void): void;
3143
+ on(eventName: string): Promise<IEventData$1>;
3144
+ /**
3145
+ * Two-step mode only (`_3ds.authentication_flow: 'two_step'`): runs the authentication the API deferred after the
3146
+ * fingerprint. Call it when the shopper confirms (e.g. presses "Pay"); the outcome arrives through the
3147
+ * usual events (`chargeAuthChallenge`, `chargeAuthSuccess`, `chargeAuthReject`, `error`).
3148
+ *
3149
+ * Never throws. After `chargeAuthReady` the authentication starts at once; before it, the call is
3150
+ * remembered and runs as soon as the fingerprint completes. One-step charges, repeated calls and calls after
3151
+ * a terminal outcome are no-ops. For inbuilt 3DS (`html` / `url`) tokens it is a silent no-op: no event is
3152
+ * emitted at all, so do not wait for `error` there. Calling it before `load()` is an integration error: it emits `error` and
3153
+ * is not remembered. If `/process` could not be reached (`error` with `error_code` `service_unreachable` /
3154
+ * `aborted`), `authenticate()` may be called once more; any other `error`, and any failure of that retry,
3155
+ * is final.
3156
+ * No client-side deadline: a stale 3DS Server session surfaces as `error` / `chargeAuthReject`.
3157
+ *
3158
+ * @example
3159
+ * const widget = new Canvas3ds('#widget', token); // charge created with _3ds.authentication_flow: 'two_step'
3160
+ * widget.on('chargeAuthReady', () => payButton.disabled = false);
3161
+ * widget.on('chargeAuthChallenge', () => showChallengeModal());
3162
+ * widget.on('chargeAuthSuccess', (data) => completePayment(data.charge_3ds_id));
3163
+ * widget.on('chargeAuthReject', () => showDeclined());
3164
+ * widget.on('error', () => showError());
3165
+ * widget.load(); // fingerprint runs while the shopper reviews the order
3166
+ *
3167
+ * payButton.addEventListener('click', () => widget.authenticate());
3168
+ */
3169
+ authenticate(): void;
3170
+ /**
3171
+ * Using this method you can hide widget after load
3172
+ * @param {boolean} [saveSize=false] - using this param you can save iframe's size
3173
+ */
3174
+ hide(saveSize: boolean): void;
3175
+ /**
3176
+ * Using this method you can show widget after using hide method
3177
+ *
3178
+ */
3179
+ show(): void;
3180
+ /**
3181
+ * Using this method you can reload widget
3182
+ *
3183
+ */
3184
+ reload(): void;
3185
+ }
3010
3186
 
3011
3187
  /**
3012
3188
  * Payload emitted by `Checkout.onPaymentSuccessful`.
@@ -7557,4 +7733,4 @@ declare global {
7557
7733
  }
7558
7734
 
7559
7735
  export { AfterpayCheckoutButton, AfterpayOnSiteMessaging, Api, ApplePayOpenWalletButton, ApplePayWalletButtonExpress, CANVAS_3DS_EVENT, CARD_SCHEME, CHECKOUT_BUTTON_EVENT, EVENT$2 as CHECKOUT_EVENT, Canvas3ds, Canvas3dsTokenFormat, Checkout, CheckoutActionCode, ClickToPay, Configuration, ContactShippingEditingMode, ELEMENT, ERROR_OPERATION, EVENT$3 as EVENT, Builder$1 as ExternalCheckoutBuilder, Checker as ExternalCheckoutChecker, FORM_FIELD, FRAUD_PREVENTION_EVENTS, FraudPreventionService, GooglePayOpenWalletButton, HtmlMultiWidget, HtmlPaymentSourceWidget, HtmlWidget, InstructionDebugger, MultiWidget, OpenWalletButtons, PAYMENT_EXPIRED, PAYMENT_FAILURE, PAYMENT_SUCCESSFUL, PAYMENT_TYPE, PURPOSE, PayPalDataCollector, PayPalSavePaymentSourceWidget, Builder as PaymentSourceBuilder, PaymentSourceWidget, PaypalCheckoutButton, PaypalWalletButtonExpress, STYLABLE_ELEMENT, STYLABLE_ELEMENT_STATE, STYLE, SUPPORTED_CARD_TYPES, TEXT, TOKEN_TYPE, TRIGGER, TYPE, VAULT_DISPLAY_STYLE, VaultDisplayWidget, EVENT as WALLET_BUTTONS_EXPRESS_EVENT, WALLET_TYPES, WalletButtons, ZipmoneyCheckoutButton };
7560
- export type { ApplePayAvailabilityOptions, ApplePayAvailabilityResult, ApplePayButtonStyle, ApplePayButtonType, ApplePayCapabilityToken, ApplePayCredentialStatus, ApplePayOpenWalletMeta, ApplePayWalletMeta, AppleShippingType, BaseWalletMeta, Billing, Canvas3dsAuthPayload, Canvas3dsChallengeCompletedPayload, Canvas3dsChallengeLoadedPayload, Canvas3dsChargeAuthEventPayload, Canvas3dsErrorEventPayload, Canvas3dsErrorPayload, Canvas3dsEventMap, Canvas3dsEventName, CheckoutIntentTokenPayload, CheckoutPaymentExpiredPayload, CheckoutPaymentFailurePayload, CheckoutPaymentSuccessPayload, CheckoutResponse, CreateOTTData, CreateOTTRequest, CreateOTTResponse, CreateSessionRequest, CreateSessionResponse, EventTypes, FraudPreventionEvent, FraudPreventionEventType, FraudPreventionProvider, GooglePayAvailabilityOptions, GooglePayAvailabilityResult, GooglePayCardConfig, GooglePayOpenWalletMeta, GooglePayOpenWalletMetaStyles, HandleResponseInterface, IApplePayShippingOption, ICheckout, IClickToPayMeta, IDetails, IElementStyleInput, IEventAfterLoadData, IEventCheckoutFinishData, IEventData$1 as IEventData, IEventError, IEventFinishData, IEventMetaData, IEventSizeData, IFormValidation, IOpenWalletProvider, IPayPalMeta, IStyles$1 as IStyles, ITexts, ITokenStandalone3DS, IWalletMeta, IWalletOnClickEvent, IWalletPaymentSuccessfulEvent, IWalletUnavailableEvent, IWalletUpdateData, IWalletUpdateEvent, OTTResponse, OnCancelEventData, OnClickEventData$1 as OnClickEventData, OnCreateOTTErrorEventData, OnCreateOTTErrorPayload, OnCreateOTTSuccessPayload, OnCreateOTTSuccessfulEventData, OnErrorEventData$1 as OnErrorEventData, OnErrorPayload, OnLoadedEventData, OnUnavailableDetails, OnUnavailableEventData$1 as OnUnavailableEventData, OnUnavailablePayload, OpenWalletAvailabilityOptions, OpenWalletAvailabilityResult, OpenWalletBaseEvent, OpenWalletDataEvent, OpenWalletEventType, OpenWalletMeta, PaypalWalletMeta, ProcessAuthenticationResponse, Shipping, VaultDisplayStyle, OnClickEventData as WalletExpressOnClickEventData, OnCloseEventData as WalletExpressOnCloseEventData, OnErrorEventData as WalletExpressOnErrorEventData, OnPaymentErrorEventData as WalletExpressOnPaymentErrorEventData, OnPaymentInReviewEventData as WalletExpressOnPaymentInReviewEventData, OnPaymentSuccessfulEventData as WalletExpressOnPaymentSuccessfulEventData, OnShippingAddressChangeEventData as WalletExpressOnShippingAddressChangeEventData, OnShippingAddressChangeEventResponse as WalletExpressOnShippingAddressChangeEventResponse, OnShippingOptionChangeEventData as WalletExpressOnShippingOptionChangeEventData, OnShippingOptionChangeEventResponse as WalletExpressOnShippingOptionChangeEventResponse, OnUnavailableEventData as WalletExpressOnUnavailableEventData, WalletType, WidgetEventMap, WidgetEventName };
7736
+ export type { ApplePayAvailabilityOptions, ApplePayAvailabilityResult, ApplePayButtonStyle, ApplePayButtonType, ApplePayCapabilityToken, ApplePayCredentialStatus, ApplePayOpenWalletMeta, ApplePayWalletMeta, AppleShippingType, BaseWalletMeta, Billing, Canvas3dsAuthPayload, Canvas3dsChallengeCompletedPayload, Canvas3dsChallengeLoadedPayload, Canvas3dsChargeAuthEventPayload, Canvas3dsErrorEventPayload, Canvas3dsErrorPayload, Canvas3dsEventMap, Canvas3dsEventName, Canvas3dsReadyPayload, CheckoutIntentTokenPayload, CheckoutPaymentExpiredPayload, CheckoutPaymentFailurePayload, CheckoutPaymentSuccessPayload, CheckoutResponse, CreateOTTData, CreateOTTRequest, CreateOTTResponse, CreateSessionRequest, CreateSessionResponse, EventTypes, FraudPreventionEvent, FraudPreventionEventType, FraudPreventionProvider, GooglePayAvailabilityOptions, GooglePayAvailabilityResult, GooglePayCardConfig, GooglePayOpenWalletMeta, GooglePayOpenWalletMetaStyles, HandleResponseInterface, IApplePayShippingOption, ICheckout, IClickToPayMeta, IDetails, IElementStyleInput, IEventAfterLoadData, IEventCheckoutFinishData, IEventData$1 as IEventData, IEventError, IEventFinishData, IEventMetaData, IEventSizeData, IFormValidation, IOpenWalletProvider, IPayPalMeta, IStyles$1 as IStyles, ITexts, ITokenStandalone3DS, IWalletMeta, IWalletOnClickEvent, IWalletPaymentSuccessfulEvent, IWalletUnavailableEvent, IWalletUpdateData, IWalletUpdateEvent, OTTResponse, OnCancelEventData, OnClickEventData$1 as OnClickEventData, OnCreateOTTErrorEventData, OnCreateOTTErrorPayload, OnCreateOTTSuccessPayload, OnCreateOTTSuccessfulEventData, OnErrorEventData$1 as OnErrorEventData, OnErrorPayload, OnLoadedEventData, OnUnavailableDetails, OnUnavailableEventData$1 as OnUnavailableEventData, OnUnavailablePayload, OpenWalletAvailabilityOptions, OpenWalletAvailabilityResult, OpenWalletBaseEvent, OpenWalletDataEvent, OpenWalletEventType, OpenWalletMeta, PaypalWalletMeta, ProcessAuthenticationResponse, Shipping, VaultDisplayStyle, OnClickEventData as WalletExpressOnClickEventData, OnCloseEventData as WalletExpressOnCloseEventData, OnErrorEventData as WalletExpressOnErrorEventData, OnPaymentErrorEventData as WalletExpressOnPaymentErrorEventData, OnPaymentInReviewEventData as WalletExpressOnPaymentInReviewEventData, OnPaymentSuccessfulEventData as WalletExpressOnPaymentSuccessfulEventData, OnShippingAddressChangeEventData as WalletExpressOnShippingAddressChangeEventData, OnShippingAddressChangeEventResponse as WalletExpressOnShippingAddressChangeEventResponse, OnShippingOptionChangeEventData as WalletExpressOnShippingOptionChangeEventData, OnShippingOptionChangeEventResponse as WalletExpressOnShippingOptionChangeEventResponse, OnUnavailableEventData as WalletExpressOnUnavailableEventData, WalletType, WidgetEventMap, WidgetEventName };