@primer-io/primer-js 1.5.1 → 1.6.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.
@@ -1,172 +1,16 @@
1
1
  import { ContextProvider } from '@lit/context';
2
2
  import { Task, initialState } from '@lit/task';
3
+ import { PayPalButtonStyle } from '@paypal/paypal-js';
4
+ import { FUNDING_SOURCE } from '@paypal/paypal-js/types/components/funding-eligibility';
3
5
  import { CSSResult, LitElement, PropertyValues, ReactiveController, ReactiveControllerHost, SVGTemplateResult, TemplateResult, nothing } from 'lit';
4
6
 
5
- declare const PaymentInstrumentType: {
6
- readonly WORLDPAY_IDEAL: "WORLDPAY_IDEAL";
7
- readonly AUTOMATED_CLEARING_HOUSE: "AUTOMATED_CLEARING_HOUSE";
8
- readonly ADYEN_KLARNA: "ADYEN_KLARNA";
9
- readonly ADYEN_BANCONTACT_CARD: "ADYEN_BANCONTACT_CARD";
10
- readonly PAY_NL_KAARTDIRECT: "PAY_NL_KAARTDIRECT";
11
- readonly ADYEN_EPS: "ADYEN_EPS";
12
- readonly ADYEN_BANCONTACT_PAYCONIQ: "ADYEN_BANCONTACT_PAYCONIQ";
13
- readonly OMISE_PROMPTPAY: "OMISE_PROMPTPAY";
14
- readonly OMISE_TRUEMONEY: "OMISE_TRUEMONEY";
15
- readonly ADYEN_MULTIBANCO: "ADYEN_MULTIBANCO";
16
- readonly PACYPAY_WECHAT: "PACYPAY_WECHAT";
17
- readonly PACYPAY_ALIPAY: "PACYPAY_ALIPAY";
18
- readonly ADYEN_MBWAY: "ADYEN_MBWAY";
19
- readonly XENDIT_DANA: "XENDIT_DANA";
20
- readonly XENDIT_SHOPEEPAY: "XENDIT_SHOPEEPAY";
21
- readonly ADYEN_PAYSHOP: "ADYEN_PAYSHOP";
22
- readonly ADYEN_PAYTRAIL: "ADYEN_PAYTRAIL";
23
- readonly CLEARPAY: "CLEARPAY";
24
- readonly RAPYD_FAST: "RAPYD_FAST";
25
- readonly RAPYD_PROMPTPAY: "RAPYD_PROMPTPAY";
26
- readonly RAPYD_GCASH: "RAPYD_GCASH";
27
- readonly RAPYD_POLI: "RAPYD_POLI";
28
- readonly RAPYD_GRABPAY: "RAPYD_GRABPAY";
29
- readonly PRIMER_PAYPAL: "PRIMER_PAYPAL";
30
- readonly TWOC2P: "TWOC2P";
31
- readonly NETS: "NETS";
32
- readonly STRIPE_ACH: "STRIPE_ACH";
33
- readonly STRIPE_GIROPAY: "STRIPE_GIROPAY";
34
- readonly MOLLIE_GIROPAY: "MOLLIE_GIROPAY";
35
- readonly MOLLIE_EPS: "MOLLIE_EPS";
36
- readonly PAY_NL_EPS: "PAY_NL_EPS";
37
- readonly PAY_NL_P24: "PAY_NL_P24";
38
- readonly MOLLIE_P24: "MOLLIE_P24";
39
- readonly MOLLIE_SOFORT: "MOLLIE_SOFORT";
40
- readonly COINBASE: "COINBASE";
41
- readonly OPENNODE: "OPENNODE";
42
- readonly MOLLIE_GIFT_CARD: "MOLLIE_GIFTCARD";
43
- readonly XFERS_PAYNOW: "XFERS_PAYNOW";
44
- readonly CARD: "PAYMENT_CARD";
45
- readonly APPLE_PAY: "APPLE_PAY";
46
- readonly GOOGLE_PAY: "GOOGLE_PAY";
47
- readonly PAYPAL: "PAYPAL_ORDER";
48
- readonly PAYPAL_VAULTED: "PAYPAL_BILLING_AGREEMENT";
49
- readonly GO_CARDLESS: "GOCARDLESS";
50
- readonly PAY_NL_IDEAL: "PAY_NL_IDEAL";
51
- readonly PAY_NL_SOFORT_BANKING: "PAY_NL_SOFORT_BANKING";
52
- readonly PAY_NL_BANCONTACT: "PAY_NL_BANCONTACT";
53
- readonly PAY_NL_PAYPAL: "PAY_NL_PAYPAL";
54
- readonly PAY_NL_CREDIT_TRANSFER: "PAY_NL_CREDIT_TRANSFER";
55
- readonly PAY_NL_DIRECT_DEBIT: "PAY_NL_DIRECT_DEBIT";
56
- readonly PAY_NL_GIROPAY: "PAY_NL_GIROPAY";
57
- readonly PAY_NL_PAYCONIQ: "PAY_NL_PAYCONIQ";
58
- readonly PAY_NL_RIVERTY: "PAY_NL_RIVERTY";
59
- readonly HOOLAH: "HOOLAH";
60
- readonly ADYEN_BLIK: "ADYEN_BLIK";
61
- readonly ADYEN_VIPPS: "ADYEN_VIPPS";
62
- readonly ADYEN_GIROPAY: "ADYEN_GIROPAY";
63
- readonly ADYEN_SOFORT: "ADYEN_SOFORT";
64
- readonly ADYEN_IDEAL: "ADYEN_IDEAL";
65
- readonly ADYEN_TRUSTLY: "ADYEN_TRUSTLY";
66
- readonly ADYEN_ALIPAY: "ADYEN_ALIPAY";
67
- readonly ADYEN_TWINT: "ADYEN_TWINT";
68
- readonly ADYEN_MOBILEPAY: "ADYEN_MOBILEPAY";
69
- readonly MOLLIE_BANCONTACT: "MOLLIE_BANCONTACT";
70
- readonly MOLLIE_IDEAL: "MOLLIE_IDEAL";
71
- readonly BUCKAROO_GIROPAY: "BUCKAROO_GIROPAY";
72
- readonly BUCKAROO_EPS: "BUCKAROO_EPS";
73
- readonly BUCKAROO_SOFORT: "BUCKAROO_SOFORT";
74
- readonly BUCKAROO_BANCONTACT: "BUCKAROO_BANCONTACT";
75
- readonly BUCKAROO_IDEAL: "BUCKAROO_IDEAL";
76
- readonly ATOME: "ATOME";
77
- readonly KLARNA_CUSTOMER_TOKEN: "KLARNA_CUSTOMER_TOKEN";
78
- readonly DLOCAL_PIX: "DLOCAL_PIX";
79
- readonly ALMA: "ALMA";
80
- readonly ADYEN_CASHAPP: "ADYEN_CASHAPP";
81
- readonly ADYEN_AFFIRM: "ADYEN_AFFIRM";
82
- };
83
- export type PaymentInstrumentType = (typeof PaymentInstrumentType)[keyof typeof PaymentInstrumentType];
84
- declare const PaymentMethodType: {
85
- readonly WORLDPAY_IDEAL: "WORLDPAY_IDEAL";
86
- readonly STRIPE_ACH: "STRIPE_ACH";
87
- readonly STRIPE_IDEAL: "STRIPE_IDEAL";
88
- readonly ADYEN_KLARNA: "ADYEN_KLARNA";
89
- readonly ADYEN_BANCONTACT_CARD: "ADYEN_BANCONTACT_CARD";
90
- readonly PAY_NL_KAARTDIRECT: "PAY_NL_KAARTDIRECT";
91
- readonly ADYEN_EPS: "ADYEN_EPS";
92
- readonly ADYEN_BANCONTACT_PAYCONIQ: "ADYEN_BANCONTACT_PAYCONIQ";
93
- readonly OMISE_PROMPTPAY: "OMISE_PROMPTPAY";
94
- readonly OMISE_TRUEMONEY: "OMISE_TRUEMONEY";
95
- readonly ADYEN_MULTIBANCO: "ADYEN_MULTIBANCO";
96
- readonly PACYPAY_WECHAT: "PACYPAY_WECHAT";
97
- readonly PACYPAY_ALIPAY: "PACYPAY_ALIPAY";
98
- readonly ADYEN_MBWAY: "ADYEN_MBWAY";
99
- readonly XENDIT_DANA: "XENDIT_DANA";
100
- readonly XENDIT_SHOPEEPAY: "XENDIT_SHOPEEPAY";
101
- readonly ADYEN_PAYSHOP: "ADYEN_PAYSHOP";
102
- readonly ADYEN_PAYTRAIL: "ADYEN_PAYTRAIL";
103
- readonly CLEARPAY: "CLEARPAY";
104
- readonly RAPYD_FAST: "RAPYD_FAST";
105
- readonly RAPYD_PROMPTPAY: "RAPYD_PROMPTPAY";
106
- readonly RAPYD_GCASH: "RAPYD_GCASH";
107
- readonly RAPYD_POLI: "RAPYD_POLI";
108
- readonly RAPYD_GRABPAY: "RAPYD_GRABPAY";
109
- readonly PRIMER_PAYPAL: "PRIMER_PAYPAL";
110
- readonly TWOC2P: "TWOC2P";
111
- readonly NETS: "NETS";
112
- readonly STRIPE_GIROPAY: "STRIPE_GIROPAY";
113
- readonly MOLLIE_GIROPAY: "MOLLIE_GIROPAY";
114
- readonly MOLLIE_EPS: "MOLLIE_EPS";
115
- readonly PAY_NL_EPS: "PAY_NL_EPS";
116
- readonly PAY_NL_P24: "PAY_NL_P24";
117
- readonly MOLLIE_P24: "MOLLIE_P24";
118
- readonly MOLLIE_SOFORT: "MOLLIE_SOFORT";
119
- readonly COINBASE: "COINBASE";
120
- readonly OPENNODE: "OPENNODE";
121
- readonly MOLLIE_GIFT_CARD: "MOLLIE_GIFTCARD";
122
- readonly XFERS_PAYNOW: "XFERS_PAYNOW";
123
- readonly PAYMENT_CARD: "PAYMENT_CARD";
124
- readonly APPLE_PAY: "APPLE_PAY";
125
- readonly GOOGLE_PAY: "GOOGLE_PAY";
126
- readonly PAYPAL: "PAYPAL";
127
- readonly GO_CARDLESS: "GOCARDLESS";
128
- readonly KLARNA: "KLARNA";
129
- readonly PAY_NL_IDEAL: "PAY_NL_IDEAL";
130
- readonly PAY_NL_SOFORT_BANKING: "PAY_NL_SOFORT_BANKING";
131
- readonly PAY_NL_BANCONTACT: "PAY_NL_BANCONTACT";
132
- readonly PAY_NL_PAYPAL: "PAY_NL_PAYPAL";
133
- readonly PAY_NL_CREDIT_TRANSFER: "PAY_NL_CREDIT_TRANSFER";
134
- readonly PAY_NL_DIRECT_DEBIT: "PAY_NL_DIRECT_DEBIT";
135
- readonly PAY_NL_GIROPAY: "PAY_NL_GIROPAY";
136
- readonly PAY_NL_PAYCONIQ: "PAY_NL_PAYCONIQ";
137
- readonly PAY_NL_RIVERTY: "PAY_NL_RIVERTY";
138
- readonly HOOLAH: "HOOLAH";
139
- readonly ADYEN_BLIK: "ADYEN_BLIK";
140
- readonly ADYEN_MOBILEPAY: "ADYEN_MOBILEPAY";
141
- readonly ADYEN_VIPPS: "ADYEN_VIPPS";
142
- readonly ADYEN_GIROPAY: "ADYEN_GIROPAY";
143
- readonly ADYEN_SOFORT: "ADYEN_SOFORT";
144
- readonly ADYEN_IDEAL: "ADYEN_IDEAL";
145
- readonly ADYEN_TRUSTLY: "ADYEN_TRUSTLY";
146
- readonly ADYEN_ALIPAY: "ADYEN_ALIPAY";
147
- readonly ADYEN_TWINT: "ADYEN_TWINT";
148
- readonly ADYEN_BANK_TRANSFER: "ADYEN_BANK_TRANSFER";
149
- readonly MOLLIE_BANCONTACT: "MOLLIE_BANCONTACT";
150
- readonly MOLLIE_IDEAL: "MOLLIE_IDEAL";
151
- readonly BUCKAROO_GIROPAY: "BUCKAROO_GIROPAY";
152
- readonly BUCKAROO_EPS: "BUCKAROO_EPS";
153
- readonly BUCKAROO_SOFORT: "BUCKAROO_SOFORT";
154
- readonly BUCKAROO_BANCONTACT: "BUCKAROO_BANCONTACT";
155
- readonly BUCKAROO_IDEAL: "BUCKAROO_IDEAL";
156
- readonly ATOME: "ATOME";
157
- readonly DLOCAL_PIX: "DLOCAL_PIX";
158
- readonly ALMA: "ALMA";
159
- readonly ADYEN_CASHAPP: "ADYEN_CASHAPP";
160
- readonly ADYEN_AFFIRM: "ADYEN_AFFIRM";
161
- };
162
- export type PaymentMethodType = (typeof PaymentMethodType)[keyof typeof PaymentMethodType];
163
7
  declare global {
164
8
  interface Window {
165
9
  MSStream?: string;
166
10
  opera?: string;
167
11
  }
168
12
  }
169
- declare const PaymentMethodType$1 = {
13
+ declare const PaymentMethodType = {
170
14
  WORLDPAY_IDEAL: "WORLDPAY_IDEAL",
171
15
  STRIPE_ACH: "STRIPE_ACH",
172
16
  STRIPE_IDEAL: "STRIPE_IDEAL",
@@ -244,8 +88,8 @@ declare const PaymentMethodType$1 = {
244
88
  DLOCAL_PIX: "DLOCAL_PIX",
245
89
  ALMA: "ALMA",
246
90
  } as const;
247
- type PaymentMethodType$1 = (typeof PaymentMethodType$1)[keyof typeof PaymentMethodType$1];
248
- declare const PaymentInstrumentType$1 = {
91
+ export type PaymentMethodType = (typeof PaymentMethodType)[keyof typeof PaymentMethodType];
92
+ declare const PaymentInstrumentType = {
249
93
  WORLDPAY_IDEAL: "WORLDPAY_IDEAL",
250
94
  AUTOMATED_CLEARING_HOUSE: "AUTOMATED_CLEARING_HOUSE",
251
95
  ADYEN_KLARNA: "ADYEN_KLARNA",
@@ -323,7 +167,63 @@ declare const PaymentInstrumentType$1 = {
323
167
  ADYEN_CASHAPP: "ADYEN_CASHAPP",
324
168
  ADYEN_AFFIRM: "ADYEN_AFFIRM",
325
169
  } as const;
326
- type PaymentInstrumentType$1 = (typeof PaymentInstrumentType$1)[keyof typeof PaymentInstrumentType$1];
170
+ export type PaymentInstrumentType = (typeof PaymentInstrumentType)[keyof typeof PaymentInstrumentType];
171
+ export interface IconUrl {
172
+ colored: string;
173
+ dark: string;
174
+ light: string;
175
+ }
176
+ export interface ColorConfig {
177
+ colored: string;
178
+ dark: string;
179
+ light: string;
180
+ }
181
+ export interface PaymentMethodDisplayMetadata {
182
+ button: {
183
+ backgroundColor: ColorConfig;
184
+ borderColor: {
185
+ dark: string;
186
+ light: string;
187
+ };
188
+ borderWidth: ColorConfig;
189
+ cornerRadius: number;
190
+ iconPositionRelativeToText?: "START" | "END";
191
+ iconUrl: IconUrl;
192
+ text?: string;
193
+ textColor?: {
194
+ dark: string;
195
+ light: string;
196
+ };
197
+ };
198
+ overlay: {
199
+ logo: ColorConfig;
200
+ backgroundColor: ColorConfig;
201
+ };
202
+ popup: {
203
+ width: number;
204
+ height: number;
205
+ };
206
+ }
207
+ export interface CardFormConfig {
208
+ visible?: boolean;
209
+ required?: boolean;
210
+ }
211
+ /**
212
+ * Capability flags returned by the server on a payment method config.
213
+ * - `BACKEND_DRIVEN` — flow is driven by server-sent instructions (step tree schema);
214
+ * the SDK must use the BDC orchestrator instead of the standard tokenise path.
215
+ */
216
+ export type PaymentMethodCapability = "BACKEND_DRIVEN" | (string & {});
217
+ export interface PaymentMethodOptions {
218
+ captureVaultedCardCvv?: boolean;
219
+ clientId?: string;
220
+ merchantAccountId?: string;
221
+ threeDSecureToken?: string;
222
+ threeDSecureInitUrl?: string;
223
+ threeDSecureProvider?: string;
224
+ threeDSecureEnabled?: boolean;
225
+ cardholderName?: CardFormConfig;
226
+ }
327
227
  /**
328
228
  * Google Pay shipping address parameters.
329
229
  * @see https://developers.google.com/pay/api/web/reference/request-objects#ShippingAddressParameters
@@ -440,6 +340,149 @@ export interface GooglePayClientOptions {
440
340
  */
441
341
  buttonBorderType?: GooglePayButtonBorderType;
442
342
  }
343
+ export interface PaymentMethodConfig<T extends PaymentMethodOptions = PaymentMethodOptions> {
344
+ id: string;
345
+ type: PaymentMethodType;
346
+ name: string;
347
+ implementationType: "WEB_REDIRECT" | "NATIVE_SDK" | "BACKEND_DRIVEN";
348
+ displayMetadata: PaymentMethodDisplayMetadata;
349
+ options: T;
350
+ forceRedirect?: boolean;
351
+ capabilities?: PaymentMethodCapability[];
352
+ }
353
+ /**
354
+ * Billing address module configuration options
355
+ * Controls which fields are visible and required in the billing address form
356
+ */
357
+ export interface BillingAddressModuleOptions {
358
+ firstName?: boolean;
359
+ lastName?: boolean;
360
+ addressLine1?: boolean;
361
+ addressLine2?: boolean;
362
+ city?: boolean;
363
+ postalCode?: boolean;
364
+ state?: boolean;
365
+ countryCode?: boolean;
366
+ }
367
+ /**
368
+ * Billing address checkout module
369
+ */
370
+ export interface BillingAddressCheckoutModule {
371
+ type: "BILLING_ADDRESS";
372
+ options: BillingAddressModuleOptions;
373
+ }
374
+ /**
375
+ * Shipping method for express checkout flows (Google Pay, Apple Pay).
376
+ */
377
+ export interface ShippingMethod {
378
+ /** Unique identifier for the shipping method */
379
+ id: string;
380
+ /** Display name for the shipping method */
381
+ name: string;
382
+ /** Description (e.g., "5-7 business days") */
383
+ description: string;
384
+ /** Shipping cost in minor units */
385
+ amount: number;
386
+ /** Type of shipping method */
387
+ type?: "shipping" | "pickup";
388
+ }
389
+ /**
390
+ * Shipping checkout module options
391
+ */
392
+ export interface ShippingModuleOptions {
393
+ /** Available shipping methods */
394
+ shippingMethods: ShippingMethod[];
395
+ /** Currently selected shipping method ID */
396
+ selectedShippingMethod?: string;
397
+ }
398
+ /**
399
+ * Shipping checkout module
400
+ */
401
+ export interface ShippingCheckoutModule {
402
+ type: "SHIPPING";
403
+ options: ShippingModuleOptions;
404
+ }
405
+ /**
406
+ * Checkout module configuration
407
+ * Supports billing address and shipping modules
408
+ */
409
+ export type CheckoutModuleConfig = BillingAddressCheckoutModule | ShippingCheckoutModule;
410
+ export type ApprovalMode = "AUTO" | "MANUAL";
411
+ export interface ClientSession {
412
+ clientSessionId: string;
413
+ /**
414
+ * Whether the session approves payments automatically (AUTO, default) or
415
+ * requires explicit merchant approval per attempt (MANUAL). Set at creation.
416
+ */
417
+ approvalMode?: ApprovalMode;
418
+ /**
419
+ * The active payment attempt for a MANUAL session, if any. Used to resolve
420
+ * manual-flow recovery without a separate `GET /client-session` call on startup.
421
+ */
422
+ currentAttempt?: CurrentAttempt;
423
+ customer?: {
424
+ customerId?: string;
425
+ emailAddress?: string;
426
+ mobileNumber?: string;
427
+ firstName?: string;
428
+ lastName?: string;
429
+ billingAddress?: ClientSessionAddress;
430
+ shippingAddress?: ClientSessionAddress;
431
+ taxId?: string;
432
+ };
433
+ paymentMethod: {
434
+ options?: Array<{
435
+ type: string;
436
+ surcharge?: number;
437
+ networks?: Array<{
438
+ type: string;
439
+ surcharge?: number;
440
+ }>;
441
+ }>;
442
+ orderedAllowedCardNetworks: string[];
443
+ vaultOnSuccess: boolean;
444
+ };
445
+ order: {
446
+ countryCode?: string;
447
+ currencyCode?: string;
448
+ fees?: Array<{
449
+ type?: string;
450
+ description?: string;
451
+ amount: number;
452
+ }>;
453
+ lineItems?: Array<{
454
+ amount: number;
455
+ description: string;
456
+ discountAmount?: number;
457
+ itemId: string;
458
+ name?: string;
459
+ productType?: "DIGITAL" | "PHYSICAL" | "SHIPPING_FEE";
460
+ quantity: number;
461
+ taxAmount?: number;
462
+ taxCode?: string;
463
+ }>;
464
+ merchantAmount?: number;
465
+ orderId?: string;
466
+ shipping?: {
467
+ amount: number;
468
+ methodId?: string;
469
+ methodName?: string;
470
+ methodDescription?: string;
471
+ };
472
+ totalOrderAmount: number;
473
+ };
474
+ }
475
+ export interface ClientConfiguration {
476
+ binDataUrl: string;
477
+ checkoutModules?: CheckoutModuleConfig[];
478
+ clientSession: ClientSession;
479
+ coreUrl: string;
480
+ env: string;
481
+ paymentMethods: PaymentMethodConfig<any>[];
482
+ pciUrl: string;
483
+ primerAccountId: string;
484
+ settleOnAuth?: boolean;
485
+ }
443
486
  export interface ThreeDSAuthenticationData {
444
487
  responseCode: "AUTH_SUCCESS" | "AUTH_FAILED" | "SKIPPED" | "CHALLENGE";
445
488
  reasonCode?: string;
@@ -447,7 +490,7 @@ export interface ThreeDSAuthenticationData {
447
490
  protocolVersion: string;
448
491
  challengeIssued: boolean;
449
492
  }
450
- export interface IPaymentMethodToken<T, U extends PaymentInstrumentType$1 = PaymentInstrumentType$1> {
493
+ export interface IPaymentMethodToken<T, U extends PaymentInstrumentType = PaymentInstrumentType> {
451
494
  token: string;
452
495
  analyticsId: string;
453
496
  tokenType: "SINGLE_USE" | "MULTI_USE";
@@ -462,7 +505,7 @@ export type PaymentCardToken = IPaymentMethodToken<{
462
505
  last4Digits: string;
463
506
  cardholderName: string;
464
507
  network: string;
465
- }, typeof PaymentInstrumentType$1.CARD>;
508
+ }, typeof PaymentInstrumentType.CARD>;
466
509
  export interface UnmanagedPaymentToken {
467
510
  token: string;
468
511
  analyticsId: string;
@@ -475,467 +518,314 @@ export interface UnmanagedPaymentToken {
475
518
  threeDSecureAuthentication: null;
476
519
  }
477
520
  export type PaymentMethodToken = PaymentCardToken | UnmanagedPaymentToken;
478
- /**
479
- * Minimal payment summary with reduced PII exposure.
480
- * Used in events for public data delivery.
481
- */
482
- export interface PaymentSummary {
483
- /** Payment ID from Primer API */
484
- id: string;
485
- /** Order ID/reference from merchant */
486
- orderId: string;
487
- /** Payment method data with whitelisted fields */
488
- paymentMethodData?: {
489
- /** Payment method type (e.g., "PAYMENT_CARD", "PAYPAL") */
490
- paymentMethodType?: string;
491
- /** Last 4 digits of card (cards only) */
492
- last4Digits?: string;
493
- /** Card network (e.g., "VISA", "MASTERCARD") - cards only */
494
- network?: string;
495
- /** Last 4 digits of account number (ACH only) */
496
- accountNumberLastFourDigits?: string;
497
- /** Bank name (ACH only) */
498
- bankName?: string;
499
- };
521
+ export interface ClientSessionAddress {
522
+ firstName?: string;
523
+ lastName?: string;
524
+ addressLine1?: string;
525
+ addressLine2?: string;
526
+ city?: string;
527
+ state?: string;
528
+ postalCode?: string;
529
+ countryCode?: string;
500
530
  }
501
- /**
502
- * Base interface for common vaulted payment method fields.
503
- * All payment-method-specific interfaces extend this base.
504
- */
505
- export interface BaseVaultedPaymentMethodSummary {
506
- /** Payment instrument ID */
507
- id: string;
508
- /** Analytics tracking ID */
509
- analyticsId: string;
510
- /** Payment method type (e.g., "PAYMENT_CARD", "PAYPAL") */
511
- paymentMethodType: PaymentMethodType$1;
512
- /** Optional user-provided description for the payment method */
513
- userDescription?: string;
531
+ export type NullableAddress = {
532
+ [K in keyof ClientSessionAddress]?: ClientSessionAddress[K] | null;
533
+ };
534
+ export interface PaymentRenderButtonOptions {
535
+ style?: {
536
+ buttonHeight?: number;
537
+ shadowRoot?: ShadowRoot | null;
538
+ };
514
539
  }
515
- /**
516
- * Vaulted payment card summary with card-specific fields.
517
- */
518
- export interface CardVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
519
- /** Discriminant for card payment instruments */
520
- paymentInstrumentType: "PAYMENT_CARD";
521
- /** Card-specific payment instrument data */
522
- paymentInstrumentData?: {
523
- /** Last 4 digits of card */
524
- last4Digits?: string;
525
- /** Card network (e.g., "VISA", "MASTERCARD") */
526
- network?: string;
527
- /** Cardholder name */
528
- cardholderName?: string;
529
- /** Expiration month (1-12) */
530
- expirationMonth?: string;
531
- /** Expiration year (e.g., "2025") */
532
- expirationYear?: string;
540
+ export interface BaseInputStyle {
541
+ background?: string;
542
+ borderColor?: number | string;
543
+ borderRadius?: number | string;
544
+ borderStyle?: string;
545
+ borderWidth?: number | string;
546
+ boxShadow?: string;
547
+ color?: string;
548
+ fontFamily?: string;
549
+ fontSize?: string;
550
+ fontSmoothing?: string;
551
+ fontWeight?: string;
552
+ height?: number | string;
553
+ letterSpacing?: string;
554
+ lineHeight?: string;
555
+ paddingHorizontal?: number;
556
+ textTransform?: string;
557
+ }
558
+ export interface InputStyle extends BaseInputStyle {
559
+ focus?: BaseInputStyle;
560
+ hover?: BaseInputStyle;
561
+ placeholder?: BaseInputStyle;
562
+ selection?: BaseInputStyle;
563
+ webkitAutofill?: BaseInputStyle;
564
+ }
565
+ export interface HostedInputOptions {
566
+ placeholder?: string;
567
+ ariaLabel?: string;
568
+ style?: {
569
+ input?: {
570
+ base?: InputStyle;
571
+ error?: InputStyle;
572
+ };
573
+ };
574
+ orderedAllowedCardNetworks?: string[];
575
+ cardholderName?: {
576
+ visible?: boolean;
577
+ required?: boolean;
533
578
  };
534
579
  }
535
580
  /**
536
- * Vaulted PayPal billing agreement summary with PayPal-specific fields.
581
+ * Per-funding-source style overrides for PayPal buttons.
582
+ * Keys are funding source names (e.g., 'card', 'paylater'), values are style overrides.
537
583
  */
538
- export interface PayPalVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
539
- /** Discriminant for PayPal billing agreement instruments */
540
- paymentInstrumentType: "PAYPAL_BILLING_AGREEMENT";
541
- /** PayPal-specific payment instrument data */
542
- paymentInstrumentData?: {
543
- /** External PayPal payer ID */
544
- externalPayerId?: string;
545
- /** PayPal account email */
546
- email?: string;
547
- /** First name */
548
- firstName?: string;
549
- /** Last name */
550
- lastName?: string;
551
- };
552
- }
584
+ export type PayPalStyleOverrides = Partial<Record<FUNDING_SOURCE, PayPalButtonStyle>>;
553
585
  /**
554
- * Vaulted Klarna customer token summary with Klarna-specific fields.
586
+ * Unified PayPal button style configuration.
587
+ * Base style properties (color, shape, etc.) apply to all buttons.
588
+ * Funding source keys (paypal, paylater, card, etc.) contain per-button overrides.
589
+ *
590
+ * @example
591
+ * {
592
+ * color: 'blue', // Base style for all buttons
593
+ * shape: 'rect',
594
+ * paylater: { // Override for Pay Later button
595
+ * color: 'white'
596
+ * },
597
+ * card: { // Override for Card button
598
+ * color: 'black'
599
+ * }
600
+ * }
555
601
  */
556
- export interface KlarnaVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
557
- /** Discriminant for Klarna customer token instruments */
558
- paymentInstrumentType: "KLARNA_CUSTOMER_TOKEN";
559
- /** Klarna-specific payment instrument data */
560
- paymentInstrumentData?: {
561
- /** Klarna account email */
562
- email?: string;
563
- /** First name */
564
- firstName?: string;
565
- /** Last name */
566
- lastName?: string;
567
- /** Phone number */
568
- phoneNumber?: string;
569
- };
570
- }
602
+ export type PayPalStyleWithOverrides = PayPalButtonStyle & PayPalStyleOverrides;
571
603
  /**
572
- * Vaulted ACH (Automated Clearing House) summary with ACH-specific fields.
604
+ * Local type definitions to prevent sdk-utils from leaking through public API.
605
+ * These types mirror sdk-utils but are defined locally to avoid dts-bundle-generator
606
+ * traversing into sdk-utils source files during TypeScript definition bundling.
573
607
  */
574
- export interface ACHVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
575
- /** Discriminant for ACH instruments */
576
- paymentInstrumentType: "AUTOMATED_CLEARING_HOUSE";
577
- /** ACH-specific payment instrument data */
578
- paymentInstrumentData?: {
579
- /** Last 4 digits of account number */
580
- accountNumberLastFourDigits?: string;
581
- /** Bank name */
582
- bankName?: string;
583
- /** Account type (e.g., "CHECKING", "SAVINGS") */
584
- accountType?: string;
585
- };
586
- }
587
608
  /**
588
- * Generic vaulted payment method summary for payment instruments
589
- * not explicitly modeled with their own interface.
609
+ * Function type for translating keys to localized strings.
610
+ * Defined locally to avoid dts-bundle-generator traversing into checkoutContext.
590
611
  */
591
- export interface GenericVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
592
- /** Discriminant for all other payment instrument types */
593
- paymentInstrumentType: Exclude<PaymentInstrumentType$1, "PAYMENT_CARD" | "PAYPAL_BILLING_AGREEMENT" | "KLARNA_CUSTOMER_TOKEN" | "AUTOMATED_CLEARING_HOUSE">;
594
- /** Generic payment instrument data for unknown/other payment methods */
595
- paymentInstrumentData?: Record<string, unknown>;
596
- }
612
+ export type TranslateFunction = (key: string, fallback: string) => string;
597
613
  /**
598
- * Discriminated union of all vaulted payment method summaries.
599
- * Use the paymentInstrumentType field to narrow to specific types.
614
+ * Analytics environment type (mirrors @primer-io/sdk-utils/analytics)
600
615
  */
601
- export type VaultedPaymentMethodSummary = CardVaultedPaymentMethodSummary | PayPalVaultedPaymentMethodSummary | KlarnaVaultedPaymentMethodSummary | ACHVaultedPaymentMethodSummary | GenericVaultedPaymentMethodSummary;
616
+ export type AnalyticsEnvironment = "LOCAL" | "DEV" | "STAGING" | "SANDBOX" | "PRODUCTION";
602
617
  /**
603
- * Data surfaced to the merchant when a MANUAL-approval `:pay` creates an
604
- * attempt awaiting approval. The merchant sends clientSessionId +
605
- * paymentAttemptId to its backend (which calls /approve or /abort), then calls
606
- * continueFlow() to resume the SDK.
618
+ * SDK Error class interface (mirrors @primer-io/sdk-utils/errors/errors)
619
+ * Base class for all SDK errors with error code and nested error.
607
620
  */
608
- export interface PaymentApprovalRequiredData {
609
- clientSessionId: string;
610
- paymentAttemptId: string;
611
- paymentMethodToken: PaymentMethodToken;
612
- continueFlow: () => Promise<void>;
621
+ export interface SdkError extends Error {
622
+ readonly code: string;
623
+ readonly error?: unknown;
613
624
  }
614
- export type APIVersionOption = "legacy" | "2.4";
615
625
  declare enum HeadlessManagerType {
626
+ BLIK = "BLIK",
616
627
  CARD = "CARD",
617
628
  NATIVE = "NATIVE",
618
629
  REDIRECT = "REDIRECT",
619
630
  KLARNA = "KLARNA",
620
631
  ADYEN_KLARNA = "ADYEN_KLARNA",
621
632
  ACH = "ACH",
622
- BLIK = "BLIK",
623
- MBWAY = "MBWAY"
633
+ MBWAY = "MBWAY",
634
+ QRCODE = "QRCODE"
624
635
  }
636
+ export type PaymentMethodInfo = {
637
+ type: PaymentMethodType;
638
+ managerType: HeadlessManagerType;
639
+ };
625
640
  declare enum EventTypes {
626
641
  CHANGE = "change",
642
+ ENTER = "ENTER",
627
643
  ERROR = "error",
628
644
  FOCUS = "focus",
629
645
  BLUR = "blur",
630
646
  CLICK = "click",
631
647
  CLOSE = "close",
632
- ENTER = "enter",
648
+ INPUT = "input",
633
649
  CONFIRMED_KLARNA_CATEGORY = "CONFIRMED_KLARNA_CATEGORY",
634
650
  CONFIRMED_KLARNA_CATEGORY_ERROR = "CONFIRMED_KLARNA_CATEGORY_ERROR",
635
651
  KLARNA_SESSION_UPDATE = "KLARNA_SESSION_UPDATE",
636
652
  KLARNA_SESSION_REFRESH_ERROR = "KLARNA_SESSION_REFRESH_ERROR"
637
653
  }
638
- export interface BasePaymentInstrumentData {
639
- [key: string]: unknown;
640
- }
641
- export interface ClientSessionLineItem {
642
- amount: number;
643
- description: string;
644
- discountAmount?: number;
645
- itemId: string;
646
- name?: string;
647
- productType?: "DIGITAL" | "PHYSICAL" | "SHIPPING_FEE";
648
- quantity: number;
649
- taxAmount?: number;
650
- taxCode?: string;
651
- }
652
- export interface ClientSessionShipping {
653
- amount: number;
654
- methodId?: string;
655
- methodName?: string;
656
- methodDescription?: string;
657
- }
658
- export interface ClientSessionFeeItem {
659
- type?: string;
660
- description?: string;
661
- amount: number;
654
+ type EventListener$1 = (event?: Event) => void;
655
+ export interface PayPalOptionsWithPaypalJsTypes {
656
+ /**
657
+ * Button style configuration with optional per-funding-source overrides.
658
+ * Root-level properties (color, shape, etc.) are base styles for all buttons.
659
+ * Funding source keys (paypal, paylater, card) contain per-button overrides.
660
+ *
661
+ * @example
662
+ * {
663
+ * color: 'blue', // Base style for all buttons
664
+ * shape: 'rect',
665
+ * card: { color: 'black' } // Card button requires black or white
666
+ * }
667
+ */
668
+ style?: PayPalStyleWithOverrides;
669
+ vault?: boolean;
670
+ paymentFlow?: string;
671
+ buyerCountry?: string;
672
+ disableFunding?: FUNDING_SOURCE[];
673
+ enableFunding?: FUNDING_SOURCE[];
674
+ integrationDate?: string;
675
+ debug?: boolean;
662
676
  }
663
- export interface ClientSessionAddress {
664
- firstName?: string;
665
- lastName?: string;
666
- addressLine1?: string;
667
- addressLine2?: string;
668
- city?: string;
669
- state?: string;
670
- countryCode?: string;
671
- postalCode?: string;
677
+ export interface LegacyApplePayOptions {
678
+ /**
679
+ * @deprecated Use buttonOptions.type instead
680
+ */
681
+ buttonType?: "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
682
+ /**
683
+ * @deprecated Use buttonOptions.buttonstyle instead
684
+ */
685
+ buttonStyle?: "black" | "white" | "white-outline";
672
686
  }
673
- export type NullableAddress = {
674
- [K in keyof ClientSessionAddress]?: ClientSessionAddress[K] | null;
675
- };
676
- export interface ClientSession {
677
- orderId?: string;
678
- currencyCode?: string;
679
- lineItems?: ClientSessionLineItem[];
680
- totalAmount?: number;
681
- customerId?: string;
682
- orderDetails?: {
683
- countryCode?: string;
684
- shipping?: ClientSessionShipping;
685
- fees?: ClientSessionFeeItem[];
686
- };
687
- customer?: {
688
- emailAddress?: string;
689
- mobileNumber?: string;
690
- firstName?: string;
691
- lastName?: string;
692
- billingAddress?: ClientSessionAddress;
693
- shippingAddress?: ClientSessionAddress;
694
- taxId?: string;
695
- nationalDocumentId?: string;
687
+ export interface ApplePayClientOptions {
688
+ /**
689
+ * Button configuration options
690
+ */
691
+ buttonOptions?: {
692
+ /**
693
+ * The kind of Apple Pay button, such as a button for purchasing a subscription.
694
+ * @default "plain"
695
+ * @see https://developer.apple.com/documentation/applepayontheweb/applepaybuttontype
696
+ */
697
+ type?: "add-money" | "book" | "buy" | "check-out" | "continue" | "contribute" | "donate" | "order" | "pay" | "plain" | "reload" | "rent" | "set-up" | "subscribe" | "support" | "tip" | "top-up";
698
+ /**
699
+ * The appearance of the Apple Pay button, such as a black button with white lettering.
700
+ * @see https://developer.apple.com/documentation/applepayontheweb/applepaybuttonstyle
701
+ */
702
+ buttonStyle?: "black" | "white" | "white-outline";
696
703
  };
697
- paymentMethod?: {
698
- options?: Record<string, unknown>;
699
- orderedAllowedCardNetworks?: string[];
700
- vaultOnSuccess?: boolean;
704
+ /**
705
+ * Billing contact configuration options
706
+ */
707
+ billingOptions?: {
708
+ /**
709
+ * The fields of billing information the user must provide to process the transaction.
710
+ * @see https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest/requiredbillingcontactfields
711
+ */
712
+ requiredBillingContactFields?: "postalAddress"[];
701
713
  };
702
- }
703
- export interface BackgroundColor {
704
- colored: string;
705
- dark: string;
706
- light: string;
707
- }
708
- export interface IconUrl {
709
- colored: string;
710
- dark: string;
711
- light: string;
712
- }
713
- export interface InputStyles {
714
- base?: {
715
- color?: string;
716
- fontFamily?: string;
717
- fontSize?: string;
718
- fontWeight?: string;
719
- lineHeight?: string;
720
- letterSpacing?: string;
721
- textTransform?: string;
722
- background?: string;
723
- borderRadius?: number | string;
724
- borderColor?: string | number;
725
- borderWidth?: string | number;
726
- borderStyle?: string;
727
- boxShadow?: string;
728
- height?: number | string;
729
- paddingHorizontal?: number;
730
- hover?: Record<string, unknown>;
731
- focus?: Record<string, unknown>;
732
- placeholder?: Record<string, unknown>;
733
- webkitAutofill?: Record<string, unknown>;
734
- selection?: Record<string, unknown>;
714
+ /**
715
+ * Shipping contact configuration options
716
+ */
717
+ shippingOptions?: {
718
+ /**
719
+ * The fields of shipping information the user must provide to process the transaction.
720
+ * @see https://developer.apple.com/documentation/applepayontheweb/applepaypaymentrequest/requiredshippingcontactfields
721
+ */
722
+ requiredShippingContactFields?: ("postalAddress" | "name" | "phoneticName" | "phone" | "email")[];
723
+ requireShippingMethod?: boolean;
735
724
  };
736
- error?: Record<string, unknown>;
737
725
  }
738
- export interface InputValidationError {
739
- field?: string;
740
- name: string;
741
- error: string;
742
- message: string;
743
- }
744
- export interface Validation {
745
- valid: boolean;
746
- validationErrors: InputValidationError[];
747
- error?: string;
748
- }
749
- export interface InputMetadata {
750
- errorCode: string | null;
751
- error: string | null;
752
- valid: boolean;
753
- active: boolean;
754
- dirty: boolean;
755
- touched: boolean;
756
- submitted: boolean;
757
- }
758
- export interface PaymentMethodConfig<T = Record<string, unknown>> {
726
+ export interface Payment {
759
727
  id: string;
760
- type: PaymentMethodType;
761
- name: string;
762
- implementationType: "WEB_REDIRECT" | "NATIVE_SDK" | "BACKEND_DRIVEN";
763
- displayMetadata: {
764
- button: {
765
- backgroundColor: BackgroundColor;
766
- borderColor: {
767
- dark: string;
768
- light: string;
769
- };
770
- borderWidth: {
771
- colored: number | string;
772
- dark: number | string;
773
- light: number | string;
774
- };
775
- cornerRadius: number;
776
- iconPositionRelativeToText?: "START" | "END";
777
- iconUrl: IconUrl;
778
- text?: string;
779
- textColor?: {
780
- dark: string;
781
- light: string;
782
- };
783
- };
784
- overlay: {
785
- logo: IconUrl;
786
- backgroundColor: BackgroundColor;
787
- };
788
- popup: {
789
- width: number;
790
- height: number;
791
- };
792
- };
793
- options: T extends Record<string, unknown> ? T : {
794
- captureVaultedCardCvv?: boolean;
795
- clientId?: string;
796
- threeDSecureToken?: string;
797
- threeDSecureInitUrl?: string;
798
- threeDSecureProvider?: string;
799
- threeDSecureEnabled?: boolean;
800
- cardholderName?: {
801
- visible?: boolean;
802
- required?: boolean;
803
- };
728
+ orderId: string;
729
+ paymentMethodData?: {
730
+ paymentMethodType: PaymentMethodType;
731
+ [key: string]: unknown;
804
732
  };
805
- forceRedirect?: boolean;
806
- }
807
- export interface PaymentMethodInfo {
808
- type: PaymentMethodType;
809
- managerType: HeadlessManagerType;
810
733
  }
811
- export type CardNetworkType = "american-express" | "diners-club" | "discover" | "elo" | "hiper" | "hipercard" | "interac" | "jcb" | "maestro" | "mastercard" | "mir" | "unionpay" | "private-label" | "visa";
812
- export interface CardNetworkDetails {
813
- displayName: string;
814
- network: string;
815
- allowed: boolean;
734
+ export interface HeadlessHostedInputOptions {
735
+ placeholder?: string;
736
+ ariaLabel?: string;
737
+ style?: Record<string, unknown>;
816
738
  }
817
- export interface CardNetworkChangeEvent {
818
- detectedCardNetworks: {
819
- items: CardNetworkDetails[];
820
- preferred?: CardNetworkDetails;
821
- };
822
- selectableCardNetworks?: {
823
- items: CardNetworkDetails[];
824
- preferred?: CardNetworkDetails;
825
- };
826
- source: "REMOTE" | "LOCAL" | "LOCAL_FALLBACK";
739
+ export interface CardPaymentMethodSubmitValues {
740
+ cardNetwork?: string;
827
741
  }
828
- export interface BinDataDetails extends CardNetworkDetails {
829
- issuerCountryCode?: string;
830
- issuerName?: string;
831
- accountFundingType?: string;
832
- prepaidReloadableIndicator?: string;
833
- productUsageType?: string;
834
- productCode?: string;
835
- productName?: string;
836
- issuerCurrencyCode?: string;
837
- regionalRestriction?: string;
838
- accountNumberType?: string;
742
+ export interface CardPaymentMethodManagerOptions {
743
+ onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
744
+ onBinDataLoadingChange?: (loading: boolean) => void;
745
+ onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
746
+ onCardNetworksLoading?: () => void;
839
747
  }
840
- export interface BinDataAvailableEvent {
841
- preferred?: BinDataDetails;
842
- alternatives: BinDataDetails[];
843
- status: "complete" | "partial";
844
- firstDigits?: string;
748
+ export interface KlarnaPaymentMethodManagerOptions {
749
+ onPaymentMethodCategoriesChange?: (categories: {
750
+ id: string;
751
+ name: string;
752
+ descriptiveAssetUrl: string;
753
+ standardAssetUrl: string;
754
+ }[]) => void;
755
+ onPaymentMethodAction?: (action: string, data: {
756
+ paymentMethodType: string;
757
+ category: string;
758
+ }) => void;
845
759
  }
846
- export interface CardPaymentMethodSubmitValues {
847
- cardNetwork?: string;
760
+ export interface KlarnaPaymentMethodManager {
761
+ renderCategory: (params: {
762
+ containerId: string | HTMLElement;
763
+ paymentMethodCategoryId: string;
764
+ onHeightChange?: (height: number) => void;
765
+ }) => Promise<void>;
766
+ start: (params: {
767
+ paymentMethodCategoryId: string;
768
+ }) => Promise<void>;
848
769
  }
849
- export type CardPreferredFlow = "DEDICATED_SCENE" | "EMBEDDED_IN_HOME";
850
- export interface PaymentCardInstrumentData extends BasePaymentInstrumentData {
851
- last4Digits: string;
852
- first6Digits: string;
853
- expirationMonth: string;
854
- expirationYear: string;
855
- cardholderName: string;
856
- network: string;
857
- isNetworkTokenized: boolean;
858
- binData?: {
859
- network: string;
860
- issuerCountryCode: string;
861
- issuerName: string;
862
- issuerCurrencyCode: string;
863
- regionalRestriction: string;
864
- accountNumberType: string;
865
- accountFundingType: string;
866
- prepaidReloadableIndicator: string;
867
- productUsageType: string;
868
- productCode: string;
869
- productName: string;
870
- };
770
+ /**
771
+ * Adyen Klarna payment type option
772
+ */
773
+ export interface AdyenKlarnaPaymentOption {
774
+ id: string;
775
+ label: string;
871
776
  }
872
- export interface PayPalInstrumentData extends BasePaymentInstrumentData {
873
- externalPayerInfo?: {
874
- externalPayerId?: string;
875
- firstName?: string;
876
- lastName?: string;
877
- email?: string;
878
- };
879
- shippingAddress?: {
880
- firstName?: string;
881
- lastName?: string;
882
- addressLine1?: string;
883
- addressLine2?: string;
884
- city?: string;
885
- state?: string;
886
- countryCode?: string;
887
- postalCode?: string;
888
- };
777
+ /**
778
+ * Options for creating an Adyen Klarna payment method manager
779
+ */
780
+ export interface AdyenKlarnaPaymentMethodManagerOptions {
781
+ /**
782
+ * Callback when payment options change (e.g., Pay Now, Pay Later)
783
+ */
784
+ onPaymentOptionsChange?: (options: AdyenKlarnaPaymentOption[]) => void;
889
785
  }
890
- export interface KlarnaInstrumentData extends BasePaymentInstrumentData {
891
- sessionData?: {
892
- billingAddress?: {
893
- firstName?: string;
894
- lastName?: string;
895
- email?: string;
896
- phoneNumber?: string;
897
- addressLine1?: string;
898
- addressLine2?: string;
899
- city?: string;
900
- state?: string;
901
- countryCode?: string;
902
- postalCode?: string;
903
- };
904
- };
786
+ /**
787
+ * Adyen Klarna Payment Method Manager
788
+ *
789
+ * Unlike direct Klarna integration, Adyen Klarna uses a redirect flow
790
+ * with payment type selection (Pay Now, Pay Later, etc.)
791
+ */
792
+ export interface AdyenKlarnaPaymentMethodManager {
793
+ /**
794
+ * Get available payment options
795
+ */
796
+ getPaymentOptions: () => AdyenKlarnaPaymentOption[];
797
+ /**
798
+ * Select a payment option
799
+ */
800
+ selectOption: (optionId: string) => void;
801
+ /**
802
+ * Start the payment flow with the selected option
803
+ */
804
+ start: () => Promise<void>;
905
805
  }
906
- export interface ACHInstrumentData extends BasePaymentInstrumentData {
907
- accountNumberLastFourDigits: string;
908
- bankName: string;
909
- accountType?: string;
910
- routingNumber?: string;
806
+ export interface AchPaymentMethodManagerOptions {
807
+ onCollectBankAccountDetailsComplete?: () => void;
911
808
  }
912
- export interface IVaultedPaymentMethod<B extends BasePaymentInstrumentData = BasePaymentInstrumentData, I extends PaymentInstrumentType = PaymentInstrumentType, T extends PaymentMethodType = PaymentMethodType> {
809
+ export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions | AdyenKlarnaPaymentMethodManagerOptions | AchPaymentMethodManagerOptions | Record<string, unknown>;
810
+ export interface VaultListItem {
913
811
  id: string;
914
812
  analyticsId: string;
915
- paymentInstrumentData: B;
916
- paymentInstrumentType: I;
917
- paymentMethodType: T;
918
- threeDSecureAuthentication?: ThreeDSAuthenticationData$1 | null;
919
- vaultData?: VaultData | null;
813
+ paymentInstrumentData: Record<string, unknown>;
814
+ paymentInstrumentType: PaymentInstrumentType;
815
+ paymentMethodType: PaymentMethodType;
816
+ threeDSecureAuthentication?: unknown;
817
+ vaultData?: unknown;
920
818
  userDescription?: string;
921
819
  isVaulted?: boolean;
922
820
  }
923
- export type PaymentCardVaultedMethod = IVaultedPaymentMethod<PaymentCardInstrumentData, typeof PaymentInstrumentType.CARD, typeof PaymentMethodType.PAYMENT_CARD>;
924
- export type PayPalVaultedMethod = IVaultedPaymentMethod<PayPalInstrumentData, typeof PaymentInstrumentType.PAYPAL_VAULTED, typeof PaymentMethodType.PAYPAL>;
925
- export type KlarnaVaultedMethod = IVaultedPaymentMethod<KlarnaInstrumentData, typeof PaymentInstrumentType.KLARNA_CUSTOMER_TOKEN, typeof PaymentMethodType.KLARNA>;
926
- export type ACHVaultedMethod = IVaultedPaymentMethod<ACHInstrumentData, typeof PaymentInstrumentType.AUTOMATED_CLEARING_HOUSE, typeof PaymentMethodType.STRIPE_ACH>;
927
- export type VaultedPaymentMethod = PaymentCardVaultedMethod | PayPalVaultedMethod | KlarnaVaultedMethod | ACHVaultedMethod | IVaultedPaymentMethod;
928
- export interface CardSecurityCodeInputOptions {
929
- ariaLabel?: string;
821
+ export interface CvvInputOptions {
930
822
  container: string | Element | HTMLElement;
931
- id?: string;
932
- name?: string;
933
- placeholder?: string;
934
- placement?: "append" | "prepend";
935
- properties?: unknown;
936
- style?: CheckoutStyle;
937
823
  cardNetwork?: string;
824
+ ariaLabel?: string;
825
+ placeholder?: string;
826
+ style?: HostedInputOptions["style"];
938
827
  }
828
+ export type SecureInputListener = (...args: unknown[]) => void;
939
829
  export interface CvvInput {
940
830
  frame: HTMLIFrameElement | null;
941
831
  readonly metadata: {
@@ -949,236 +839,331 @@ export interface CvvInput {
949
839
  };
950
840
  focus(): void;
951
841
  blur(): void;
952
- addListener(event: "change" | "blur" | "focus", listener: (...args: unknown[]) => void): (() => void) | undefined;
953
- addEventListener(event: "change" | "blur" | "focus", listener: (...args: unknown[]) => void): (() => void) | undefined;
954
- removeListener(event: "change" | "blur" | "focus", listener: (...args: unknown[]) => void): void;
955
- name: string;
956
- valueToken: string;
842
+ addListener(event: "metadata" | "change" | "blur" | "focus", listener: SecureInputListener): void;
843
+ addEventListener(event: "metadata" | "change" | "blur" | "focus", listener: SecureInputListener): void;
844
+ removeListener(event: "metadata" | "change" | "blur" | "focus", listener: SecureInputListener): void;
957
845
  remove: () => void;
846
+ validate: () => void;
958
847
  }
959
- export interface Payment {
848
+ export interface HeadlessVaultManager {
849
+ deleteVaultedPaymentMethod(paymentMethodId: string): Promise<void>;
850
+ fetchVaultedPaymentMethods(): Promise<VaultListItem[]>;
851
+ startPaymentFlow(id: string, data?: {
852
+ cvv?: string;
853
+ }): Promise<void>;
854
+ createCvvInput(options: CvvInputOptions): Promise<CvvInput>;
855
+ }
856
+ /**
857
+ * Minimal payment summary with reduced PII exposure.
858
+ * Used in events for public data delivery.
859
+ */
860
+ export interface PaymentSummary {
861
+ /** Payment ID from Primer API */
960
862
  id: string;
863
+ /** Order ID/reference from merchant */
961
864
  orderId: string;
865
+ /** Payment method data with whitelisted fields */
962
866
  paymentMethodData?: {
963
- paymentMethodType: PaymentMethodType;
964
- reference?: string;
965
- expiresAt?: string;
966
- entity?: string;
867
+ /** Payment method type (e.g., "PAYMENT_CARD", "PAYPAL") */
868
+ paymentMethodType?: string;
869
+ /** Last 4 digits of card (cards only) */
870
+ last4Digits?: string;
871
+ /** Card network (e.g., "VISA", "MASTERCARD") - cards only */
872
+ network?: string;
873
+ /** Last 4 digits of account number (ACH only) */
874
+ accountNumberLastFourDigits?: string;
875
+ /** Bank name (ACH only) */
876
+ bankName?: string;
967
877
  };
968
878
  }
969
- export interface KlarnaPaymentMethodCategory {
879
+ /**
880
+ * Base interface for common vaulted payment method fields.
881
+ * All payment-method-specific interfaces extend this base.
882
+ */
883
+ export interface BaseVaultedPaymentMethodSummary {
884
+ /** Payment instrument ID */
970
885
  id: string;
971
- name: string;
972
- descriptiveAssetUrl: string;
973
- standardAssetUrl: string;
974
- }
975
- export interface StripeAchCustomerDetails {
976
- emailAddress: string;
977
- firstName: string;
978
- lastName: string;
886
+ /** Analytics tracking ID */
887
+ analyticsId: string;
888
+ /** Payment method type (e.g., "PAYMENT_CARD", "PAYPAL") */
889
+ paymentMethodType: PaymentMethodType;
890
+ /** Optional user-provided description for the payment method */
891
+ userDescription?: string;
979
892
  }
980
- export interface PrimerClientErrorOptions<T = unknown> {
981
- message: string;
982
- diagnosticsId?: string;
983
- severity?: "ERROR" | "DEBUG" | "WARN" | "INFO";
984
- errorId?: string;
985
- data?: T;
986
- isFromDeveloper?: boolean;
987
- }
988
- declare enum ErrorCode {
989
- INITIALIZATION_ERROR = "INITIALIZATION_ERROR",
990
- NO_PAYMENT_METHODS = "NO_PAYMENT_METHODS",
991
- PRIMER_TEARDOWN = "PRIMER_TEARDOWN",
992
- PRIMER_SERVER_ERROR = "PRIMER_SERVER_ERROR",
993
- THREE_DS_AUTH_FAILED = "THREE_DS_AUTH_FAILED",
994
- TOKENIZATION_ERROR = "TOKENIZATION_ERROR",
995
- DUPLICATE_PAYMENT_METHOD_ERROR = "DUPLICATE_PAYMENT_METHOD_ERROR",
996
- CARD_NUMBER_ERROR = "CARD_NUMBER_ERROR",
997
- PAYMENT_METHOD_NOT_SETUP = "PAYMENT_METHOD_NOT_SETUP",
998
- PAYMENT_METHOD_NOT_PROVIDED = "PAYMENT_METHOD_NOT_PROVIDED",
999
- PAYMENT_METHOD_NOT_COMPATIBLE = "PAYMENT_METHOD_NOT_COMPATIBLE",
1000
- RESUME_ERROR = "RESUME_ERROR",
1001
- VALIDATION_ERROR = "VALIDATION_ERROR",
1002
- PAYMENT_FAILED = "PAYMENT_FAILED",
1003
- PAYMENT_CREATION_ABORTED = "PAYMENT_CREATION_ABORTED",
1004
- PAYMENT_CREATION_DISABLED = "PAYMENT_CREATION_DISABLED",
1005
- CLIENT_SESSION_UPDATE_ERROR = "CLIENT_SESSION_UPDATE_ERROR",
1006
- INVALID_ARGUMENT = "INVALID_ARGUMENT",
1007
- VAULT_FETCH = "VAULT_FETCH",
1008
- VAULT_DELETE = "VAULT_DELETE",
1009
- HEADLESS_VAULT_MANAGER_VALIDATION = "HEADLESS_VAULT_MANAGER_VALIDATION",
1010
- CARD_FORM_VALIDATION_UNEXPECTED_FIELD = "CARD_FORM_VALIDATION_UNEXPECTED_FIELD",
1011
- MISSING_FIRST_NAME_OR_LAST_NAME = "MISSING_FIRST_NAME_OR_LAST_NAME",
1012
- MISSING_EMAIL_ADDRESS = "MISSING_EMAIL_ADDRESS",
1013
- INVALID_FLOW = "INVALID_FLOW"
1014
- }
1015
- declare class PrimerClientError<T = unknown> extends Error {
1016
- readonly code: ErrorCode;
1017
- readonly diagnosticsId: string | null;
1018
- readonly data?: T;
1019
- readonly isFromDeveloper: boolean;
1020
- constructor(code: ErrorCode, options: PrimerClientErrorOptions<T>);
1021
- static fromErrorCode(code: ErrorCode, options: PrimerClientErrorOptions): PrimerClientError;
1022
- }
1023
- export interface IHeadlessHostedInput {
1024
- getOptions(): {
1025
- placeholder?: string;
1026
- ariaLabel?: string;
1027
- style?: CheckoutStyle;
893
+ /**
894
+ * Vaulted payment card summary with card-specific fields.
895
+ */
896
+ export interface CardVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
897
+ /** Discriminant for card payment instruments */
898
+ paymentInstrumentType: "PAYMENT_CARD";
899
+ /** Card-specific payment instrument data */
900
+ paymentInstrumentData?: {
901
+ /** Last 4 digits of card */
902
+ last4Digits?: string;
903
+ /** Card network (e.g., "VISA", "MASTERCARD") */
904
+ network?: string;
905
+ /** Cardholder name */
906
+ cardholderName?: string;
907
+ /** Expiration month (1-12) */
908
+ expirationMonth?: string;
909
+ /** Expiration year (e.g., "2025") */
910
+ expirationYear?: string;
1028
911
  };
1029
- setOptions(options: {
1030
- placeholder?: string;
1031
- ariaLabel?: string;
1032
- style?: CheckoutStyle;
1033
- }): void;
1034
- render(container: string | Element | null, options: {
1035
- placeholder?: string;
1036
- ariaLabel?: string;
1037
- style?: CheckoutStyle;
1038
- }): Promise<void>;
1039
- addEventListener(event: EventTypes, callback: EventListener$1): void;
1040
- focus(): void;
1041
- blur(): void;
1042
- setDisabled(status: boolean): void;
1043
912
  }
1044
- export interface ICardPaymentMethodManager {
1045
- createHostedInputs(): {
1046
- cardNumberInput: IHeadlessHostedInput;
1047
- expiryInput: IHeadlessHostedInput;
1048
- cvvInput: IHeadlessHostedInput;
913
+ /**
914
+ * Vaulted PayPal billing agreement summary with PayPal-specific fields.
915
+ */
916
+ export interface PayPalVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
917
+ /** Discriminant for PayPal billing agreement instruments */
918
+ paymentInstrumentType: "PAYPAL_BILLING_AGREEMENT";
919
+ /** PayPal-specific payment instrument data */
920
+ paymentInstrumentData?: {
921
+ /** External PayPal payer ID */
922
+ externalPayerId?: string;
923
+ /** PayPal account email */
924
+ email?: string;
925
+ /** First name */
926
+ firstName?: string;
927
+ /** Last name */
928
+ lastName?: string;
929
+ externalPayerInfo?: {
930
+ externalPayerId?: string;
931
+ firstName?: string;
932
+ lastName?: string;
933
+ email?: string;
934
+ };
935
+ shippingAddress?: {
936
+ firstName?: string;
937
+ lastName?: string;
938
+ addressLine1?: string;
939
+ addressLine2?: string;
940
+ city?: string;
941
+ state?: string;
942
+ countryCode?: string;
943
+ postalCode?: string;
944
+ };
1049
945
  };
1050
- setCardholderName(cardholderName: string): void;
1051
- removeHostedInputs(): void;
1052
- submit(values?: CardPaymentMethodSubmitValues): Promise<void>;
1053
- validate(): Promise<Validation>;
1054
- reset(): void;
1055
- }
1056
- export interface IHeadlessPaymentMethodButton {
1057
- render(containerId: string | Element, options: {
1058
- style?: Record<string, unknown>;
1059
- }): Promise<void>;
1060
- setDisabled(disabled: boolean): Promise<void>;
1061
- clean(): void;
1062
- focus(): void;
1063
- blur(): void;
1064
- addEventListener(event: EventTypes, callback: EventListener$1): void;
1065
946
  }
1066
- export interface INativePaymentMethodManager {
1067
- createButton(): IHeadlessPaymentMethodButton;
1068
- }
1069
- export interface IRedirectPaymentMethodManager {
1070
- start(): Promise<void>;
1071
- addEventListener(event: EventTypes, callback: EventListener$1): void;
1072
- }
1073
- export interface IKlarnaPaymentMethodManager {
1074
- start(paymentPayload: {
1075
- paymentMethodCategoryId: string;
1076
- }): Promise<{
1077
- outcome: "APPROVED" | "DENIED";
1078
- }>;
1079
- renderCategory(renderCategoryDetails: {
1080
- containerId: string | Element;
1081
- paymentMethodCategoryId: string;
1082
- onHeightChange: (height: number) => void;
1083
- }): Promise<void>;
1084
- addEventListener(event: EventTypes, callback: EventListener$1): void;
1085
- getPaymentMethod(): void;
1086
- }
1087
- export interface IAchPaymentMethodManager {
1088
- start(paymentDetails: StripeAchCustomerDetails): Promise<Validation | void>;
1089
- setAndValidate(paymentDetails: StripeAchCustomerDetails): Promise<Validation>;
1090
- collectBankAccountDetails(): Promise<void>;
1091
- confirmMandate(): Promise<void>;
1092
- declineMandate(): Promise<void>;
1093
- getPaymentMethod(): void;
947
+ /**
948
+ * Vaulted Klarna customer token summary with Klarna-specific fields.
949
+ */
950
+ export interface KlarnaVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
951
+ /** Discriminant for Klarna customer token instruments */
952
+ paymentInstrumentType: "KLARNA_CUSTOMER_TOKEN";
953
+ /** Klarna-specific payment instrument data */
954
+ paymentInstrumentData?: {
955
+ /** Klarna account email */
956
+ email?: string;
957
+ /** First name */
958
+ firstName?: string;
959
+ /** Last name */
960
+ lastName?: string;
961
+ /** Phone number */
962
+ phoneNumber?: string;
963
+ sessionData?: {
964
+ billingAddress?: {
965
+ firstName?: string;
966
+ lastName?: string;
967
+ email?: string;
968
+ phoneNumber?: string;
969
+ addressLine1?: string;
970
+ addressLine2?: string;
971
+ city?: string;
972
+ state?: string;
973
+ countryCode?: string;
974
+ postalCode?: string;
975
+ };
976
+ };
977
+ };
1094
978
  }
1095
- export interface IBlikPaymentMethodManager {
1096
- start(params: {
1097
- blikCode: string;
1098
- }): Promise<void>;
979
+ /**
980
+ * Vaulted ACH (Automated Clearing House) summary with ACH-specific fields.
981
+ */
982
+ export interface ACHVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
983
+ /** Discriminant for ACH instruments */
984
+ paymentInstrumentType: "AUTOMATED_CLEARING_HOUSE";
985
+ /** ACH-specific payment instrument data */
986
+ paymentInstrumentData?: {
987
+ /** Last 4 digits of account number */
988
+ accountNumberLastFourDigits?: string;
989
+ /** Bank name */
990
+ bankName?: string;
991
+ /** Account type (e.g., "CHECKING", "SAVINGS") */
992
+ accountType?: string;
993
+ };
1099
994
  }
1100
995
  /**
1101
- * Adyen MB WAY Payment Method Manager
1102
- *
1103
- * Collects the user's phone number (with country prefix) inline, tokenizes
1104
- * it, and polls the returned status URL until the user confirms the payment
1105
- * in the MB WAY mobile app.
996
+ * Generic vaulted payment method summary for payment instruments
997
+ * not explicitly modeled with their own interface.
1106
998
  */
1107
- export interface IMbwayPaymentMethodManager {
1108
- start(params: {
1109
- phoneNumber: string;
1110
- }): Promise<void>;
999
+ export interface GenericVaultedPaymentMethodSummary extends BaseVaultedPaymentMethodSummary {
1000
+ /** Discriminant for all other payment instrument types */
1001
+ paymentInstrumentType: Exclude<PaymentInstrumentType, "PAYMENT_CARD" | "PAYPAL_BILLING_AGREEMENT" | "KLARNA_CUSTOMER_TOKEN" | "AUTOMATED_CLEARING_HOUSE">;
1002
+ /** Generic payment instrument data for unknown/other payment methods */
1003
+ paymentInstrumentData?: Record<string, unknown>;
1111
1004
  }
1112
1005
  /**
1113
- * Adyen Klarna payment option
1006
+ * Discriminated union of all vaulted payment method summaries.
1007
+ * Use the paymentInstrumentType field to narrow to specific types.
1114
1008
  */
1115
- export interface AdyenKlarnaPaymentOption {
1009
+ export type VaultedPaymentMethodSummary = CardVaultedPaymentMethodSummary | PayPalVaultedPaymentMethodSummary | KlarnaVaultedPaymentMethodSummary | ACHVaultedPaymentMethodSummary | GenericVaultedPaymentMethodSummary;
1010
+ /**
1011
+ * Approval state of a MANUAL attempt. `REQUIRES_APPROVAL` is pending; `APPROVED`,
1012
+ * `ABORTED` and `EXPIRED` are terminal.
1013
+ */
1014
+ export type AttemptApprovalStatus = "REQUIRES_APPROVAL" | "APPROVED" | "ABORTED" | "EXPIRED";
1015
+ /**
1016
+ * The active payment attempt for a MANUAL session. Returned on the client-session
1017
+ * response (`:pay` / session fetch) and embedded on the configuration response,
1018
+ * letting the SDK resolve MANUAL-flow recovery without a separate session read
1019
+ * on startup. Absent when no attempt is in flight.
1020
+ */
1021
+ export interface CurrentAttempt {
1022
+ /** Payment attempt identifier - required for /approve and /abort */
1116
1023
  id: string;
1117
- label: string;
1024
+ /** Token attached to this attempt; optional on the wire, but always set for a MANUAL attempt. */
1025
+ paymentInstrumentTokenId?: string;
1026
+ /** Id of the payment created once approved; absent while awaiting approval. */
1027
+ paymentId?: string;
1028
+ /** The attempt's approval state. */
1029
+ approvalStatus?: AttemptApprovalStatus;
1118
1030
  }
1119
1031
  /**
1120
- * Adyen Klarna Payment Method Manager
1121
- *
1122
- * Unlike direct Klarna integration, Adyen Klarna uses a redirect flow
1123
- * with payment type selection (Pay Now, Pay Later, etc.)
1032
+ * Data surfaced to the merchant when a MANUAL-approval `:pay` creates an
1033
+ * attempt awaiting approval. The merchant sends clientSessionId +
1034
+ * paymentAttemptId to its backend (which calls /approve or /abort), then calls
1035
+ * continueFlow() to resume the SDK.
1124
1036
  */
1125
- export interface IAdyenKlarnaPaymentMethodManager {
1126
- /**
1127
- * Get available payment options
1128
- */
1129
- getPaymentOptions(): AdyenKlarnaPaymentOption[];
1130
- /**
1131
- * Select a payment option
1132
- */
1133
- selectOption(optionId: string): void;
1134
- /**
1135
- * Start the payment flow with the selected option
1136
- */
1137
- start(): Promise<void>;
1037
+ export interface PaymentApprovalRequiredData {
1038
+ clientSessionId: string;
1039
+ paymentAttemptId: string;
1040
+ /** The token tied to the attempt. */
1041
+ paymentMethodToken: PaymentMethodToken;
1042
+ continueFlow: () => Promise<void>;
1138
1043
  }
1139
- export interface HeadlessVaultManager {
1140
- fetchVaultedPaymentMethods(): Promise<VaultedPaymentMethod[]>;
1141
- deleteVaultedPaymentMethod(id: string): Promise<void>;
1142
- startPaymentFlow(id: string, data?: {
1143
- cvv?: string;
1044
+ export interface CardNetworkDetails {
1045
+ displayName: string;
1046
+ network: string;
1047
+ allowed: boolean;
1048
+ }
1049
+ export interface CardNetworks {
1050
+ items: CardNetworkDetails[];
1051
+ preferred?: CardNetworkDetails;
1052
+ }
1053
+ export interface CardNetworkChangeEvent {
1054
+ detectedCardNetworks: CardNetworks;
1055
+ selectableCardNetworks?: CardNetworks;
1056
+ source: "REMOTE" | "LOCAL" | "LOCAL_FALLBACK";
1057
+ }
1058
+ export interface BinDataDetails extends CardNetworkDetails {
1059
+ issuerCountryCode?: string;
1060
+ issuerName?: string;
1061
+ accountFundingType?: string;
1062
+ prepaidReloadableIndicator?: string;
1063
+ productUsageType?: string;
1064
+ productCode?: string;
1065
+ productName?: string;
1066
+ issuerCurrencyCode?: string;
1067
+ regionalRestriction?: string;
1068
+ accountNumberType?: string;
1069
+ }
1070
+ export interface BinDataAvailableEvent {
1071
+ preferred?: BinDataDetails;
1072
+ alternatives: BinDataDetails[];
1073
+ status: "complete" | "partial";
1074
+ firstDigits?: string;
1075
+ }
1076
+ export interface HostedInput {
1077
+ cleanup: () => void;
1078
+ getOptions: () => HeadlessHostedInputOptions;
1079
+ setOptions: (options: HeadlessHostedInputOptions) => void;
1080
+ render: (container: string | Element, options: HeadlessHostedInputOptions) => Promise<void>;
1081
+ addEventListener: (event: EventTypes, callback: EventListener$1) => void;
1082
+ focus: () => void;
1083
+ blur: () => void;
1084
+ setDisabled: (status: boolean) => void;
1085
+ }
1086
+ export interface HostedInputs {
1087
+ cardNumberInput: HostedInput;
1088
+ cardholderNameInput: HostedInput;
1089
+ expiryInput: HostedInput;
1090
+ cvvInput: HostedInput;
1091
+ }
1092
+ export interface InputValidationError {
1093
+ field?: string;
1094
+ name: string;
1095
+ error: string;
1096
+ message: string;
1097
+ }
1098
+ export interface Validation {
1099
+ valid: boolean;
1100
+ validationErrors: InputValidationError[];
1101
+ error?: string;
1102
+ }
1103
+ export interface CardPaymentMethodManager {
1104
+ createHostedInputs: () => HostedInputs;
1105
+ removeHostedInputs: () => void;
1106
+ submit: (values?: CardPaymentMethodSubmitValues) => Promise<void>;
1107
+ validate: () => Promise<Validation>;
1108
+ reset: () => void;
1109
+ setCardholderName: (cardholderName: string) => void;
1110
+ }
1111
+ export interface MbwayPaymentMethodManager {
1112
+ start(params: {
1113
+ phoneNumber: string;
1144
1114
  }): Promise<void>;
1145
- createCvvInput(options: CardSecurityCodeInputOptions): Promise<CvvInput | null>;
1146
1115
  }
1147
- export interface IAssetsManager {
1148
- getCardNetworkAsset(cardNetwork: string): Promise<{
1149
- cardUrl: string;
1150
- displayName: string;
1151
- }>;
1152
- getPaymentMethodAsset(type: PaymentMethodType): Promise<{
1153
- backgroundColor: BackgroundColor;
1154
- iconUrl: IconUrl;
1155
- paymentMethodName?: string;
1156
- buttonText?: string;
1157
- displayName?: string;
1158
- } | null>;
1116
+ export interface BlikPaymentMethodManager {
1117
+ start(params: {
1118
+ blikCode: string;
1119
+ }): Promise<void>;
1120
+ }
1121
+ export interface StripeAchCustomerDetails {
1122
+ emailAddress: string;
1123
+ firstName: string;
1124
+ lastName: string;
1125
+ }
1126
+ export interface AchPaymentMethodManager {
1127
+ start(paymentDetails: StripeAchCustomerDetails): Promise<Validation | void>;
1128
+ setAndValidate(paymentDetails: StripeAchCustomerDetails): Promise<Validation>;
1129
+ collectBankAccountDetails(): Promise<void>;
1130
+ confirmMandate(): Promise<void>;
1131
+ declineMandate(): Promise<void>;
1132
+ getPaymentMethod(): void;
1159
1133
  }
1160
- export interface CheckoutModuleConfig {
1161
- type: string;
1162
- options?: Record<string, unknown>;
1134
+ export interface NativePaymentMethodManager {
1135
+ createButton: () => {
1136
+ render: (container: HTMLElement, buttonOptions?: PaymentRenderButtonOptions) => Promise<void>;
1137
+ setDisabled(disabled: boolean): Promise<void>;
1138
+ };
1163
1139
  }
1164
- export interface ClientConfiguration {
1165
- binDataUrl: string;
1166
- checkoutModules?: CheckoutModuleConfig[];
1167
- clientSession: ClientSession;
1168
- coreUrl: string;
1169
- env: string;
1170
- paymentMethods: PaymentMethodConfig[];
1171
- pciUrl: string;
1172
- primerAccountId: string;
1173
- settleOnAuth?: boolean;
1140
+ export interface RedirectPaymentMethodManager {
1141
+ start: () => Promise<void>;
1142
+ }
1143
+ /**
1144
+ * QRCode Payment Method Manager
1145
+ */
1146
+ export interface QRCodePaymentMethodManager {
1147
+ /**
1148
+ * Start the payment flow, optionally providing a callback for when the QR code is received
1149
+ * @param params Optional parameters, including onQRCodeReceived callback
1150
+ */
1151
+ start(params?: {
1152
+ onQRCodeReceived?: (qrCode: string) => void;
1153
+ }): Promise<void>;
1154
+ /**
1155
+ * Stop the payment flow
1156
+ */
1157
+ stop(): void;
1174
1158
  }
1175
- export interface HeadlessSDKUtilities {
1176
- getCardNetworkAsset(network: string): {
1159
+ export type PaymentMethodManager = CardPaymentMethodManager | NativePaymentMethodManager | RedirectPaymentMethodManager | KlarnaPaymentMethodManager | QRCodePaymentMethodManager;
1160
+ export interface SDKUtilities {
1161
+ getCardNetworkAsset: (network: string) => {
1177
1162
  cardUrl: string;
1178
1163
  displayName: string;
1179
1164
  };
1180
- getUIOrderAmount(): string | null;
1181
- getCDNAssets(paymentMethodType: PaymentMethodType): Promise<{
1165
+ getUIOrderAmount: () => string | null;
1166
+ getCDNAssets: (paymentType: PaymentMethodType) => Promise<{
1182
1167
  assets: {
1183
1168
  icon: string;
1184
1169
  };
@@ -1192,88 +1177,11 @@ export interface HeadlessSDKUtilities {
1192
1177
  website: string | null;
1193
1178
  goatCdnUrl: string;
1194
1179
  } | undefined>;
1195
- getPaymentMethodConfiguration(paymentMethodType: PaymentMethodType): PaymentMethodConfig | undefined;
1196
- setBillingAddress(address: NullableAddress): Promise<void>;
1197
- }
1198
- export interface CardPaymentMethodManagerOptions {
1199
- onBinDataAvailable?: (event: BinDataAvailableEvent) => void;
1200
- onBinDataLoadingChange?: (loading: boolean) => void;
1201
- onCardMetadataChange?: (metadata: {
1202
- type: CardNetworkType | null;
1203
- possibleTypes: string[];
1204
- cvvLength: number;
1205
- cardNumberLength: number;
1206
- }) => void;
1207
- onCardNetworksChange?: (event: CardNetworkChangeEvent) => void;
1208
- onCardNetworksLoading?: () => void;
1209
- }
1210
- export interface KlarnaPaymentMethodManagerOptions {
1211
- onPaymentMethodCategoriesChange?: (paymentMethodCategories: KlarnaPaymentMethodCategory[]) => void;
1212
- onPaymentMethodAction?: (action: string, data: {
1213
- paymentMethodType: string;
1214
- category: string;
1215
- }) => void;
1216
- }
1217
- export interface AchPaymentMethodManagerOptions {
1218
- onCollectBankAccountDetailsComplete?: () => void;
1219
- }
1220
- export interface AdyenKlarnaPaymentMethodManagerOptions {
1221
- onPaymentOptionsChange?: (options: AdyenKlarnaPaymentOption[]) => void;
1222
- }
1223
- export type PaymentMethodManagerOptions = CardPaymentMethodManagerOptions | KlarnaPaymentMethodManagerOptions | AdyenKlarnaPaymentMethodManagerOptions | AchPaymentMethodManagerOptions;
1224
- export interface CheckoutStyle {
1225
- fontFaces?: Array<{
1226
- fontFamily?: string;
1227
- src?: string;
1228
- unicodeRange?: string;
1229
- fontVariant?: string;
1230
- fontFeatureSettings?: string;
1231
- fontVariationSettings?: string;
1232
- fontStretch?: string;
1233
- fontWeight?: string;
1234
- fontStyle?: string;
1235
- }>;
1236
- stylesheets?: Array<{
1237
- href: string;
1238
- }>;
1239
- loadingScreen?: {
1240
- color?: string;
1241
- };
1242
- input?: InputStyles;
1243
- inputLabel?: Record<string, unknown>;
1244
- inputErrorText?: Record<string, unknown>;
1245
- formSpacings?: {
1246
- betweenLabelAndInput?: string;
1247
- betweenInputs?: string;
1248
- };
1249
- showMorePaymentMethodsButton?: Record<string, unknown>;
1250
- networkError?: Record<string, unknown>;
1251
- submitButton?: Record<string, unknown>;
1252
- vaultTitle?: Record<string, unknown>;
1253
- savedPaymentMethodButton?: Record<string, unknown>;
1254
- paymentMethodButton?: Record<string, unknown>;
1255
- errorMessage?: Record<string, unknown>;
1256
- smallPrint?: Record<string, unknown>;
1257
- directDebit?: Record<string, unknown>;
1258
- vaultMenu?: Record<string, unknown>;
1259
- backButton?: Record<string, unknown>;
1260
- separator?: Record<string, unknown>;
1261
- processingIndicator?: Record<string, unknown>;
1262
- focusCheckoutOnInit?: boolean;
1263
- }
1264
- interface ThreeDSAuthenticationData$1 {
1265
- responseCode: "AUTH_SUCCESS" | "AUTH_FAILED" | "SKIPPED" | "CHALLENGE";
1266
- reasonCode?: string;
1267
- reasonText?: string;
1268
- protocolVersion: string;
1269
- challengeIssued: boolean;
1270
- }
1271
- export interface VaultData {
1272
- customerId: string;
1180
+ getPaymentMethodConfiguration: (paymentType: PaymentMethodType) => PaymentMethodConfig | undefined;
1181
+ setBillingAddress: (address: NullableAddress) => Promise<void>;
1273
1182
  }
1274
- type EventListener$1 = (event?: Event) => void;
1275
1183
  export interface AnalyticsUtils {
1276
- environment: string;
1184
+ environment: AnalyticsEnvironment;
1277
1185
  primerAccountId?: string;
1278
1186
  checkoutSessionId: string;
1279
1187
  clientSessionId?: string;
@@ -1283,254 +1191,170 @@ export interface AnalyticsUtils {
1283
1191
  configurationFetchStartTime?: number;
1284
1192
  }
1285
1193
  export interface PrimerHeadlessCheckout {
1286
- createPaymentMethodManager(type: "PAYMENT_CARD", options?: PaymentMethodManagerOptions): Promise<ICardPaymentMethodManager | null>;
1287
- createPaymentMethodManager(type: "PAYPAL" | "GOOGLE_PAY" | "APPLE_PAY", options?: PaymentMethodManagerOptions): Promise<INativePaymentMethodManager | null>;
1288
- createPaymentMethodManager(type: "STRIPE_ACH", options?: AchPaymentMethodManagerOptions): Promise<IAchPaymentMethodManager | null>;
1289
- createPaymentMethodManager(type: "KLARNA", options?: PaymentMethodManagerOptions): Promise<IKlarnaPaymentMethodManager | null>;
1290
- createPaymentMethodManager(type: "ADYEN_KLARNA", options?: AdyenKlarnaPaymentMethodManagerOptions): Promise<IAdyenKlarnaPaymentMethodManager | null>;
1291
- createPaymentMethodManager(type: PaymentMethodType, options?: PaymentMethodManagerOptions): Promise<IRedirectPaymentMethodManager | null>;
1292
- createVaultManager(): HeadlessVaultManager;
1293
- getSDKUtilities(): HeadlessSDKUtilities;
1294
- getAnalyticsUtils?: () => AnalyticsUtils;
1295
- configure?: (options: Omit<HeadlessUniversalCheckoutOptions, "clientSessionCachingEnabled">) => void;
1296
- getAssetsManager(): IAssetsManager;
1297
1194
  start: () => Promise<void>;
1298
- refreshClientSession(): Promise<boolean>;
1299
- getConfiguration(): ClientConfiguration;
1300
- teardown?: () => void;
1195
+ createPaymentMethodManager: (type: string, managerOptions?: PaymentMethodManagerOptions) => Promise<PaymentMethodManager | null>;
1196
+ getSDKUtilities: () => SDKUtilities;
1197
+ getAnalyticsUtils?: () => AnalyticsUtils;
1198
+ createVaultManager: () => HeadlessVaultManager;
1199
+ getAssetsManager: () => unknown;
1200
+ refreshClientSession: () => Promise<boolean>;
1201
+ teardown: () => void;
1202
+ getConfiguration: () => ClientConfiguration;
1301
1203
  }
1302
- export interface HeadlessUniversalCheckoutOptions {
1303
- style?: CheckoutStyle;
1304
- paymentHandling?: "AUTO" | "MANUAL";
1305
- locale?: string;
1204
+ /**
1205
+ * Dialog display request containing content and coordination callbacks
1206
+ */
1207
+ export interface DialogRequest {
1208
+ /**
1209
+ * HTML content to display (3DS forms, iframes, etc.)
1210
+ */
1211
+ htmlContent: Element;
1212
+ /**
1213
+ * Called when DOM content is fully rendered and ready
1214
+ * SDK Core uses this for form submission, iframe setup, etc.
1215
+ */
1216
+ onContentReady?: () => void;
1217
+ /**
1218
+ * Wether the dialog should show a close button
1219
+ * @default false
1220
+ */
1221
+ showCloseButton?: boolean;
1222
+ /**
1223
+ * Size of the dialog
1224
+ * @default 'large'
1225
+ */
1226
+ size?: "flex" | "large";
1227
+ /**
1228
+ * Optional call-to-action (CTA) button configuration
1229
+ */
1230
+ cta?: {
1231
+ label: string;
1232
+ onClick: (event: MouseEvent) => void;
1233
+ icon?: string;
1234
+ };
1235
+ }
1236
+ /**
1237
+ * Result of dialog interaction
1238
+ */
1239
+ export interface DialogResult {
1240
+ /**
1241
+ * Whether the dialog completed successfully
1242
+ * false indicates user cancellation/dismissal
1243
+ */
1244
+ success: boolean;
1245
+ }
1246
+ /**
1247
+ * 3DS challenge display request. The dialog provider dispatches an event with
1248
+ * `url`/`width`/`height` so merchants can render the challenge themselves
1249
+ * (e.g. by pointing an iframe at `url`). If no merchant intercepts, the
1250
+ * provider falls back to rendering `htmlContent` in its default dialog.
1251
+ */
1252
+ export interface ThreeDsChallengeRequest {
1253
+ url: string;
1254
+ width: number;
1255
+ height: number;
1256
+ /** Pre-built DOM the provider renders when no merchant intercepts the event. */
1257
+ htmlContent: Element;
1258
+ /** Called by the provider once `htmlContent` is mounted. */
1259
+ onContentReady?: () => void;
1260
+ }
1261
+ /**
1262
+ * DialogProvider interface for SDK Core dialog abstraction
1263
+ * Enables merchants to integrate any dialog implementation
1264
+ */
1265
+ export interface DialogProvider {
1266
+ /**
1267
+ * Display dialog content and coordinate with SDK Core
1268
+ * @param request Dialog display request
1269
+ * @returns Promise resolving when user completes or cancels flow
1270
+ */
1271
+ show(request: DialogRequest): Promise<DialogResult>;
1272
+ /**
1273
+ * Programmatically close the dialog
1274
+ * Called by SDK Core when background processes complete
1275
+ */
1276
+ close(): void;
1277
+ /**
1278
+ * Display a 3DS challenge by URL. Implementations are expected to give the
1279
+ * merchant a chance to render their own dialog/tab (e.g. by dispatching a
1280
+ * `primer:3ds-challenge` DOM event) and fall back to a built-in dialog when
1281
+ * the merchant does not handle it.
1282
+ */
1283
+ show3dsChallenge(request: ThreeDsChallengeRequest): Promise<DialogResult>;
1284
+ /**
1285
+ * Close the 3DS challenge dialog and signal completion to merchant
1286
+ * listeners (e.g. by dispatching `primer:3ds-challenge-completed`).
1287
+ */
1288
+ close3dsChallenge(): void;
1289
+ }
1290
+ export interface CreateHeadlessOptions {
1291
+ enabledPaymentMethods?: PaymentMethodType[];
1292
+ cardholderName?: {
1293
+ required?: boolean;
1294
+ visible?: boolean;
1295
+ /**
1296
+ * Pre-fills the cardholder name field with the specified value.
1297
+ * Value is applied synchronously during iframe initialization (no race conditions).
1298
+ * User can edit or clear the pre-filled value.
1299
+ *
1300
+ * @example "John Doe"
1301
+ */
1302
+ defaultValue?: string;
1303
+ };
1304
+ /**
1305
+ * Google Pay client-side options.
1306
+ */
1307
+ googlePay?: GooglePayClientOptions;
1306
1308
  card?: {
1307
1309
  cardholderName?: {
1308
1310
  required?: boolean;
1309
1311
  visible?: boolean;
1310
1312
  placeholder?: string;
1313
+ /**
1314
+ * Pre-fills the cardholder name field with the specified value.
1315
+ * Value is applied synchronously during iframe initialization (no race conditions).
1316
+ * User can edit or clear the pre-filled value.
1317
+ *
1318
+ * @example "John Doe"
1319
+ */
1320
+ defaultValue?: string;
1311
1321
  };
1312
- cardNumber?: {
1313
- placeholder?: string;
1314
- };
1315
- expiryDate?: {
1316
- placeholder?: string;
1317
- };
1318
- cvv?: {
1319
- placeholder?: string;
1320
- };
1321
- preferredFlow?: CardPreferredFlow;
1322
- };
1323
- redirect?: {
1324
- returnUrl?: string;
1325
- forceRedirect?: boolean;
1326
1322
  };
1327
- paypal?: PayPalOptions;
1328
- googlePay?: GooglePayOptions;
1329
- applePay?: ApplePayOptions;
1330
- adyenKlarna?: {
1323
+ paypal?: PayPalOptionsWithPaypalJsTypes;
1324
+ applePay?: LegacyApplePayOptions & ApplePayClientOptions;
1325
+ klarna?: {
1326
+ paymentFlow?: "DEFAULT" | "PREFER_VAULT";
1327
+ recurringPaymentDescription?: string;
1328
+ allowedPaymentCategories?: Array<"pay_now" | "pay_later" | "pay_over_time">;
1331
1329
  buttonOptions?: {
1332
1330
  text?: string;
1333
1331
  };
1334
1332
  };
1335
- klarna?: KlarnaOptions;
1336
- directDebit?: {
1337
- customerCountryCode: string;
1338
- companyName: string;
1339
- companyAddress: string;
1340
- customerName?: string;
1341
- customerEmail?: string;
1342
- customerAddressLine1?: string;
1343
- customerAddressLine2?: string;
1344
- customerCity?: string;
1345
- customerPostalCode?: string;
1346
- iban?: string;
1347
- submitButtonLabels?: {
1348
- form?: string;
1349
- mandate: string;
1333
+ adyenKlarna?: {
1334
+ buttonOptions?: {
1335
+ text?: string;
1350
1336
  };
1351
1337
  };
1352
- giftCard?: {
1353
- logoSrc: string;
1354
- background: string;
1355
- logoAlt?: string;
1356
- text?: string;
1357
- };
1358
- stripe?: {
1359
- publishableKey?: string;
1360
- mandateData?: {
1361
- fullMandateText?: string;
1362
- merchantName?: string;
1363
- };
1364
- } & Record<string, unknown>;
1365
- onAvailablePaymentMethodsLoad: (paymentMethods: PaymentMethodInfo[]) => void;
1338
+ locale?: string;
1366
1339
  /**
1367
- * Fires after each successful `refreshClientSession` when the available
1368
- * payment methods changed as a result of the backend re-evaluating
1369
- * visibility rules against the updated client session metadata.
1340
+ * Optional translation function for localizing strings.
1341
+ * When provided, sdk-core will use this to translate labels (e.g., Google Pay display items).
1370
1342
  */
1371
- onAvailablePaymentMethodsRefresh?: (paymentMethods: PaymentMethodInfo[]) => void;
1372
- clientSessionCachingEnabled?: boolean;
1373
- apiVersion?: APIVersionOption;
1374
- onCheckoutComplete?: (data: {
1375
- payment: Payment | null;
1376
- }) => void;
1377
- onCheckoutFail?: (error: PrimerClientError, data: {
1378
- payment?: Payment;
1379
- }, handler?: {
1380
- showErrorMessage: (errorMessage?: string) => void;
1381
- }) => void;
1382
- onBeforePaymentCreate?: (data: {
1383
- paymentMethodType?: PaymentMethodType;
1384
- }, handler: {
1385
- continuePaymentCreation: (data?: {
1386
- idempotencyKey?: string;
1387
- }) => void;
1388
- abortPaymentCreation: () => void;
1389
- }) => void;
1390
- onPaymentCreationStart?: () => void;
1391
- onPaymentApprovalRequired?: (data: PaymentApprovalRequiredData) => void;
1392
- onPaymentMethodAction?: (data: "PAYMENT_METHOD_SELECTED" | "PAYMENT_METHOD_UNSELECTED", handler: {
1393
- payment?: Payment;
1394
- paymentMethodType: PaymentMethodType | null;
1395
- }) => void;
1396
- onClientSessionUpdate?: (clientSession: ClientSession) => void;
1397
- onBeforeClientSessionUpdate?: () => void;
1398
- onTokenizeShouldStart?: (data: {
1399
- paymentMethodType?: PaymentMethodType;
1400
- }) => boolean | Promise<boolean>;
1401
- onTokenizeDidNotStart?: (reason: string) => void;
1402
- onTokenizeStart?: () => void;
1403
- onTokenizeSuccess?: (data: PaymentMethodToken$1, handler: {
1404
- handleSuccess(): unknown;
1405
- handleFailure(errorMessage?: string): unknown;
1406
- continueWithNewClientToken(clientToken: string): unknown;
1407
- }) => void | Promise<void>;
1408
- onTokenizeError?: (error: PrimerClientError) => void;
1409
- onResumeSuccess?: (data: {
1410
- resumeToken: string;
1411
- paymentId?: string;
1412
- }, handler: {
1413
- handleSuccess(): unknown;
1414
- handleFailure(errorMessage?: string): unknown;
1415
- continueWithNewClientToken(clientToken: string): unknown;
1416
- }) => void;
1417
- onResumePending?: (paymentMethodData: {
1418
- paymentMethodType: PaymentMethodType;
1419
- reference?: string;
1420
- expiresAt?: string;
1421
- entity?: string;
1422
- }) => void;
1423
- onResumeError?: (error: PrimerClientError) => void;
1424
- }
1425
- interface PaymentMethodToken$1 {
1426
- token: string;
1427
- analyticsId: string;
1428
- tokenType: "SINGLE_USE" | "MULTI_USE";
1429
- paymentInstrumentData: BasePaymentInstrumentData;
1430
- paymentInstrumentType: PaymentInstrumentType;
1431
- threeDSecureAuthentication: ThreeDSAuthenticationData$1 | null;
1432
- vaultData: VaultData | null;
1433
- }
1434
- export interface ApplePayOptions {
1435
- container?: string | Element;
1436
- buttonType?: "plain" | "buy" | "set-up" | "donate" | "check-out" | "book" | "subscribe";
1437
- buttonStyle?: "white" | "white-outline" | "black";
1438
- captureBillingAddress?: boolean;
1439
- billingOptions?: {
1440
- requiredBillingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
1441
- };
1442
- shippingOptions?: {
1443
- requiredShippingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
1444
- requireShippingMethod?: boolean;
1445
- };
1446
- }
1447
- export interface GooglePayOptions {
1448
- container?: string | Element;
1449
- buttonType?: "long" | "short" | "book" | "buy" | "checkout" | "donate" | "order" | "pay" | "plain" | "subscribe";
1450
- buttonColor?: "default" | "black" | "white";
1451
- buttonSizeMode?: "fill" | "static";
1452
- onClick?: () => void;
1453
- captureBillingAddress?: boolean;
1454
- shippingAddressParameters?: {
1455
- phoneNumberRequired?: boolean;
1456
- };
1457
- emailRequired?: boolean;
1458
- requireShippingMethod?: boolean;
1459
- shadowRoot?: boolean;
1460
- }
1461
- export interface PayPalOptions {
1462
- container?: string | Element;
1463
- buttonColor?: "gold" | "blue" | "silver" | "white" | "black";
1464
- buttonShape?: "pill" | "rect";
1465
- buttonSize?: "small" | "medium" | "large" | "responsive";
1466
- buttonHeight?: number;
1467
- buttonLabel?: "checkout" | "credit" | "pay" | "buynow" | "paypal" | "installment";
1468
- buttonTagline?: boolean;
1469
- paymentFlow?: "DEFAULT" | "PREFER_VAULT";
1470
- onClick?: () => void;
1471
- }
1472
- export interface KlarnaOptions {
1473
- paymentFlow?: "DEFAULT" | "PREFER_VAULT";
1474
- recurringPaymentDescription?: string;
1475
- allowedPaymentCategories?: Array<"pay_now" | "pay_later" | "pay_over_time">;
1476
- buttonOptions?: {
1477
- text?: string;
1478
- };
1479
- }
1480
- /**
1481
- * PrimerCheckoutOptions defines the configuration options for the Primer checkout.
1482
- * This is an explicit definition of the options rather than a mapped type to make
1483
- * the type more predictable and easier to maintain.
1484
- */
1485
- export interface PrimerCheckoutOptions {
1486
- clientToken?: string;
1343
+ translate?: TranslateFunction;
1487
1344
  /**
1488
- * Sets the localization language for SDK UI text, validation messages, and country names.
1489
- *
1490
- * Supports standard locale codes in the format `language-COUNTRY` (e.g., `'en-US'`, `'fr-FR'`).
1491
- * If an unsupported locale is provided, falls back to `'en-GB'` with a console warning.
1492
- *
1493
- * Supported locales: `ar`, `bg`, `ca`, `cs`, `da`, `de`, `el`, `en-GB`, `es`, `es-AR`, `es-MX`,
1494
- * `et-EE`, `fi-FI`, `fr`, `he`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `lt`, `lt-LT`, `lv`, `lv-LV`,
1495
- * `ms`, `nb`, `nl`, `nl_NL`, `pl`, `pt`, `pt-BR`, `ro`, `ru`, `sk`, `sl`, `sr-RS`, `sv`, `th`,
1496
- * `tr`, `uk-UA`, `vi`, `zh`, `zh-TW`
1497
- *
1498
- * @default 'en-GB'
1499
- * @example
1500
- * ```typescript
1501
- * // French localization
1502
- * { locale: 'fr-FR' }
1503
- *
1504
- * // Spanish (Mexico)
1505
- * { locale: 'es-MX' }
1506
- * ```
1345
+ * Dialog implementation for 3DS and redirect flows
1346
+ * Required for SDK Core operation
1507
1347
  */
1508
- locale?: string;
1509
- apiVersion?: APIVersionOption;
1348
+ dialogProvider: DialogProvider;
1349
+ sdkVersion?: string;
1350
+ integrationType?: string;
1510
1351
  /**
1511
- * Specifies the merchant's domain for Apple Pay domain validation.
1512
- * If not provided, defaults to window.location.hostname.
1513
- * This is particularly useful when the checkout is hosted on a different domain
1514
- * than the merchant's registered Apple Pay domain.
1515
- *
1516
- * @default window.location.hostname
1352
+ * Merchant domain for Apple Pay integration
1353
+ * Required if the SDK is rendered inside an iframe
1517
1354
  */
1518
1355
  merchantDomain?: string;
1519
1356
  /**
1520
- * Configuration for redirect-based payment methods.
1521
- *
1522
- * Controls the return URL behavior for payment methods that require a redirect
1523
- * to an external page (e.g. PayPal, Klarna, and most APMs), whether to force
1524
- * a full-page redirect instead of opening the flow in a popup where supported,
1525
- * and how to handle users closing the redirect popup.
1526
- *
1527
- * @example
1528
- * ```typescript
1529
- * redirect: {
1530
- * returnUrl: 'https://merchant.example.com/checkout/return',
1531
- * forceRedirect: true,
1532
- * }
1533
- * ```
1357
+ * Redirect options
1534
1358
  */
1535
1359
  redirect?: {
1536
1360
  /**
@@ -1541,233 +1365,136 @@ export interface PrimerCheckoutOptions {
1541
1365
  * redirect the customer to an external page. The SDK throws at initialization
1542
1366
  * if a redirect-capable payment method is enabled and this is
1543
1367
  * missing.
1544
- *
1545
- * **Setting up the return page**
1546
- *
1547
- * The URL you provide must host a page that mounts the
1548
- * `<primer-checkout>` component again so the payment can be
1549
- * resumed. Primer redirects the customer back with a new client
1550
- * token appended as a `clientToken` query parameter — read it
1551
- * from the URL and pass it to the component:
1552
- *
1553
- * ```html
1554
- * <primer-checkout client-token=""></primer-checkout>
1555
- * <script>
1556
- * const clientToken = new URLSearchParams(window.location.search)
1557
- * .get('clientToken');
1558
- * document
1559
- * .querySelector('primer-checkout')
1560
- * .setAttribute('client-token', clientToken);
1561
- * </script>
1562
- * ```
1563
- *
1564
- * The SDK reads the intent embedded in the token, detects that
1565
- * this is a return-from-redirect, and resumes the payment
1566
- * automatically — no separate method call is required.
1567
- *
1568
1368
  */
1569
1369
  returnUrl: string;
1570
1370
  /**
1571
- * Whether to force a full-page redirect for payment methods that would
1572
- * otherwise open in a popup.
1573
- *
1371
+ * Force redirect flow for all supported payment methods
1574
1372
  * @default false
1575
1373
  */
1576
1374
  forceRedirect?: boolean;
1577
- };
1578
- /**
1579
- * Configuration for card payment method options.
1580
- * Controls the display and validation of card form fields.
1581
- */
1582
- card?: {
1583
1375
  /**
1584
- * Configuration for the cardholder name input field.
1376
+ * Whether to try resuming the payment when the redirect popup is closed by the user.
1377
+ * If false, the payment method will be deselected, allowing the user to select a different payment method.
1378
+ * @default false
1585
1379
  */
1586
- cardholderName?: {
1587
- /**
1588
- * Whether the cardholder name field is required for form validation.
1589
- * When true, form submission is blocked until a valid name is entered.
1590
- *
1591
- * Note: When using legacy SDK (`sdkCore: false`) with `visible: false`,
1592
- * this is automatically set to `false` for compatibility.
1593
- *
1594
- * @default false
1595
- */
1596
- required?: boolean;
1597
- defaultValue?: string;
1598
- /**
1599
- * Whether the cardholder name field is visible in the card form.
1600
- * When false, the field is hidden and not included in validation.
1601
- *
1602
- * @default true
1603
- */
1604
- visible?: boolean;
1605
- };
1380
+ resumePaymentOnPopupClosure?: boolean;
1606
1381
  };
1607
1382
  /**
1608
- * Configuration options for Apple Pay button and payment flow.
1609
- *
1610
- * Controls button appearance, billing/shipping contact field collection,
1611
- * and shipping method requirements. The SDK manages button rendering automatically,
1612
- * so the `container` property is omitted from this configuration.
1613
- *
1614
- * @see ApplePayOptions - Full type definition in compatibility-types.ts
1615
- * @example
1616
- * ```typescript
1617
- * applePay: {
1618
- * buttonStyle: 'black',
1619
- * buttonType: 'buy',
1620
- * billingOptions: {
1621
- * requiredBillingContactFields: ['postalAddress', 'emailAddress']
1622
- * },
1623
- * shippingOptions: {
1624
- * requiredShippingContactFields: ['postalAddress', 'name'],
1625
- * requireShippingMethod: true
1626
- * }
1627
- * }
1628
- * ```
1383
+ * Fires once at SDK init with the initial set of available payment methods.
1629
1384
  */
1630
- applePay?: Omit<ApplePayOptions, "container"> & {
1631
- /**
1632
- * @deprecated Use `billingOptions.requiredBillingContactFields: ['postalAddress']` instead.
1633
- *
1634
- * Legacy option to capture billing address for Apple Pay.
1635
- * This property is maintained for backward compatibility.
1636
- */
1637
- captureBillingAddress?: boolean;
1638
- /**
1639
- * Billing contact field configuration for Apple Pay.
1640
- */
1641
- billingOptions?: {
1642
- /**
1643
- * Array of billing contact fields required for checkout.
1644
- *
1645
- * Valid values: `'emailAddress'`, `'name'`, `'phoneNumber'`, `'postalAddress'`, `'phoneticName'`
1646
- *
1647
- * @example ['postalAddress', 'emailAddress']
1648
- */
1649
- requiredBillingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
1650
- };
1651
- /**
1652
- * Shipping contact field and method configuration for Apple Pay.
1653
- */
1654
- shippingOptions?: {
1655
- /**
1656
- * Array of shipping contact fields required for checkout.
1657
- *
1658
- * Valid values: `'emailAddress'`, `'name'`, `'phoneNumber'`, `'postalAddress'`, `'phoneticName'`
1659
- *
1660
- * @example ['postalAddress', 'name', 'phoneNumber']
1661
- */
1662
- requiredShippingContactFields?: Array<"emailAddress" | "name" | "phoneNumber" | "postalAddress" | "phoneticName">;
1663
- /**
1664
- * Whether to require shipping method selection during Apple Pay checkout.
1665
- *
1666
- * When true, customer must select a shipping method before completing payment.
1667
- *
1668
- * @default false
1669
- */
1670
- requireShippingMethod?: boolean;
1671
- };
1672
- };
1385
+ onAvailablePaymentMethodsLoad?: (info: PaymentMethodInfo[]) => void;
1386
+ /**
1387
+ * Fires after each successful `refreshClientSession` when the available
1388
+ * payment methods have changed (added or removed) as a result of the backend
1389
+ * re-evaluating visibility rules against the updated client session metadata.
1390
+ * The `info` array reflects the current set in backend order.
1391
+ */
1392
+ onAvailablePaymentMethodsRefresh?: (info: PaymentMethodInfo[]) => void;
1393
+ onCheckoutComplete?: (data: {
1394
+ payment: Payment | null;
1395
+ }) => void;
1396
+ onCheckoutFail?: (error: SdkError, data: {
1397
+ payment?: Payment;
1398
+ }, handler?: {
1399
+ showErrorMessage: (errorMessage?: string) => void;
1400
+ }) => void;
1401
+ onBeforePaymentCreate?: (data: {
1402
+ paymentMethodType?: PaymentMethodType;
1403
+ }, handler: {
1404
+ continuePaymentCreation: (data?: {
1405
+ idempotencyKey?: string;
1406
+ }) => void;
1407
+ abortPaymentCreation: () => void;
1408
+ }) => void;
1409
+ onPaymentMethodAction?: (data: "PAYMENT_METHOD_SELECTED" | "PAYMENT_METHOD_UNSELECTED", handler: {
1410
+ paymentMethodType: PaymentMethodType | null;
1411
+ payment?: Payment;
1412
+ }) => void;
1413
+ onPaymentCreationStart?: () => void;
1414
+ onClientSessionUpdate?: (data: ClientConfiguration["clientSession"]) => void;
1415
+ /**
1416
+ * MANUAL approval flow: invoked when `:pay` returns 202 and the attempt is
1417
+ * awaiting merchant approval. The merchant sends clientSessionId +
1418
+ * paymentAttemptId to its backend (which calls /approve or /abort), then
1419
+ * calls continueFlow() to resume the SDK.
1420
+ */
1421
+ onPaymentApprovalRequired?: (data: PaymentApprovalRequiredData) => void;
1673
1422
  /**
1674
- * Options for using gift cards as a payment method
1423
+ * MANUAL approval recovery: invoked on init when an in-flight attempt is found
1424
+ * on the configuration response (i.e. the checkout is resuming after a refresh
1425
+ * / tab reload), before the recovery does any async work. The host uses this
1426
+ * to enter its processing state so the loading UI persists while the outcome
1427
+ * is resolved. Not fired for a fresh checkout (no attempt in flight).
1675
1428
  */
1429
+ onCheckoutResume?: () => void;
1430
+ }
1431
+ export interface KlarnaPaymentMethodCategory {
1432
+ id: string;
1433
+ name: string;
1434
+ descriptiveAssetUrl: string;
1435
+ standardAssetUrl: string;
1436
+ }
1437
+ export interface CardSecurityCodeInputOptions {
1438
+ ariaLabel?: string;
1439
+ container: string | Element | HTMLElement;
1440
+ id?: string;
1441
+ name?: string;
1442
+ placeholder?: string;
1443
+ placement?: "append" | "prepend";
1444
+ properties?: unknown;
1445
+ style?: any;
1446
+ cardNetwork?: string;
1447
+ }
1448
+ export interface InputMetadata {
1449
+ errorCode: string | null;
1450
+ error: string | null;
1451
+ valid: boolean;
1452
+ active: boolean;
1453
+ dirty: boolean;
1454
+ touched: boolean;
1455
+ submitted: boolean;
1456
+ }
1457
+ export interface PrimerCheckoutOptions extends Omit<CreateHeadlessOptions, "dialogProvider"> {
1676
1458
  giftCard?: {
1677
- /**
1678
- * The source URL of the button logo.
1679
- */
1680
1459
  logoSrc: string;
1681
- /**
1682
- * The background color of the button.
1683
- */
1684
1460
  background: string;
1685
- /**
1686
- * An alternative text for the button logo.
1687
- */
1688
1461
  logoAlt?: string;
1689
- /**
1690
- * The text to display on the button.
1691
- */
1692
1462
  text?: string;
1693
1463
  };
1694
1464
  /**
1695
- * Configuration options for Google Pay button and payment flow.
1696
- *
1697
- * When `sdkCore: true` (default), uses `GooglePayClientOptions` from SDK Core with
1698
- * full express checkout support including:
1699
- * - Button customization (`buttonType`, `buttonColor`, `buttonSizeMode`, `buttonRadius`, `buttonLocale`)
1700
- * - Billing/shipping address capture
1701
- * - Email collection
1702
- * - Shipping method selection
1703
- *
1704
- * When `sdkCore: false`, uses legacy `GooglePayOptions` with basic button styling.
1705
- *
1706
- * @example
1707
- * ```typescript
1708
- * // SDK Core mode (recommended)
1709
- * googlePay: {
1710
- * buttonType: 'checkout',
1711
- * buttonColor: 'white',
1712
- * buttonSizeMode: 'fill',
1713
- * buttonRadius: 8,
1714
- * captureBillingAddress: true,
1715
- * captureShippingAddress: true,
1716
- * emailRequired: true,
1717
- * requireShippingMethod: true,
1718
- * }
1719
- *
1720
- * // Legacy mode (sdkCore: false)
1721
- * googlePay: {
1722
- * buttonType: 'buy',
1723
- * buttonColor: 'black',
1724
- * captureBillingAddress: true,
1725
- * }
1726
- * ```
1727
- */
1728
- googlePay?: GooglePayClientOptions | Omit<GooglePayOptions, "container">;
1729
- /**
1730
- * Configuration options for PayPal button and payment flow.
1731
- *
1732
- * Controls button styling, size, and payment flow behavior.
1733
- * The SDK manages button rendering automatically, so the `container`
1734
- * property is omitted from this configuration.
1735
- *
1736
- * @see PayPalOptions - Full type definition in compatibility-types.ts
1737
- * @example
1738
- * ```typescript
1739
- * paypal: {
1740
- * buttonColor: 'gold',
1741
- * buttonShape: 'pill',
1742
- * buttonLabel: 'pay',
1743
- * paymentFlow: 'PREFER_VAULT'
1744
- * }
1745
- * ```
1746
- */
1747
- paypal?: Omit<PayPalOptions, "container">;
1748
- /**
1749
- * Configuration options for Klarna payment method.
1750
- *
1751
- * Controls payment flow, allowed payment categories (pay now/later/over time),
1752
- * and button customization for Klarna installment payments.
1753
- *
1754
- * @see KlarnaOptions - Full type definition in compatibility-types.ts
1755
- * @example
1756
- * ```typescript
1757
- * klarna: {
1758
- * paymentFlow: 'DEFAULT',
1759
- * allowedPaymentCategories: ['pay_now', 'pay_later'],
1760
- * buttonOptions: {
1761
- * text: 'Pay with Klarna'
1762
- * }
1763
- * }
1764
- * ```
1465
+ * Configuration for the submit button behavior in Primer.js components.
1765
1466
  */
1766
- klarna?: KlarnaOptions;
1767
- adyenKlarna?: {
1768
- buttonOptions?: {
1769
- text?: string;
1770
- };
1467
+ submitButton?: {
1468
+ /**
1469
+ * Whether to show the order amount on the submit button.
1470
+ * When true, displays formatted amount next to button text (e.g., "Pay $12.34").
1471
+ * @default false
1472
+ */
1473
+ amountVisible?: boolean;
1474
+ /**
1475
+ * Whether to render the built-in submit button component.
1476
+ *
1477
+ * When `true` (default): The component renders the standard Primer submit button.
1478
+ * When `false`: No DOM elements are created, allowing external buttons to handle
1479
+ * form submission by dispatching the 'primer:card-submit' event.
1480
+ *
1481
+ * @example
1482
+ * // Hide built-in button and use external button
1483
+ * const options = {
1484
+ * submitButton: {
1485
+ * useBuiltInButton: false
1486
+ * }
1487
+ * };
1488
+ *
1489
+ * // External button should dispatch this event to submit
1490
+ * const submitEvent = new CustomEvent('primer:card-submit', {
1491
+ * bubbles: true,
1492
+ * composed: true
1493
+ * });
1494
+ *
1495
+ * @default true
1496
+ */
1497
+ useBuiltInButton?: boolean;
1771
1498
  };
1772
1499
  /**
1773
1500
  * Configuration for payment method vaulting (save for later use).
@@ -1839,105 +1566,6 @@ export interface PrimerCheckoutOptions {
1839
1566
  */
1840
1567
  headless?: boolean;
1841
1568
  };
1842
- /**
1843
- * Configuration options for Stripe ACH payment method.
1844
- *
1845
- * Provides Stripe-specific settings for ACH bank account payments,
1846
- * including mandate text and authorization requirements.
1847
- *
1848
- * Note: Only applicable when Stripe ACH is enabled as a payment method.
1849
- */
1850
- stripe?: {
1851
- /**
1852
- * Mandate data for ACH authorization and compliance.
1853
- *
1854
- * ACH payments require customer authorization (mandate) for bank account debits.
1855
- * This configuration controls the mandate text displayed to customers.
1856
- */
1857
- mandateData: {
1858
- /**
1859
- * Custom mandate text for ACH authorization.
1860
- *
1861
- * When provided, overrides default mandate language.
1862
- * Must comply with ACH authorization requirements.
1863
- *
1864
- * @example "I authorize [Merchant Name] to debit my bank account for the amount shown."
1865
- */
1866
- fullMandateText?: string;
1867
- /**
1868
- * Merchant name displayed in the mandate authorization text.
1869
- *
1870
- * Used in default mandate language when `fullMandateText` is not provided.
1871
- * Should match the legal business name for compliance.
1872
- *
1873
- * @example "Acme Corporation Inc."
1874
- */
1875
- merchantName?: string;
1876
- };
1877
- /**
1878
- * Stripe publishable API key for client-side operations.
1879
- *
1880
- * Required for Stripe ACH functionality. Obtain from Stripe Dashboard.
1881
- * Use the publishable key (starts with `pk_`), not the secret key.
1882
- *
1883
- * @example "pk_test_51H..."
1884
- */
1885
- publishableKey?: string;
1886
- } & Record<string, unknown>;
1887
- /**
1888
- * Configuration for the submit button behavior in Primer.js components.
1889
- */
1890
- submitButton?: {
1891
- /**
1892
- * Whether to show the order amount on the submit button.
1893
- * When true, displays formatted amount next to button text (e.g., "Pay $12.34").
1894
- * @default false
1895
- */
1896
- amountVisible?: boolean;
1897
- /**
1898
- * Whether to render the built-in submit button component.
1899
- *
1900
- * When `true` (default): The component renders the standard Primer submit button.
1901
- * When `false`: No DOM elements are created, allowing external buttons to handle
1902
- * form submission by dispatching the 'primer:card-submit' event.
1903
- *
1904
- * @example
1905
- * // Hide built-in button and use external button
1906
- * const options = {
1907
- * submitButton: {
1908
- * useBuiltInButton: false
1909
- * }
1910
- * };
1911
- *
1912
- * // External button should dispatch this event to submit
1913
- * const submitEvent = new CustomEvent('primer:card-submit', {
1914
- * bubbles: true,
1915
- * composed: true
1916
- * });
1917
- *
1918
- * @default true
1919
- */
1920
- useBuiltInButton?: boolean;
1921
- };
1922
- /**
1923
- * Controls which SDK engine is used for payment processing.
1924
- *
1925
- * - `true` or `undefined`: Uses SDK Core engine (recommended) - modern architecture with better performance
1926
- * - `false`: Uses legacy SDK engine (primer-sdk-web) - maintained for backward compatibility only
1927
- *
1928
- * SDK Core provides:
1929
- * - Improved performance and reliability
1930
- * - Better error handling and validation
1931
- * - Newer payment method features
1932
- * - Active development and feature updates
1933
- *
1934
- * Legacy SDK is maintained for backward compatibility but receives only critical bug fixes.
1935
- * New integrations should use SDK Core (leave this option undefined or set to true).
1936
- *
1937
- * @default true
1938
- * @remarks Setting to false may result in different cardholder name handling for compatibility
1939
- */
1940
- sdkCore?: boolean;
1941
1569
  /**
1942
1570
  * Globally disables all payment method interactions in drop-in mode.
1943
1571
  *
@@ -1960,100 +1588,58 @@ export interface PrimerCheckoutOptions {
1960
1588
  * ```
1961
1589
  */
1962
1590
  disabledPayments?: boolean;
1963
- /**
1964
- * Specifies which payment methods are enabled and displayed in the checkout.
1965
- *
1966
- * By default, only `PaymentMethodType.PAYMENT_CARD` is enabled.
1967
- * Configure this to enable specific payment methods for your checkout flow.
1968
- *
1969
- * Available payment methods include: `PAYMENT_CARD`, `APPLE_PAY`, `GOOGLE_PAY`,
1970
- * `PAYPAL`, `KLARNA`, `ADYEN_BLIK`, and many regional payment options.
1971
- *
1972
- * @default [PaymentMethodType.PAYMENT_CARD]
1973
- * @see PaymentMethodType - Full enum of available payment method types
1974
- * @example
1975
- * ```typescript
1976
- * // Enable card and digital wallets
1977
- * enabledPaymentMethods: [
1978
- * PaymentMethodType.PAYMENT_CARD,
1979
- * PaymentMethodType.APPLE_PAY,
1980
- * PaymentMethodType.GOOGLE_PAY,
1981
- * PaymentMethodType.PAYPAL
1982
- * ]
1983
- *
1984
- * // Enable card and BLIK (Poland)
1985
- * enabledPaymentMethods: [
1986
- * PaymentMethodType.PAYMENT_CARD,
1987
- * PaymentMethodType.ADYEN_BLIK
1988
- * ]
1989
- * ```
1990
- */
1991
- enabledPaymentMethods?: typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.PAYPAL | (typeof PaymentMethodType.ADYEN_BLIK)[];
1992
1591
  }
1993
1592
  /**
1994
- * Native payment method types (sent with managerType: 'NATIVE' from server)
1995
- */
1996
- export type NativePaymentMethodTypes = typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK;
1997
- /**
1998
- * Payment methods that use the REDIRECT manager type.
1999
- *
2000
- * This type excludes payment methods with specialized manager types:
2001
- * - STRIPE_ACH: Uses ACH manager
2002
- * - PAYMENT_CARD: Uses CARD manager
2003
- * - KLARNA: Uses KLARNA manager
2004
- * - ADYEN_KLARNA: Uses ADYEN_KLARNA manager
2005
- * - PAYPAL, GOOGLE_PAY, APPLE_PAY: Use NATIVE manager
2006
- * - ADYEN_BLIK: Uses BLIK manager
2007
- * - ADYEN_MBWAY: Uses MBWAY manager
2008
- *
2009
- * All other payment methods use the REDIRECT manager by default.
1593
+ * Payment methods that use the REDIRECT manager type i.e. every
1594
+ * PaymentMethodType not handled by a specialized manager (CARD, ACH, KLARNA,
1595
+ * ADYEN_KLARNA, NATIVE, BLIK, MBWAY, QRCODE).
2010
1596
  */
2011
- export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType, typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.ADYEN_KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK | typeof PaymentMethodType.ADYEN_MBWAY>;
1597
+ export type RedirectPaymentMethodTypes = Exclude<PaymentMethodType, typeof PaymentMethodType.STRIPE_ACH | typeof PaymentMethodType.PAYMENT_CARD | typeof PaymentMethodType.KLARNA | typeof PaymentMethodType.ADYEN_KLARNA | typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY | typeof PaymentMethodType.ADYEN_BLIK | typeof PaymentMethodType.ADYEN_MBWAY | typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.XFERS_PAYNOW | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY>;
2012
1598
  /**
2013
- * Represents a payment method that uses the REDIRECT manager.
2014
- *
2015
- * REDIRECT payment methods typically involve redirecting the user to an external
2016
- * page for authorization. However, some REDIRECT payment methods (like BLIK)
2017
- * use custom inline UI components while still being classified as REDIRECT type
2018
- * due to their flow characteristics (status polling, external authorization).
1599
+ * A payment method that authorizes by redirecting the user to an external page.
2019
1600
  */
2020
1601
  export interface RedirectPaymentMethod {
2021
1602
  type: RedirectPaymentMethodTypes;
2022
1603
  managerType: HeadlessManagerType.REDIRECT;
2023
- manager: IRedirectPaymentMethodManager;
1604
+ manager: RedirectPaymentMethodManager;
2024
1605
  }
2025
1606
  export interface NativePaymentMethod {
2026
1607
  type: typeof PaymentMethodType.PAYPAL | typeof PaymentMethodType.GOOGLE_PAY | typeof PaymentMethodType.APPLE_PAY;
2027
1608
  managerType: HeadlessManagerType.NATIVE;
2028
- manager: INativePaymentMethodManager;
1609
+ manager: NativePaymentMethodManager;
2029
1610
  }
2030
1611
  export interface BlikPaymentMethod {
2031
1612
  type: typeof PaymentMethodType.ADYEN_BLIK;
2032
1613
  managerType: HeadlessManagerType.BLIK;
2033
- manager: IBlikPaymentMethodManager;
1614
+ manager: BlikPaymentMethodManager;
2034
1615
  }
2035
1616
  export interface MbwayPaymentMethod {
2036
1617
  type: typeof PaymentMethodType.ADYEN_MBWAY;
2037
1618
  managerType: HeadlessManagerType.MBWAY;
2038
- manager: IMbwayPaymentMethodManager;
1619
+ manager: MbwayPaymentMethodManager;
1620
+ }
1621
+ export interface QRCodePaymentMethod {
1622
+ type: typeof PaymentMethodType.ADYEN_BANCONTACT_PAYCONIQ | typeof PaymentMethodType.OMISE_PROMPTPAY | typeof PaymentMethodType.RAPYD_PROMPTPAY | typeof PaymentMethodType.XFERS_PAYNOW;
1623
+ managerType: HeadlessManagerType.QRCODE;
1624
+ manager: QRCodePaymentMethodManager;
2039
1625
  }
2040
1626
  export type InitializedPaymentMethod = {
2041
1627
  type: typeof PaymentMethodType.STRIPE_ACH;
2042
1628
  managerType: HeadlessManagerType.ACH;
2043
- manager: IAchPaymentMethodManager;
1629
+ manager: AchPaymentMethodManager;
2044
1630
  } | {
2045
1631
  type: typeof PaymentMethodType.PAYMENT_CARD;
2046
1632
  managerType: HeadlessManagerType.CARD;
2047
- manager: ICardPaymentMethodManager;
1633
+ manager: CardPaymentMethodManager;
2048
1634
  } | {
2049
1635
  type: typeof PaymentMethodType.KLARNA;
2050
1636
  managerType: HeadlessManagerType.KLARNA;
2051
- manager: IKlarnaPaymentMethodManager;
1637
+ manager: KlarnaPaymentMethodManager;
2052
1638
  } | {
2053
1639
  type: typeof PaymentMethodType.ADYEN_KLARNA;
2054
1640
  managerType: HeadlessManagerType.ADYEN_KLARNA;
2055
- manager: IAdyenKlarnaPaymentMethodManager;
2056
- } | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | NativePaymentMethod;
1641
+ manager: AdyenKlarnaPaymentMethodManager;
1642
+ } | QRCodePaymentMethod | BlikPaymentMethod | MbwayPaymentMethod | RedirectPaymentMethod | NativePaymentMethod;
2057
1643
  export interface AssetsConfig {
2058
1644
  backgroundColor: string;
2059
1645
  name: string;
@@ -2076,7 +1662,7 @@ export interface VaultManagerState {
2076
1662
  enabled: boolean;
2077
1663
  isLoading: boolean;
2078
1664
  isUpdating: boolean;
2079
- vaultedPaymentMethods: VaultedPaymentMethod[];
1665
+ vaultedPaymentMethods: VaultListItem[];
2080
1666
  cvvRecapture: boolean;
2081
1667
  showEmptyState: boolean;
2082
1668
  headless: boolean;
@@ -2094,8 +1680,8 @@ export interface VaultManagerItemState {
2094
1680
  formIsDirty: boolean;
2095
1681
  cvvInput: CvvInput | null;
2096
1682
  setCvvInput: (metadata: CvvInput | null) => void;
2097
- selectedVaultedPaymentMethod: VaultedPaymentMethod | null;
2098
- setSelectedVaultedPaymentMethod: (paymentMethod: VaultedPaymentMethod | null) => void;
1683
+ selectedVaultedPaymentMethod: VaultListItem | null;
1684
+ setSelectedVaultedPaymentMethod: (paymentMethod: VaultListItem | null) => void;
2099
1685
  }
2100
1686
  export type KlarnaCategoriesContextType = {
2101
1687
  categories: KlarnaPaymentMethodCategory[];
@@ -2119,17 +1705,13 @@ export type CardNetworksContextType = {
2119
1705
  */
2120
1706
  export type SdkState = {
2121
1707
  isSuccessful: boolean;
2122
- isProcessing: boolean;
2123
1708
  /**
2124
- * MANUAL approval-mode flag: a `:pay` attempt has been created and is
2125
- * awaiting merchant approval (202 response). Drives the loading UI while
2126
- * the merchant approves/aborts. Distinct from `isProcessing` ("a payment is
2127
- * being created/processed") because the downstream locking and continueFlow
2128
- * functionalities need to tell the two phases apart.
2129
- * Exactly one of `isProcessing` / `isAwaitingApproval` is true at a time.
2130
- * Exited by continueFlow()/safety polling.
1709
+ * A payment is being created/processed, or a MANUAL `:pay` attempt is
1710
+ * awaiting merchant approval (202 response). Stays true across both phases
1711
+ * so the loading UI shows and the session stays locked from payment-method
1712
+ * change/resubmission until continueFlow()/safety polling resolves it.
2131
1713
  */
2132
- isAwaitingApproval: boolean;
1714
+ isProcessing: boolean;
2133
1715
  /**
2134
1716
  * SDK/component initialization errors.
2135
1717
  * This represents errors from the Primer JS layer itself (e.g., configuration errors,
@@ -2159,7 +1741,7 @@ export type ContextType = {
2159
1741
  events?: PrimerEventsController;
2160
1742
  clientOptions?: PrimerCheckoutOptions;
2161
1743
  paymentMethods: InitializedPaymentMethod[];
2162
- headlessUtils?: HeadlessSDKUtilities;
1744
+ headlessUtils?: SDKUtilities;
2163
1745
  sdkState: SdkState;
2164
1746
  vaultManager?: VaultManagerState;
2165
1747
  vaultItem?: VaultManagerItemState;
@@ -2258,7 +1840,7 @@ declare class VaultManagerController implements ReactiveController {
2258
1840
  /**
2259
1841
  * Fetch vaulted payment methods from the server
2260
1842
  */
2261
- fetchVaultedPaymentMethods(initialLoad?: boolean): Promise<VaultedPaymentMethod[]>;
1843
+ fetchVaultedPaymentMethods(initialLoad?: boolean): Promise<VaultListItem[]>;
2262
1844
  createCvvInput: (options: CardSecurityCodeInputOptions) => Promise<CvvInput | null>;
2263
1845
  /**
2264
1846
  * Delete a vaulted payment method by ID
@@ -2277,7 +1859,7 @@ declare class VaultManagerController implements ReactiveController {
2277
1859
  /**
2278
1860
  * Set the selected vaulted payment method - updates form state only
2279
1861
  */
2280
- setSelectedVaultedPaymentMethod: (paymentMethod: VaultedPaymentMethod | null) => void;
1862
+ setSelectedVaultedPaymentMethod: (paymentMethod: VaultListItem | null) => void;
2281
1863
  /**
2282
1864
  * Start vaulted payment flow by payment method ID
2283
1865
  * @param paymentMethodId - The ID of the vaulted payment method
@@ -2916,22 +2498,15 @@ declare class HeadlessSdkController implements ReactiveController {
2916
2498
  get primerJSInstance(): PrimerJS | null;
2917
2499
  hostConnected(): void;
2918
2500
  hostDisconnected(): void;
2919
- /**
2920
- * Normalizes options for legacy SDK compatibility.
2921
- * When cardholder name is visible in Primer.js, it should be required in the legacy SDK
2922
- * regardless of user's required setting, to ensure proper validation behavior.
2923
- */
2924
- private normalizeOptionsForLegacySdk;
2925
2501
  private setupLoadingTimeout;
2926
2502
  private clearLoadingTimeout;
2927
2503
  private cleanupResources;
2928
- private _loadV2Sdk;
2929
2504
  /**
2930
- * MANUAL approval flow: on a `:pay` 202, sdk-core invokes this. Enter the
2931
- * awaiting-approval state (so the checkout shows its loading UI while the
2932
- * merchant approves/aborts), then surface the approval request to the
2933
- * merchant. State is set BEFORE dispatching so listeners that synchronously
2934
- * read state see `isAwaitingApproval: true`.
2505
+ * MANUAL approval flow: on a `:pay` 202, sdk-core invokes this. Keep the SDK
2506
+ * in the processing state (so the checkout shows its loading UI and stays
2507
+ * locked while the merchant approves/aborts), then surface the approval
2508
+ * request to the merchant. State is set BEFORE dispatching so listeners that
2509
+ * synchronously read state see `isProcessing: true`.
2935
2510
  */
2936
2511
  private handlePaymentApprovalRequired;
2937
2512
  initializeHeadless(): ([clientToken, options]: readonly [
@@ -3640,68 +3215,9 @@ declare global {
3640
3215
  "primer-klarna": PrimerKlarnaComponent;
3641
3216
  }
3642
3217
  }
3643
- /**
3644
- * Google Pay component with shadow root rendering for full-width button support.
3645
- *
3646
- * Google Pay requires special rendering logic:
3647
- * - Renders directly to shadow root (not button container)
3648
- * - Does NOT render .native-button-container div
3649
- * - Passes shadowRoot: true in render options
3650
- * - Requires retry logic for async button rendering
3651
- */
3652
- declare class GooglePayComponent extends LitElement {
3653
- static styles: import("lit").CSSResult[];
3654
- paymentMethod: NativePaymentMethod | undefined;
3655
- primerContext?: ContextType;
3656
- disabled: boolean;
3657
- private renderButtonTask;
3658
- constructor();
3659
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
3660
- protected updated(changedProperties: PropertyValues): void;
3661
- render(): symbol;
3662
- }
3663
- declare global {
3664
- interface HTMLElementTagNameMap {
3665
- "primer-google-pay": GooglePayComponent;
3666
- }
3667
- }
3668
- /**
3669
- * Apple Pay component with standard button container rendering.
3670
- *
3671
- * Apple Pay uses the standard button container approach:
3672
- * - Renders to a button container div (not shadow root)
3673
- * - Passes buttonHeight in render options
3674
- * - Uses updateOverlayForContainer for disabled state
3675
- * - Simpler than Google Pay's shadow root approach
3676
- */
3677
- declare class ApplePayComponent extends LitElement {
3678
- static styles: import("lit").CSSResult[];
3679
- paymentMethod: NativePaymentMethod | undefined;
3680
- primerContext?: ContextType;
3681
- disabled: boolean;
3682
- private buttonContainerRef;
3683
- private renderButtonTask;
3684
- constructor();
3685
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
3686
- protected updated(changedProperties: PropertyValues): void;
3687
- render(): import("lit-html").TemplateResult<1>;
3688
- }
3689
- declare global {
3690
- interface HTMLElementTagNameMap {
3691
- "primer-apple-pay": ApplePayComponent;
3692
- }
3693
- }
3694
- /**
3695
- * PayPal component with standard button container rendering.
3696
- *
3697
- * PayPal uses the standard button container approach:
3698
- * - Renders to a button container div (not shadow root)
3699
- * - Passes buttonHeight in render options (sdk-core constrains to 25-55px)
3700
- * - Uses updateOverlayForContainer for disabled state
3701
- * - Height is calculated from CSS (PAYMENT_METHOD_LINE_HEIGHT + padding)
3702
- */
3703
- declare class PayPalComponent extends LitElement {
3218
+ declare class NativePaymentComponent extends LitElement {
3704
3219
  static styles: import("lit").CSSResult[];
3220
+ type: PaymentMethodType | undefined;
3705
3221
  paymentMethod: NativePaymentMethod | undefined;
3706
3222
  primerContext?: ContextType;
3707
3223
  disabled: boolean;
@@ -3709,14 +3225,9 @@ declare class PayPalComponent extends LitElement {
3709
3225
  private renderButtonTask;
3710
3226
  constructor();
3711
3227
  attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
3712
- protected updated(changedProperties: PropertyValues): void;
3228
+ protected willUpdate(changedProperties: PropertyValues): void;
3713
3229
  render(): import("lit-html").TemplateResult<1>;
3714
3230
  }
3715
- declare global {
3716
- interface HTMLElementTagNameMap {
3717
- "primer-paypal": PayPalComponent;
3718
- }
3719
- }
3720
3231
  /**
3721
3232
  * BLIK Payment Component
3722
3233
  *
@@ -3871,21 +3382,41 @@ declare global {
3871
3382
  "primer-adyen-mbway": AdyenMbwayComponent;
3872
3383
  }
3873
3384
  }
3874
- declare class PaymentMethodComponent extends LitElement {
3385
+ declare class QRCodeComponent extends LitElement {
3875
3386
  static styles: import("lit").CSSResult[];
3876
- type: PaymentMethodType | undefined;
3387
+ paymentMethod: QRCodePaymentMethod | undefined;
3877
3388
  disabled: boolean;
3878
3389
  primerContext?: ContextType;
3390
+ private isExpanded;
3391
+ private isLoading;
3392
+ private qrCodeUrl;
3393
+ disconnectedCallback(): void;
3394
+ private handleExpandedChange;
3395
+ private loadQRCode;
3879
3396
  /**
3880
- * Sends PAYMENT_METHOD_SELECTION analytics event when user clicks on payment method
3881
- * @private
3397
+ * Reset state on failures.
3882
3398
  */
3883
- private sendPaymentMethodSelectionEvent;
3399
+ willUpdate(changed: PropertyValues): void;
3400
+ private renderQRCode;
3401
+ render(): import("lit-html").TemplateResult<1>;
3402
+ }
3403
+ declare global {
3404
+ interface HTMLElementTagNameMap {
3405
+ "primer-qrcode": QRCodeComponent;
3406
+ }
3407
+ }
3408
+ declare class PaymentMethodComponent extends LitElement {
3409
+ static styles: import("lit").CSSResult[];
3410
+ type: PaymentMethodType | undefined;
3411
+ disabled: boolean;
3412
+ primerContext?: ContextType;
3413
+ private isActive;
3884
3414
  /**
3885
3415
  * Handle interaction events on payment method component
3886
3416
  * @private
3887
3417
  */
3888
3418
  private handleClick;
3419
+ updated(): void;
3889
3420
  render(): import("lit-html").TemplateResult<1> | typeof nothing;
3890
3421
  }
3891
3422
  declare global {
@@ -4308,7 +3839,7 @@ declare class VaultPaymentMethodItemComponent extends LitElement {
4308
3839
  /**
4309
3840
  * The payment method to display
4310
3841
  */
4311
- paymentMethod: VaultedPaymentMethod | undefined;
3842
+ paymentMethod: VaultListItem | undefined;
4312
3843
  /**
4313
3844
  * Whether the component is in edit mode
4314
3845
  */
@@ -4504,7 +4035,7 @@ declare global {
4504
4035
  declare class VaultCvvInputComponent extends LitElement {
4505
4036
  static styles: import("lit").CSSResult[];
4506
4037
  primerContext?: ContextType;
4507
- paymentMethod: PaymentCardVaultedMethod | null;
4038
+ paymentMethod: CardVaultedPaymentMethodSummary | null;
4508
4039
  private cvvError;
4509
4040
  private cvvInputIsDirty;
4510
4041
  private cvvInputIsBlurred;
@@ -4762,7 +4293,7 @@ export interface HostedInputConfig {
4762
4293
  /**
4763
4294
  * Possible input source types that can be returned by getHostedInput
4764
4295
  */
4765
- export type InputSource = IHeadlessHostedInput | "cardholderName" | undefined;
4296
+ export type InputSource = HostedInput | "cardholderName" | undefined;
4766
4297
  declare class HostedInputController<T extends HostedInputHost> implements ReactiveController {
4767
4298
  private _meta;
4768
4299
  private _hostedInput;
@@ -4860,10 +4391,10 @@ export interface IHostedInputController {
4860
4391
  focusInput(): void;
4861
4392
  }
4862
4393
  export interface CardFormContext {
4863
- cardNumberInput: IHeadlessHostedInput;
4864
- cardholderNameInput?: IHeadlessHostedInput;
4865
- expiryInput: IHeadlessHostedInput;
4866
- cvvInput: IHeadlessHostedInput;
4394
+ cardNumberInput: HostedInput;
4395
+ cardholderNameInput?: HostedInput;
4396
+ expiryInput: HostedInput;
4397
+ cvvInput: HostedInput;
4867
4398
  setCardholderName: (val: string) => void;
4868
4399
  setCardNetwork: (val: string) => void;
4869
4400
  validate: () => Promise<Validation>;
@@ -5282,6 +4813,11 @@ declare global {
5282
4813
  "primer-show-other-payments": ShowOtherPaymentsComponent;
5283
4814
  }
5284
4815
  }
4816
+ declare global {
4817
+ interface HTMLElementTagNameMap {
4818
+ "primer-native-payment": NativePaymentComponent;
4819
+ }
4820
+ }
5285
4821
  declare class PaymentMethodAccordionComponent extends LitElement {
5286
4822
  static styles: import("lit").CSSResult[];
5287
4823
  type: PaymentMethodType | undefined;
@@ -5292,6 +4828,11 @@ declare class PaymentMethodAccordionComponent extends LitElement {
5292
4828
  * Used when payment flows open external popups (e.g. Klarna).
5293
4829
  */
5294
4830
  suppressBlurCollapse: boolean;
4831
+ /**
4832
+ * When true, the accordion ignores every collapse trigger (button toggle,
4833
+ * outside click, window blur).
4834
+ */
4835
+ loading: boolean;
5295
4836
  connectedCallback(): void;
5296
4837
  disconnectedCallback(): void;
5297
4838
  private _handleDocumentClick;
@@ -5386,7 +4927,6 @@ export declare function loadPrimer(): void;
5386
4927
 
5387
4928
  export {
5388
4929
  AdyenMbwayComponent as AdyenMbway,
5389
- ApplePayComponent as ApplePay,
5390
4930
  BillingAddressComponent as BillingAddress,
5391
4931
  BlikComponent as Blik,
5392
4932
  ButtonComponent as Button,
@@ -5397,7 +4937,6 @@ export {
5397
4937
  DialogComponent as Dialog,
5398
4938
  ErrorMessageComponent as ErrorMessage,
5399
4939
  ErrorMessageContainerComponent as ErrorMessageContainer,
5400
- GooglePayComponent as GooglePay,
5401
4940
  InputCardExpiryComponent as CardFormExpiry,
5402
4941
  InputCardHolderNameComponent as CardFormName,
5403
4942
  InputCardNumberComponent as CardFormCardNumber,
@@ -5406,7 +4945,7 @@ export {
5406
4945
  InputErrorComponent as CardFormError,
5407
4946
  InputLabelComponent as InputLabel,
5408
4947
  InputWrapperComponent as InputWrapper,
5409
- PayPalComponent as PayPal,
4948
+ NativePaymentComponent as NativePayment,
5410
4949
  PaymentMethodAccordionComponent as PaymentMethodAccordion,
5411
4950
  PaymentMethodAccordionConfirmButtonComponent as PaymentMethodAccordionConfirmButton,
5412
4951
  PaymentMethodButtonComponent as PaymentMethodButton,
@@ -5420,6 +4959,7 @@ export {
5420
4959
  PrimerKlarnaComponent as PrimerKlarna,
5421
4960
  PrimerMainComponent as PrimerMain,
5422
4961
  PtPhoneNumberInputComponent as PtPhoneNumberInput,
4962
+ QRCodeComponent as QRCode,
5423
4963
  RedirectPaymentComponent as RedirectPayment,
5424
4964
  SelectComponent as Select,
5425
4965
  ShowOtherPaymentsComponent as ShowOtherPayments,