@payrails/web-sdk 5.46.1 → 5.48.0-RC-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/payrails.d.ts CHANGED
@@ -1,1243 +1,1287 @@
1
- declare const UI_POSITION_FIELD = "ui:position";
2
-
3
- type JSONSchemaType = JSONSchemaProperty & {
4
- required?: string[];
5
- dependentSchemas?: Record<string, JSONSchemaDependentSchema>;
6
- };
7
- interface JSONSchemaDependentSchema {
8
- oneOf: Array<{
9
- properties: Record<string, {
10
- const: string | number;
11
- }>;
12
- required: string[];
13
- }>;
1
+ interface BinLookupResponse {
2
+ bin: string;
3
+ network: string;
4
+ issuer?: string;
5
+ issuerCountry?: {
6
+ code?: string;
7
+ name?: string;
8
+ iso3?: string;
9
+ };
10
+ type?: string;
14
11
  }
15
- interface JSONSchemaProperty {
16
- type?: 'string' | 'number' | 'boolean' | 'array' | 'object';
17
- title?: string;
18
- oneOf?: JSONSchemaOneOfOption[];
19
- pattern?: string;
20
- minLength?: number;
21
- maxLength?: number;
22
- errorMessage?: Record<string, string>;
23
- $ref?: string;
24
- [UI_POSITION_FIELD]?: number;
25
- properties?: Record<string, JSONSchemaType>;
12
+
13
+ declare enum RedactionType {
14
+ DEFAULT = "DEFAULT",
15
+ PLAIN_TEXT = "PLAIN_TEXT",
16
+ MASKED = "MASKED",
17
+ REDACTED = "REDACTED"
26
18
  }
27
- interface JSONSchemaOneOfOption {
28
- const: string | number;
29
- title: string;
19
+ declare enum RequestMethod$1 {
20
+ GET = "GET",
21
+ POST = "POST",
22
+ PUT = "PUT",
23
+ PATCH = "PATCH",
24
+ DELETE = "DELETE"
30
25
  }
31
- interface JSONSchemaOneOfOption {
32
- const: string | number;
33
- title: string;
26
+ declare enum EventName {
27
+ CHANGE = "CHANGE",
28
+ READY = "READY",
29
+ FOCUS = "FOCUS",
30
+ BLUR = "BLUR",
31
+ SUBMIT = "SUBMIT"
34
32
  }
35
- interface DynamicElementEvents {
36
- onReady: () => void;
37
- onValidationChange: (isValid: boolean) => void;
33
+ declare enum LogLevel {
34
+ WARN = "WARN",
35
+ INFO = "INFO",
36
+ DEBUG = "DEBUG",
37
+ ERROR = "ERROR"
38
38
  }
39
- interface DynamicElementFieldTranslation {
40
- label?: string;
41
- placeholder?: string;
42
- errors?: Partial<DynamicElementErrorTranslation>;
39
+ declare enum Env {
40
+ DEV = "DEV",
41
+ PROD = "PROD"
43
42
  }
44
- interface DynamicElementErrorTranslation {
45
- required: string;
46
- minLength: string;
47
- maxLength: string;
48
- pattern: string;
49
- oneOf: string;
43
+ declare enum ValidationRuleType {
44
+ REGEX_MATCH_RULE = "REGEX_MATCH_RULE",
45
+ LENGTH_MATCH_RULE = "LENGTH_MATCH_RULE",
46
+ ELEMENT_VALUE_MATCH_RULE = "ELEMENT_VALUE_MATCH_RULE"
50
47
  }
51
- type DynamicElementTranslations = {
52
- fields?: Record<string, DynamicElementFieldTranslation>;
53
- errors?: Partial<DynamicElementErrorTranslation>;
54
- };
55
- interface DynamicElementElementStyles {
56
- base?: Partial<CSSStyleDeclaration>;
57
- complete?: Partial<CSSStyleDeclaration>;
58
- empty?: Partial<CSSStyleDeclaration>;
59
- focus?: Partial<CSSStyleDeclaration>;
60
- invalid?: Partial<CSSStyleDeclaration>;
48
+ interface IInsertRecordInput {
49
+ records: IInsertRecord[];
61
50
  }
62
- type DynamicElementInputFieldStyles = DynamicElementElementStyles;
63
- type DynamicElementSelectFieldStyles = DynamicElementElementStyles;
64
- interface DynamicElementTabsFieldStyles {
65
- tab: {
66
- base?: Partial<CSSStyleDeclaration>;
67
- active?: Partial<CSSStyleDeclaration>;
68
- };
69
- container?: DynamicElementElementStyles;
51
+ interface IInsertRecord {
52
+ table: string;
53
+ fields: Record<string, any>;
54
+ skyflowID?: string;
70
55
  }
71
- interface DynamicElementFieldStyles {
72
- base?: Partial<CSSStyleDeclaration>;
73
- label?: Partial<CSSStyleDeclaration>;
74
- errors?: Partial<CSSStyleDeclaration>;
75
- input?: DynamicElementInputFieldStyles;
76
- select?: DynamicElementSelectFieldStyles;
77
- tabs?: DynamicElementTabsFieldStyles;
56
+ interface Context {
57
+ logLevel: LogLevel;
58
+ env: Env;
78
59
  }
79
- interface DynamicElementStyles {
80
- all: Omit<DynamicElementFieldStyles, 'label'>;
81
- fields?: Record<string, DynamicElementFieldStyles>;
60
+ interface IValidationRule {
61
+ type: ValidationRuleType;
62
+ params: any;
82
63
  }
83
64
 
84
- declare enum PAYMENT_METHOD_CODES {
85
- 'CARD' = "card",
86
- 'GOOGLE_PAY' = "googlePay",
87
- 'PAYPAL' = "payPal",
88
- 'APPLE_PAY' = "applePay",
89
- 'GENERIC_REDIRECT' = "genericRedirect",
90
- 'LEAN' = "lean",
91
- 'MERCADO_PAGO' = "mercadoPago",
92
- 'PIX' = "pix",
93
- 'BANK_ACCOUNT' = "bankAccount",
94
- 'IDEAL' = "iDeal",
95
- 'YAPE' = "yape",
96
- 'UPI' = "upi",
97
- 'KLARNA' = "klarna",
98
- 'ONE_VOUCHER' = "1voucher",
99
- 'ALFA' = "alfa",
100
- 'APLAZO' = "aplazo",
101
- 'BANK_TRANSFER' = "bankTransfer",
102
- 'CAPITEC_PAY' = "capitecPay",
103
- 'EASYPAISA' = "easypaisa",
104
- 'EFT_PRO' = "eftPro",
105
- 'FAWRY_PAY' = "fawryPay",
106
- 'JAZZ_CASH' = "jazzCash",
107
- 'KONNECT' = "konnect",
108
- 'KUESKI' = "kueski",
109
- 'MONO_DIRECT_DEBIT' = "monoDirectDebit",
110
- 'O_PAY_WALLET' = "oPayWallet",
111
- 'PAGA_WALLET' = "pagaWallet",
112
- 'PAYFLEX' = "payflex",
113
- 'PAY_JUST_NOW' = "payjustnow",
114
- 'WAFA_CASH_WALLET' = "wafaCashWallet",
115
- 'MERCADO_PAGO_WALLET' = "mercadoPagoWallet",
116
- 'MERCADO_PAGO_CONSUMER_CREDIT' = "mercadoPagoConsumerCredit",
117
- 'NET_BANKING' = "netBanking",
118
- 'CASH_FREE_WALLET' = "cashFreeWallet",
119
- 'PAYTM_WALLET' = "paytmWallet",
120
- 'NIBSS_PAY' = "nibssPay",
121
- 'NIBSS_INSTANT_PAY' = "nibssInstantPay",
122
- 'MEEZA_WALLET' = "meezaWallet",
123
- 'VODAFONE_CASH' = "vodafoneCash",
124
- 'SEPA_DIRECT_DEBIT' = "sepaDirectDebit",
125
- 'MODO' = "modo",
126
- 'PAYZONE_CASH' = "payzoneCash",
127
- 'REVOLUT_PAY' = "revolutPay"
65
+ interface IUpsertOptions {
66
+ table: string;
67
+ column: string;
128
68
  }
129
- declare const PAYMENT_METHOD_CODE_BY_METHOD: { readonly [K in keyof typeof PAYMENT_METHOD_CODES]: (typeof PAYMENT_METHOD_CODES)[K]; };
130
- type PaymentMethodCode = PAYMENT_METHOD_CODES | (typeof PAYMENT_METHOD_CODE_BY_METHOD)[keyof typeof PAYMENT_METHOD_CODE_BY_METHOD] | (string & {});
131
- declare enum PAYMENT_INSTRUMENT_STATUS {
132
- 'ENABLED' = "enabled",
133
- 'CREATED' = "created",
134
- 'DELETED' = "deleted",
135
- 'DISABLED' = "disabled",
136
- 'INVALID' = "invalid",
137
- 'TRANSIENT' = "transient"
69
+
70
+ declare enum ElementType$1 {
71
+ CVV = "CVV",
72
+ EXPIRATION_DATE = "EXPIRATION_DATE",
73
+ CARD_NUMBER = "CARD_NUMBER",
74
+ CARDHOLDER_NAME = "CARDHOLDER_NAME",
75
+ INPUT_FIELD = "INPUT_FIELD",
76
+ PIN = "PIN",
77
+ EXPIRATION_MONTH = "EXPIRATION_MONTH",
78
+ EXPIRATION_YEAR = "EXPIRATION_YEAR"
138
79
  }
139
- type ExecutionMetaKey = keyof ExecutionMetaByKey;
140
- interface ExecutionMetaCustomer {
141
- phone?: {
142
- countryCode?: string;
143
- number?: string;
144
- };
145
- country?: {
146
- name?: string;
147
- code?: string;
148
- iso3?: string;
149
- };
150
- reference?: string;
151
- name?: string;
152
- lastName?: string;
153
- email?: string;
154
- type?: string;
155
- birthDate?: string;
156
- language?: string;
157
- identityCardNumber?: string;
80
+
81
+ declare abstract class Container {
158
82
  }
159
- interface ExecutionMetaOrder {
160
- billingAddress?: {
161
- country?: {
162
- name?: string;
163
- code?: string;
164
- iso3?: string;
165
- };
166
- };
83
+
84
+ declare class EventEmitter {
85
+ events: Record<string, {
86
+ priority: boolean;
87
+ callback: Function;
88
+ }[]>;
89
+ constructor();
90
+ on(event: string, callback: Function, priority?: boolean): void;
91
+ off(event: string, callback: Function): void;
92
+ _emit(event: string, ...args: any[]): void;
93
+ hasListener(event: string): boolean;
94
+ resetEvents(): void;
95
+ static createChild(ChildObject: any): void;
167
96
  }
168
- type ExecutionMetaByKey = {
169
- customer: ExecutionMetaCustomer;
170
- };
171
- type ExecutionMetaUpdate = {
172
- [Key in ExecutionMetaKey]: {
173
- key: Key;
174
- value: ExecutionMetaByKey[Key];
175
- };
176
- }[ExecutionMetaKey];
177
- interface ExecutionMeta {
178
- customer?: ExecutionMetaCustomer;
179
- order?: ExecutionMetaOrder;
97
+
98
+ declare abstract class SkyflowElement {
99
+ abstract mount(domElementSelector: any): any;
100
+ abstract unmount(): any;
101
+ abstract setError(clientErrorText: string): any;
102
+ abstract resetError(): any;
103
+ abstract iframeName(): any;
104
+ abstract getID(): any;
180
105
  }
181
- declare class WorkflowExecution {
182
- private static _updatedMetaKeys;
183
- private static _response;
184
- static get response(): WorkflowExecutionResponse;
185
- static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
186
- static get workflowCode(): string;
187
- static get lookup(): {
188
- httpCode: number;
189
- body: {
190
- data: {
191
- paymentCompositionOptions?: Array<StorablePaymentCompositionOption>;
192
- payoutCompositionOptions?: Array<StorablePaymentCompositionOption>;
193
- };
194
- links: {
195
- execution: string;
196
- authorize?: {
197
- href: string;
198
- method: "POST";
199
- };
200
- payout?: {
201
- href: string;
202
- method: "POST";
203
- };
204
- startPaymentSession?: {
205
- href: string;
206
- method: "POST";
207
- };
208
- createInstrument?: {
209
- href: string;
210
- method: "POST";
211
- };
212
- };
213
- name: "lookup";
214
- };
215
- } | undefined;
216
- static get holderReference(): string;
217
- static get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
218
- static get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
219
- static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
220
- static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
221
- static get paypalConfig(): PayPalConfig;
222
- static get googlePayConfig(): any;
223
- static isPaymentMethodAvailable(paymentMethod: PaymentMethodCode): boolean;
224
- static get applePayConfig(): {
225
- merchantIdentifier: string;
226
- supportedNetworks: string[];
227
- countryCode: string;
228
- merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
229
- requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
230
- requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
231
- };
232
- static get url(): string;
233
- static get meta(): ExecutionMeta;
234
- static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined>[];
235
- static get authorizeLink(): string | undefined;
236
- static get payoutLink(): string | undefined;
237
- static get createSessionLink(): string | undefined;
238
- static get createInstrumentLink(): string | undefined;
239
- static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
240
- static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
241
- static getFullPaymentMethodConfig(paymentMethod: PaymentMethodCode): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayConfig | undefined> | undefined;
242
- static isAddressSelectorEnabled(paymentMethod: PaymentMethodCode): boolean | undefined;
243
- static isPaymentInstallmentsEnabled(paymentMethod: PaymentMethodCode): boolean | undefined;
244
- static getPaymentInstallmentOptions(paymentMethod: PaymentMethodCode): PaymentInstallmentsConfig;
245
- static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PaymentMethodCode): Array<StoredPaymentInstrument<T>>;
246
- static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
247
- id: string;
248
- description?: string;
249
- status: PAYMENT_INSTRUMENT_STATUS;
250
- integrationType: INTEGRATION_TYPE;
251
- config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
252
- clientConfig?: {
253
- flow?: PAYMENT_CLIENT_FLOW;
254
- displayName?: string;
255
- supportsInstallments?: boolean;
256
- installments?: PaymentInstallmentsConfig;
257
- supportsBillingInfo?: boolean;
258
- schema?: JSONSchemaType;
259
- additionalConfig?: any;
260
- instrumentDataSchema?: JSONSchemaType;
261
- };
262
- payoutInstruments?: StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined;
263
- paymentMethodCode: PaymentMethodCode;
264
- payoutMethodCode?: PaymentMethodCode;
265
- } | undefined;
266
- static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
267
- id: string;
268
- description?: string;
269
- status: PAYMENT_INSTRUMENT_STATUS;
270
- integrationType: INTEGRATION_TYPE;
271
- config: ApplePayConfig | PayPalConfig | GooglePayConfig | undefined;
272
- clientConfig?: {
273
- flow?: PAYMENT_CLIENT_FLOW;
274
- displayName?: string;
275
- supportsInstallments?: boolean;
276
- installments?: PaymentInstallmentsConfig;
277
- supportsBillingInfo?: boolean;
278
- schema?: JSONSchemaType;
279
- additionalConfig?: any;
280
- instrumentDataSchema?: JSONSchemaType;
281
- };
282
- payoutInstruments?: StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined;
283
- paymentMethodCode: PaymentMethodCode;
284
- payoutMethodCode?: PaymentMethodCode;
285
- };
286
- static updateInstallmentOptions(installmentOptions?: PaymentInstallmentsConfig): void;
287
- static updateMeta<K extends ExecutionMetaKey>(key: K, value: ExecutionMetaByKey[K]): void;
288
- static getAllowedMeta(): ExecutionMeta;
289
- static getUpdatedMeta(): ExecutionMeta;
290
- private static pickMetaByKeys;
291
- }
292
- interface WorkflowExecutionResponse {
293
- id: string;
294
- merchantReference: string;
295
- holderReference: string;
296
- holderId?: string;
297
- actionRequired?: string;
298
- meta: ExecutionMeta;
299
- status: Array<{
300
- code: string;
301
- time: string;
302
- }>;
303
- initialResults: Array<{
304
- httpCode: number;
305
- body: {
306
- data: {
307
- paymentCompositionOptions?: Array<StorablePaymentCompositionOption>;
308
- payoutCompositionOptions?: Array<StorablePaymentCompositionOption>;
309
- };
310
- links: {
311
- execution: string;
312
- authorize?: {
313
- href: string;
314
- method: 'POST';
315
- };
316
- payout?: {
317
- href: string;
318
- method: 'POST';
319
- };
320
- startPaymentSession?: {
321
- href: string;
322
- method: 'POST';
323
- };
324
- createInstrument?: {
325
- href: string;
326
- method: 'POST';
327
- };
328
- };
329
- name: 'lookup';
330
- };
331
- }>;
332
- links: {
333
- startPaymentSession?: {
334
- href: string;
335
- method: 'POST';
336
- };
337
- createInstrument?: {
338
- href: string;
339
- method: 'POST';
340
- };
341
- confirm?: {
342
- href: string;
343
- action?: {
344
- parameters?: {
345
- orderId?: string;
346
- tokenId?: string;
347
- };
348
- paymentId?: string;
349
- sdkToken?: string;
350
- appToken?: string;
351
- successUrl?: string;
352
- failureUrl?: string;
353
- sandbox?: boolean;
354
- };
355
- };
356
- redirect?: string;
357
- '3ds'?: string;
358
- self: string;
359
- };
360
- workflow: {
361
- code: string;
362
- version: number;
106
+
107
+ declare class CollectElement extends SkyflowElement {
108
+ #private;
109
+ elementType: string;
110
+ type: string;
111
+ containerId: string;
112
+ constructor(elementId: string, elementGroup: any, metaData: any, container: any, isSingleElementAPI: boolean | undefined, destroyCallback: Function, updateCallback: Function, context: Context, groupEventEmitter?: EventEmitter);
113
+ getID: () => string;
114
+ mount: (domElement: any) => void;
115
+ unmount: () => void;
116
+ update: (group: any) => void;
117
+ updateElement: (elementOptions: any) => void;
118
+ getState: () => {
119
+ isEmpty: boolean;
120
+ isComplete: boolean;
121
+ isValid: boolean;
122
+ isFocused: boolean;
123
+ value: string | Object | Blob | undefined;
124
+ required: boolean;
363
125
  };
126
+ getOptions: () => any;
127
+ on(eventName: string, handler: any): void;
128
+ iframeName(): string;
129
+ isMounted(): boolean;
130
+ isValidElement(): boolean;
131
+ setError(clientErrorText: string): void;
132
+ resetError(): void;
133
+ setValue(elementValue: string): void;
134
+ clearValue(): void;
135
+ setAttribute(attribute: string, value: string | number): void;
136
+ focus(): void;
364
137
  }
365
- interface BasePaymentMethodConfig {
366
- paymentMethodCode: PaymentMethodCode;
367
- payoutMethodCode?: PaymentMethodCode;
138
+
139
+ interface CollectElementInput$1 {
140
+ table?: string;
141
+ column?: string;
142
+ inputStyles?: object;
143
+ label?: string;
144
+ labelStyles?: object;
145
+ errorTextStyles?: object;
146
+ placeholder?: string;
147
+ type: ElementType$1;
148
+ altText?: string;
149
+ validations?: IValidationRule[];
150
+ skyflowID?: string;
368
151
  }
369
- interface BaseInstallmentOption {
370
- count: number;
371
- amount: number;
152
+ interface ICollectOptions$1 {
153
+ tokens?: boolean;
154
+ additionalFields?: IInsertRecordInput;
155
+ upsert?: Array<IUpsertOptions>;
372
156
  }
373
- interface PaymentInstallmentsConfig {
374
- [key: string]: BaseInstallmentOption[];
157
+ declare class CollectContainer extends Container {
158
+ #private;
159
+ type: string;
160
+ private bus;
161
+ private iframe;
162
+ constructor(options: any, metaData: any, skyflowElements: any, context: any);
163
+ create: (input: CollectElementInput$1, options?: any) => CollectElement;
164
+ validate: () => Promise<unknown>;
165
+ collect: (options?: ICollectOptions$1) => Promise<unknown>;
166
+ reset(): void;
167
+ unmount: () => void;
375
168
  }
376
- interface InstallmentUpdateConfig {
377
- defaultInstallment?: number | null;
378
- installmentCountry?: string | null;
379
- installmentOptions?: BaseInstallmentOption[] | null;
169
+
170
+ /**
171
+ * Descriptor for a custom font to be injected or referenced by the card/secure-fields iframes.
172
+ *
173
+ * This mirrors Stripe-like font configuration where you can provide either a CSS URL that
174
+ * includes @font-face declarations (cssSrc) or provide full @font-face fields to be injected.
175
+ *
176
+ * Examples:
177
+ * - { cssSrc: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap' }
178
+ * - { family: 'Inter', src: 'https://cdn.example.com/fonts/Inter.woff2', weight: 400, style: 'normal', display: 'swap' }
179
+ */
180
+ interface FontDescriptor {
181
+ cssSrc?: string;
182
+ family?: string;
183
+ src?: string;
184
+ style?: string;
185
+ weight?: string | number;
186
+ unicodeRange?: string;
187
+ display?: string;
380
188
  }
381
- interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayConfig> extends BasePaymentMethodConfig {
382
- id: string;
383
- description?: string;
384
- status: PAYMENT_INSTRUMENT_STATUS;
385
- integrationType: INTEGRATION_TYPE;
386
- config: C;
387
- clientConfig?: {
388
- flow?: PAYMENT_CLIENT_FLOW;
389
- displayName?: string;
390
- supportsInstallments?: boolean;
391
- installments?: PaymentInstallmentsConfig;
392
- supportsBillingInfo?: boolean;
393
- schema?: JSONSchemaType;
394
- additionalConfig?: any;
395
- instrumentDataSchema?: JSONSchemaType;
396
- };
397
- paymentInstruments?: Array<StoredPaymentInstrument<I>>;
398
- payoutInstruments?: Array<StoredPaymentInstrument<I>>;
189
+
190
+ declare class ComposableElement {
191
+ #private;
192
+ type: string;
193
+ constructor(name: any, eventEmitter: any);
194
+ on(eventName: string, handler: any): void;
195
+ focus(): void;
196
+ update: (options: any) => void;
197
+ setAttribute(attribute: string, value: string | number): void;
399
198
  }
400
- interface GooglePayConfig {
401
- parameters: {
402
- allowedAuthMethods: google.payments.api.CardAuthMethod[];
403
- allowedCardNetworks: google.payments.api.CardNetwork[];
404
- billingAddressParameters?: {
405
- format?: string;
406
- };
407
- billingAddressRequired?: boolean;
408
- };
409
- tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
410
- type: google.payments.api.PaymentMethodType;
411
- apiVersion?: number;
412
- apiVersionMinor?: number;
413
- allowedPaymentMethods?: google.payments.api.PaymentMethodSpecification[];
414
- emailRequired?: boolean;
415
- shippingAddressRequired?: boolean;
416
- shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
417
- merchantInfo?: google.payments.api.MerchantInfo;
418
- existingPaymentMethodRequired?: boolean;
199
+
200
+ /**
201
+ * Configuration interface for creating collect elements
202
+ * Defines the structure and styling options for form input elements
203
+ */
204
+ interface CollectElementInput {
205
+ table?: string;
206
+ column?: string;
207
+ inputStyles?: object;
208
+ label?: string;
209
+ labelStyles?: object;
210
+ errorTextStyles?: object;
211
+ placeholder?: string;
212
+ type: ElementType$1;
213
+ altText?: string;
214
+ validations?: IValidationRule[];
215
+ skyflowID?: string;
419
216
  }
420
- interface PayPalConfig {
421
- clientId: string;
422
- merchantId: string;
423
- captureMode: 'Delayed' | 'Instant' | 'Manual';
424
- integrationMode: 'express' | 'normal';
217
+ /**
218
+ * Options interface for the collect operation
219
+ * Controls how data is collected and processed
220
+ */
221
+ interface ICollectOptions {
222
+ tokens?: boolean;
223
+ additionalFields?: IInsertRecordInput;
224
+ upsert?: Array<IUpsertOptions>;
425
225
  }
426
- interface ApplePayConfig {
427
- parameters: {
428
- merchantIdentifier: string;
429
- supportedNetworks: string[];
430
- countryCode: string;
431
- merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
432
- requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
433
- requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
434
- };
226
+ /**
227
+ * ComposableContainer class - Main container for managing secure form elements
228
+ *
229
+ * This class extends the base Container and provides functionality to:
230
+ * - Create and manage secure iframe-based form elements
231
+ * - Handle secure communication between parent and iframe contexts
232
+ * - Collect and tokenize sensitive data while maintaining PCI compliance
233
+ * - Manage element lifecycle (create, mount, validate, collect, destroy)
234
+ */
235
+ declare class ComposableContainer extends Container {
236
+ #private;
435
237
  type: string;
238
+ private bus;
239
+ private iframe;
240
+ /**
241
+ * Constructor - Initializes the composable container
242
+ *
243
+ * Sets up the secure iframe, establishes communication channels,
244
+ * and prepares the container for element creation and management.
245
+ *
246
+ * @param options - Container configuration (layout, styles, etc.)
247
+ * @param metaData - Client metadata and configuration
248
+ * @param skyflowElements - Global elements registry
249
+ * @param context - Application context with logging and config
250
+ */
251
+ constructor(options: any, metaData: any, skyflowElements: any, context: any);
252
+ /**
253
+ * Creates a new composable form element
254
+ *
255
+ * This method creates a secure form element (like card number, CVV, etc.)
256
+ * that will be rendered inside the secure iframe. The element is added to
257
+ * the container's element list but not yet mounted to the DOM.
258
+ *
259
+ * @param input - Element configuration (type, styles, validations, etc.)
260
+ * @param options - Additional options like required field validation
261
+ * @returns ComposableElement instance for further configuration
262
+ */
263
+ create: (input: CollectElementInput, options?: any) => ComposableElement;
264
+ /**
265
+ * Registers an event listener for container events
266
+ *
267
+ * Allows the application to listen for events like form submission,
268
+ * validation errors, or other container-level events.
269
+ *
270
+ * @param eventName - The name of the event to listen for
271
+ * @param handler - The callback function to execute when the event occurs
272
+ */
273
+ on: (eventName: string, handler: any) => void;
274
+ /**
275
+ * Mounts the container and its elements to a DOM element
276
+ *
277
+ * This method organizes the created elements according to the specified layout,
278
+ * applies styling, and renders them within the provided DOM element.
279
+ * The elements are rendered inside secure iframes for PCI compliance.
280
+ *
281
+ * @param domElement - The DOM element where the form should be mounted
282
+ */
283
+ mount: (domElement: any) => void;
284
+ /**
285
+ * Mounts the container element to the DOM and triggers a mounted event
286
+ *
287
+ * This method mounts the container element to the specified DOM element
288
+ * and then emits an event to notify the SDK that the container has been mounted.
289
+ *
290
+ * @param domElement - The DOM element where the container should be mounted
291
+ */
292
+ mountContainerElement: (domElement: string) => void;
293
+ /**
294
+ * Unmounts the container and cleans up all resources
295
+ *
296
+ * This method removes all elements from the DOM, clears internal state,
297
+ * and removes the iframe to prevent memory leaks.
298
+ */
299
+ unmount: () => void;
300
+ /**
301
+ * Validates all elements in the container
302
+ *
303
+ * Checks that all elements are mounted and triggers validation
304
+ * in the secure iframe. Returns a promise that resolves with
305
+ * validation results.
306
+ *
307
+ * @returns Promise that resolves with validation results
308
+ */
309
+ validate: () => Promise<unknown>;
310
+ /**
311
+ * Collects data from all elements in the container
312
+ *
313
+ * This method securely collects sensitive data from all mounted elements,
314
+ * validates the data, and optionally tokenizes it. The actual data collection
315
+ * happens within the secure iframe to maintain PCI compliance.
316
+ *
317
+ * @param options - Collection options (tokenization, additional fields, etc.)
318
+ * @returns Promise that resolves with collected/tokenized data
319
+ */
320
+ collect: (options?: ICollectOptions) => Promise<unknown>;
321
+ /**
322
+ * Resets all form elements to their initial state
323
+ *
324
+ * Clears all input values and resets validation states
325
+ * by sending a reset command to the secure iframe.
326
+ */
327
+ reset(): void;
436
328
  }
437
- interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata | BankAccountMetadata> {
438
- id: string;
439
- status: PAYMENT_INSTRUMENT_STATUS;
440
- paymentMethod: PaymentMethodCode;
441
- displayName?: string;
442
- data?: T;
443
- default?: boolean;
444
- createdAt?: string;
445
- updatedAt?: string;
446
- holderId?: string;
447
- fingerprint?: string;
448
- futureUsage?: FutureUsages;
449
- }
450
- interface PayPalMetadata {
451
- email?: string;
452
- }
453
- interface Country {
454
- code: string;
455
- name: string;
456
- iso3: string;
329
+
330
+ declare enum ContainerType {
331
+ COLLECT = "COLLECT",
332
+ COMPOSABLE = "COMPOSABLE"
457
333
  }
458
- interface CardMetadata {
459
- bin?: string;
460
- suffix?: string;
461
- network?: string;
462
- binLookup?: {
463
- issuerCountry: Country;
464
- };
334
+ interface ISkyflow {
335
+ vaultID?: string;
336
+ vaultURL?: string;
337
+ getBearerToken: () => Promise<string>;
338
+ options?: Record<string, any>;
465
339
  }
466
- interface BankAccountMetadata {
467
- bankAccount: {
468
- holder: HolderData;
469
- bank: BankData;
470
- account: AccountData;
471
- };
340
+ declare class Skyflow {
341
+ #private;
342
+ private bus;
343
+ constructor(config: ISkyflow);
344
+ static init(config: ISkyflow): Skyflow;
345
+ container(type: ContainerType, options?: Record<string, any>): CollectContainer | ComposableContainer;
346
+ static get ContainerType(): typeof ContainerType;
347
+ static get ElementType(): typeof ElementType$1;
348
+ static get RedactionType(): typeof RedactionType;
349
+ static get RequestMethod(): typeof RequestMethod$1;
350
+ static get LogLevel(): typeof LogLevel;
351
+ static get EventName(): typeof EventName;
352
+ static get Env(): typeof Env;
353
+ static get ValidationRuleType(): typeof ValidationRuleType;
472
354
  }
473
- interface HolderData {
474
- firstName?: string;
475
- lastName?: string;
476
- companyName?: string;
477
- address?: Address;
478
- email?: string;
479
- dob?: string;
480
- country?: Country;
481
- city?: string;
482
- type: HolderType;
355
+
356
+ type IframeEventBusLike = {
357
+ emit: (...args: any[]) => unknown;
358
+ on: (...args: any[]) => unknown;
359
+ off?: (...args: any[]) => unknown;
360
+ };
361
+ interface Mountable {
362
+ mount(selector: string | PayrailsElement): void;
363
+ unmount(): void;
483
364
  }
484
- type HolderType = 'individual' | 'corporate';
485
- interface BankData {
486
- name?: string;
487
- branchCode?: string;
488
- code?: string;
489
- address?: Address;
490
- swiftCode?: string;
365
+ interface ElementOptions {
366
+ id?: string;
367
+ dataTestId?: string;
368
+ className?: string | string[];
369
+ styles?: Partial<CSSStyleDeclaration>;
491
370
  }
492
- interface AccountData {
493
- number?: string;
494
- iban?: string;
495
- currency?: string;
496
- type?: AccountType;
497
- country?: Country;
371
+ declare class PayrailsElement implements Mountable {
372
+ protected element: HTMLElement;
373
+ protected subElements: Array<Mountable>;
374
+ readonly id: string | undefined;
375
+ readonly dataTestId: string | undefined;
376
+ protected eventBus: IframeEventBusLike;
377
+ constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
378
+ get parentElement(): HTMLElement | null;
379
+ get selector(): string;
380
+ mount(location: string): void;
381
+ protected clean(): void;
382
+ unmount(): void;
498
383
  }
499
- type AccountType = 'savings' | 'current';
500
- interface Address {
501
- country?: {
502
- code?: string;
503
- fullName?: string;
504
- iso3?: string;
505
- };
506
- postalCode?: string;
384
+
385
+ interface TokenizeOptions {
386
+ futureUsage?: FutureUsages;
387
+ storeInstrument?: boolean;
507
388
  }
508
- declare enum PAYMENT_CLIENT_FLOW {
509
- 'REDIRECT' = "redirect",
510
- 'DIRECT' = "direct",
511
- 'EMBEDDED' = "embedded"
389
+ declare abstract class Tokenizable extends PayrailsElement {
390
+ protected abstract collect(): Promise<any>;
391
+ protected abstract constructSaveInstrumentBody(tokens: any, opts?: TokenizeOptions): Promise<any>;
392
+ tokenize(_opts?: TokenizeOptions): Promise<any>;
512
393
  }
513
- declare enum INTEGRATION_TYPE {
514
- API = "api",
515
- HPP = "hpp"
394
+
395
+ declare enum ElementType {
396
+ CARD_NUMBER = "CARD_NUMBER",
397
+ CARDHOLDER_NAME = "CARDHOLDER_NAME",
398
+ CVV = "CVV",
399
+ EXPIRATION_MONTH = "EXPIRATION_MONTH",
400
+ EXPIRATION_YEAR = "EXPIRATION_YEAR",
401
+ EXPIRATION_DATE = "EXPIRATION_DATE",
402
+ CARD_FORM = "CARD_FORM"
516
403
  }
517
404
 
518
- type FutureUsages = 'CardOnFile' | 'Subscription' | 'UnscheduledCardOnFile';
519
- interface SaveInstrumentResponse {
520
- id: string;
521
- createdAt: string;
522
- holderId: string;
523
- paymentMethod: PAYMENT_METHOD_CODES.CARD;
524
- status: PAYMENT_INSTRUMENT_STATUS;
525
- data: {
526
- bin: string;
527
- binLookup?: {
528
- bin: string;
529
- network: string;
530
- issuer?: string;
531
- issuerCountry?: {
532
- code?: string;
533
- name?: string;
534
- iso3?: string;
535
- };
536
- type?: string;
405
+ type FieldErrors = Partial<Record<'cardNumber' | 'expiry' | 'cvv' | 'holderName', string>>;
406
+ type ValidateCardFormResult = {
407
+ isValid: boolean;
408
+ error?: string;
409
+ fieldErrors?: FieldErrors;
410
+ };
411
+ interface EncryptedCollectResult {
412
+ vaultProviderConfigId: string;
413
+ encryptedData: string;
414
+ }
415
+ interface CollectElementOptions {
416
+ type: ElementType;
417
+ label?: string;
418
+ placeholder?: string;
419
+ altText?: string;
420
+ format?: string;
421
+ inputStyles?: object;
422
+ labelStyles?: object;
423
+ errorTextStyles?: object;
424
+ required?: boolean;
425
+ enableCardIcon?: boolean;
426
+ translations?: {
427
+ error?: {
428
+ default?: string;
537
429
  };
538
- holderName?: string;
539
- network: string;
540
- suffix: string;
541
- expiryMonth?: string;
542
- expiryYear?: string;
543
430
  };
544
- fingerprint?: string;
545
- futureUsage?: string;
546
431
  }
547
-
548
- interface SdkConfiguration {
549
- token: string;
550
- amount: PayrailsAmount;
551
- holderReference: string;
552
- links?: {
553
- binLookup?: Links;
554
- instrumentDelete?: Links;
555
- instrumentUpdate?: Links;
432
+ type PayrailsContainerType = 'COLLECT' | 'COMPOSABLE';
433
+ interface CollectContainerOptions {
434
+ layout?: number[];
435
+ cardTableName?: string;
436
+ containerType?: PayrailsContainerType;
437
+ containerId?: string;
438
+ styles?: {
439
+ base?: Partial<CSSStyleDeclaration>;
556
440
  };
557
- type?: 'tokenization' | 'dropIn' | 'secureFields';
558
- vaultConfiguration: {
559
- cardTableName: string;
560
- token: string;
561
- vaultId: string;
562
- vaultUrl: string;
563
- providerId: string;
564
- providerConfigId: string;
565
- vaultType: 'Payrails' | 'Test';
566
- encryptionPublicKey?: string;
567
- links: {
568
- saveInstrument: {
569
- href: string;
570
- };
571
- };
441
+ errorTextStyles?: {
442
+ base?: Partial<CSSStyleDeclaration>;
572
443
  };
573
- execution?: WorkflowExecutionResponse;
574
- featureConfig?: SdkFeatureConfig;
444
+ fonts?: FontDescriptor[];
575
445
  }
576
- interface SdkFeatureConfig {
577
- gpayIframeRollout?: number;
446
+ type PayrailsSecureFieldEvent = 'CHANGE' | 'FOCUS' | 'BLUR' | 'READY' | 'SUBMIT';
447
+ interface PayrailsSecureField {
448
+ on(eventName: PayrailsSecureFieldEvent, handler: any): void;
449
+ mount?: (domElement: any) => void;
450
+ unmount?: () => void;
451
+ focus: () => void;
452
+ getState?: () => {
453
+ isEmpty: boolean;
454
+ isComplete: boolean;
455
+ isValid: boolean;
456
+ isFocused: boolean;
457
+ value: unknown;
458
+ required: boolean;
459
+ };
460
+ setError?: (clientErrorText: string) => void;
461
+ resetError?: () => void;
462
+ update?: (data: Partial<CollectElementOptions>) => void;
463
+ setAttribute: (attribute: string, value: string | number) => void;
464
+ }
465
+ interface FramesContainer extends Mountable {
466
+ createCollectElement: (options: CollectElementOptions) => PayrailsSecureField;
467
+ fetchBinLookup: (bin: string) => Promise<{
468
+ bin: string;
469
+ }>;
470
+ validate: () => Promise<ValidateCardFormResult>;
471
+ collect: () => Promise<EncryptedCollectResult>;
472
+ tokenize: (opts: TokenizeOptions) => Promise<any>;
473
+ reset: () => void;
474
+ bin: string;
475
+ isBinLookupEnabled: boolean;
476
+ readonly id: string;
477
+ readonly dataTestId: string;
478
+ readonly className: string;
479
+ }
480
+ declare class PayrailsCollectContainer implements FramesContainer {
481
+ bin: string;
482
+ isBinLookupEnabled: boolean;
483
+ readonly id = "payrails-container-wrapper";
484
+ readonly dataTestId = "payrails-container-wrapper";
485
+ readonly className = "payrails-container-wrapper";
486
+ private static instance;
487
+ private readonly __container;
488
+ private element;
489
+ private readonly cardTableName;
490
+ private readonly containerType;
491
+ private manualErrorElements;
492
+ constructor(__client: Skyflow, options: CollectContainerOptions);
493
+ static init(vaultClient: Skyflow, options: CollectContainerOptions): PayrailsCollectContainer;
494
+ createCollectElement(options: CollectElementOptions): PayrailsSecureField;
495
+ mount(selector: string): void;
496
+ unmount(): void;
497
+ validate(): Promise<ValidateCardFormResult>;
498
+ collect(): Promise<EncryptedCollectResult>;
499
+ reset(): void;
500
+ private collectPayrailsData;
501
+ tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
502
+ private attachCustomEventHandler;
503
+ private formatBin;
504
+ private get elementToFieldMap();
505
+ fetchBinLookup: (bin: string) => Promise<BinLookupResponse | {
506
+ bin: string;
507
+ }>;
508
+ }
509
+
510
+ declare const UI_POSITION_FIELD = "ui:position";
511
+
512
+ type JSONSchemaType = JSONSchemaProperty & {
513
+ required?: string[];
514
+ dependentSchemas?: Record<string, JSONSchemaDependentSchema>;
515
+ };
516
+ interface JSONSchemaOneOfOption {
517
+ const: string | number;
518
+ title: string;
578
519
  }
579
- interface PayrailsAmount {
580
- value: string;
581
- currency: string;
520
+ interface JSONSchemaDependentSchema {
521
+ oneOf: Array<{
522
+ properties: Record<string, {
523
+ const: string | number;
524
+ }>;
525
+ required: string[];
526
+ }>;
582
527
  }
583
- interface LookupUpdateOptions {
584
- value?: string;
585
- currency?: string;
586
- installmentConfig?: InstallmentUpdateConfig | null;
587
- meta?: ExecutionMetaUpdate;
528
+ interface JSONSchemaProperty {
529
+ type?: 'string' | 'number' | 'boolean' | 'array' | 'object';
530
+ title?: string;
531
+ defaultValue?: string | number | boolean;
532
+ oneOf?: JSONSchemaOneOfOption[];
533
+ pattern?: string;
534
+ minLength?: number;
535
+ maxLength?: number;
536
+ errorMessage?: Record<string, string>;
537
+ $ref?: string;
538
+ [UI_POSITION_FIELD]?: number;
539
+ properties?: Record<string, JSONSchemaType>;
588
540
  }
589
- interface Links {
590
- method: 'GET' | 'POST';
591
- href: string;
541
+ interface DynamicElementEvents {
542
+ onReady?: () => void;
543
+ onValidationChange?: (isValid: boolean) => void;
592
544
  }
593
-
594
- interface ReturnInfo {
595
- success?: string;
596
- cancel?: string;
597
- error?: string;
598
- pending?: string;
545
+ interface DynamicElementFieldEvents {
546
+ onChange: (value: any) => void;
547
+ onReady: (initialValue: any) => void;
548
+ onBlur: () => void;
599
549
  }
600
- interface PayoutResponse {
601
- name: 'payout';
602
- executedAt: string;
603
- workspaceId: string;
604
- actionId: string;
605
- links: {
606
- execution: string;
607
- };
550
+ interface DynamicElementFieldTranslation {
551
+ label?: string;
552
+ placeholder?: string;
553
+ errors?: Partial<DynamicElementErrorTranslation>;
608
554
  }
609
- type PayoutComposition = Array<{
610
- integrationType: string;
611
- amount: PayrailsAmount;
612
- paymentMethodCode: PaymentMethodCode;
613
- paymentInstrumentId?: string;
614
- }>;
615
- interface PayoutReqBody {
616
- amount: PayrailsAmount;
617
- payoutComposition: PayoutComposition;
555
+ interface DynamicElementErrorTranslation {
556
+ required: string;
557
+ minLength: string;
558
+ maxLength: string;
559
+ pattern: string;
560
+ oneOf: string;
618
561
  }
619
- type ERROR_RESULT = 'Unknown' | 'UnexpectedProviderResponse' | 'ProviderUnknownError' | 'ProviderConnectionError' | 'Timeout' | 'ProviderTimeout' | 'GenericRejection' | 'DuplicateOperation' | 'OperationNotAllowed' | 'NetworkTransactionReferenceRejected' | 'PayerCanceled' | 'LimitExceeded' | 'InstrumentNotAllowed' | 'InvalidInstrument' | 'InsufficientBalance' | 'BlockedInstrument' | 'ExpiredInstrument' | 'ValidationError' | 'ParamsError' | 'ProviderConfigError' | 'InvalidSignature' | 'InternalServerError' | 'AuthenticationError' | 'PaymentMethodNotSupported' | 'PayerAuthenticationRequired' | 'PayerAuthenticationFailed' | 'FraudRisk';
620
-
621
- type IframeEventBusLike = {
622
- emit: (...args: any[]) => unknown;
623
- on: (...args: any[]) => unknown;
624
- off?: (...args: any[]) => unknown;
562
+ type DynamicElementTranslations = {
563
+ fields?: Record<string, DynamicElementFieldTranslation>;
564
+ errors?: Partial<DynamicElementErrorTranslation>;
625
565
  };
626
- interface Mountable {
627
- mount(selector: string | PayrailsElement): void;
628
- unmount(): void;
566
+ interface DynamicElementElementStyles {
567
+ base?: Partial<CSSStyleDeclaration>;
568
+ complete?: Partial<CSSStyleDeclaration>;
569
+ empty?: Partial<CSSStyleDeclaration>;
570
+ focus?: Partial<CSSStyleDeclaration>;
571
+ invalid?: Partial<CSSStyleDeclaration>;
629
572
  }
630
- interface ElementOptions {
631
- id?: string;
632
- dataTestId?: string;
633
- className?: string | string[];
634
- styles?: Partial<CSSStyleDeclaration>;
573
+ type DynamicElementInputFieldStyles = DynamicElementElementStyles;
574
+ type DynamicElementSelectFieldStyles = DynamicElementElementStyles;
575
+ interface DynamicElementTabsFieldStyles {
576
+ tab: {
577
+ base?: Partial<CSSStyleDeclaration>;
578
+ active?: Partial<CSSStyleDeclaration>;
579
+ };
580
+ container?: DynamicElementElementStyles;
635
581
  }
636
- declare class PayrailsElement implements Mountable {
637
- protected element: HTMLElement;
638
- protected subElements: Array<Mountable>;
639
- readonly id: string | undefined;
640
- readonly dataTestId: string | undefined;
641
- protected eventBus: IframeEventBusLike;
642
- constructor(elementType: string, { id, className, dataTestId }?: ElementOptions);
643
- get parentElement(): HTMLElement | null;
644
- get selector(): string;
645
- mount(location: string): void;
646
- protected clean(): void;
647
- unmount(): void;
582
+ interface DynamicElementFieldStyles {
583
+ base?: Partial<CSSStyleDeclaration>;
584
+ label?: Partial<CSSStyleDeclaration>;
585
+ errors?: Partial<CSSStyleDeclaration>;
586
+ input?: DynamicElementInputFieldStyles;
587
+ select?: DynamicElementSelectFieldStyles;
588
+ tabs?: DynamicElementTabsFieldStyles;
589
+ }
590
+ interface DynamicElementStyles {
591
+ all: Omit<DynamicElementFieldStyles, 'label'>;
592
+ fields?: Record<string, DynamicElementFieldStyles>;
648
593
  }
649
594
 
650
- interface IAddress {
595
+ declare enum PAYMENT_METHOD_CODES {
596
+ 'CARD' = "card",
597
+ 'GOOGLE_PAY' = "googlePay",
598
+ 'PAYPAL' = "payPal",
599
+ 'APPLE_PAY' = "applePay",
600
+ 'GENERIC_REDIRECT' = "genericRedirect",
601
+ 'LEAN' = "lean",
602
+ 'MERCADO_PAGO' = "mercadoPago",
603
+ 'PIX' = "pix",
604
+ 'BANK_ACCOUNT' = "bankAccount",
605
+ 'IDEAL' = "iDeal",
606
+ 'YAPE' = "yape",
607
+ 'UPI' = "upi",
608
+ 'KLARNA' = "klarna",
609
+ 'ONE_VOUCHER' = "1voucher",
610
+ 'ALFA' = "alfa",
611
+ 'APLAZO' = "aplazo",
612
+ 'BANK_TRANSFER' = "bankTransfer",
613
+ 'CAPITEC_PAY' = "capitecPay",
614
+ 'EASYPAISA' = "easypaisa",
615
+ 'EFT_PRO' = "eftPro",
616
+ 'FAWRY_PAY' = "fawryPay",
617
+ 'JAZZ_CASH' = "jazzCash",
618
+ 'KONNECT' = "konnect",
619
+ 'KUESKI' = "kueski",
620
+ 'MONO_DIRECT_DEBIT' = "monoDirectDebit",
621
+ 'O_PAY_WALLET' = "oPayWallet",
622
+ 'PAGA_WALLET' = "pagaWallet",
623
+ 'PAYFLEX' = "payflex",
624
+ 'PAY_JUST_NOW' = "payjustnow",
625
+ 'WAFA_CASH_WALLET' = "wafaCashWallet",
626
+ 'MERCADO_PAGO_WALLET' = "mercadoPagoWallet",
627
+ 'MERCADO_PAGO_CONSUMER_CREDIT' = "mercadoPagoConsumerCredit",
628
+ 'NET_BANKING' = "netBanking",
629
+ 'CASH_FREE_WALLET' = "cashFreeWallet",
630
+ 'PAYTM_WALLET' = "paytmWallet",
631
+ 'NIBSS_PAY' = "nibssPay",
632
+ 'NIBSS_INSTANT_PAY' = "nibssInstantPay",
633
+ 'MEEZA_WALLET' = "meezaWallet",
634
+ 'VODAFONE_CASH' = "vodafoneCash",
635
+ 'SEPA_DIRECT_DEBIT' = "sepaDirectDebit",
636
+ 'MODO' = "modo",
637
+ 'PAYZONE_CASH' = "payzoneCash",
638
+ 'REVOLUT_PAY' = "revolutPay"
639
+ }
640
+ declare const PAYMENT_METHOD_CODE_BY_METHOD: { readonly [K in keyof typeof PAYMENT_METHOD_CODES]: (typeof PAYMENT_METHOD_CODES)[K]; };
641
+ type PaymentMethodCode = PAYMENT_METHOD_CODES | (typeof PAYMENT_METHOD_CODE_BY_METHOD)[keyof typeof PAYMENT_METHOD_CODE_BY_METHOD] | (string & {});
642
+ declare enum PAYMENT_INSTRUMENT_STATUS {
643
+ 'ENABLED' = "enabled",
644
+ 'CREATED' = "created",
645
+ 'DELETED' = "deleted",
646
+ 'DISABLED' = "disabled",
647
+ 'INVALID' = "invalid",
648
+ 'TRANSIENT' = "transient"
649
+ }
650
+ type ExecutionMetaKey = keyof ExecutionMetaByKey;
651
+ interface ExecutionMetaCustomer {
652
+ phone?: {
653
+ countryCode?: string;
654
+ number?: string;
655
+ };
651
656
  country?: {
657
+ name?: string;
652
658
  code?: string;
653
- fullName?: string;
654
659
  iso3?: string;
655
660
  };
656
- postalCode?: string;
657
- }
658
- interface IOnChange {
659
- isValid: boolean;
660
- billingAddress?: IAddress;
661
+ reference?: string;
662
+ name?: string;
663
+ lastName?: string;
664
+ email?: string;
665
+ type?: string;
666
+ birthDate?: string;
667
+ language?: string;
668
+ identityCardNumber?: string;
661
669
  }
662
- interface AddressSelectorElementOptions extends ElementOptions {
663
- translations?: {
664
- labels?: {
665
- countrySelector?: string;
666
- postalCodeInput?: string;
670
+ interface ExecutionMetaOrder {
671
+ billingAddress?: {
672
+ country?: {
673
+ name?: string;
674
+ code?: string;
675
+ iso3?: string;
667
676
  };
668
- placeholders?: {
669
- postalCodeInput?: string;
670
- countrySelector?: string;
677
+ };
678
+ }
679
+ type ExecutionMetaByKey = {
680
+ customer: ExecutionMetaCustomer;
681
+ };
682
+ type ExecutionMetaUpdate = {
683
+ [Key in ExecutionMetaKey]: {
684
+ key: Key;
685
+ value: ExecutionMetaByKey[Key];
686
+ };
687
+ }[ExecutionMetaKey];
688
+ interface ExecutionMeta {
689
+ customer?: ExecutionMetaCustomer;
690
+ order?: ExecutionMetaOrder;
691
+ }
692
+ declare class WorkflowExecution {
693
+ private static _updatedMetaKeys;
694
+ private static _response;
695
+ static get response(): WorkflowExecutionResponse;
696
+ static setResponse(response: WorkflowExecutionResponse): typeof WorkflowExecution;
697
+ /**
698
+ * Non-throwing read of the current execution id. Returns `undefined` when
699
+ * the workflow execution hasn't been initialized yet. Prefer this over
700
+ * `WorkflowExecution.response.id` in observational code paths (event
701
+ * emission, logging, analytics) where the workflow not being loaded should
702
+ * degrade gracefully instead of throwing.
703
+ */
704
+ static get executionId(): string | undefined;
705
+ static get workflowCode(): string;
706
+ static get lookup(): {
707
+ httpCode: number;
708
+ body: {
709
+ data: {
710
+ paymentCompositionOptions?: Array<StorablePaymentCompositionOption>;
711
+ payoutCompositionOptions?: Array<StorablePaymentCompositionOption>;
712
+ };
713
+ links: {
714
+ execution: string;
715
+ authorize?: {
716
+ href: string;
717
+ method: "POST";
718
+ };
719
+ payout?: {
720
+ href: string;
721
+ method: "POST";
722
+ };
723
+ startPaymentSession?: {
724
+ href: string;
725
+ method: "POST";
726
+ };
727
+ createInstrument?: {
728
+ href: string;
729
+ method: "POST";
730
+ };
731
+ };
732
+ name: "lookup";
671
733
  };
734
+ } | undefined;
735
+ static get holderReference(): string;
736
+ static get savedCreditCards(): StoredPaymentInstrument<CardMetadata>[];
737
+ static get savedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
738
+ static get savedGooglePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
739
+ static get savedApplePayAccounts(): StoredPaymentInstrument<CardMetadata>[];
740
+ static get paypalConfig(): PayPalConfig;
741
+ static get googlePayConfig(): any;
742
+ static isPaymentMethodAvailable(paymentMethod: PaymentMethodCode): boolean;
743
+ static get applePayConfig(): {
744
+ merchantIdentifier: string;
745
+ supportedNetworks: string[];
746
+ countryCode: string;
747
+ merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
748
+ requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
749
+ requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
672
750
  };
673
- styles?: {
674
- wrapper?: Partial<CSSStyleDeclaration>;
675
- countrySelector?: {
676
- wrapper?: Partial<CSSStyleDeclaration>;
677
- element?: Partial<CSSStyleDeclaration>;
678
- label?: Partial<CSSStyleDeclaration>;
751
+ static get url(): string;
752
+ static get meta(): ExecutionMeta;
753
+ static get availablePaymentMethods(): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig | undefined>[];
754
+ static get authorizeLink(): string | undefined;
755
+ static get payoutLink(): string | undefined;
756
+ static get createSessionLink(): string | undefined;
757
+ static get createInstrumentLink(): string | undefined;
758
+ static get storedPaymentInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
759
+ static get storedDropinInstruments(): StoredPaymentInstrument<PayPalMetadata & CardMetadata>[];
760
+ static getFullPaymentMethodConfig(paymentMethod: PaymentMethodCode): StorablePaymentCompositionOption<CardMetadata | PayPalMetadata, ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig | undefined> | undefined;
761
+ static isAddressSelectorEnabled(paymentMethod: PaymentMethodCode): boolean | undefined;
762
+ static isPaymentInstallmentsEnabled(paymentMethod: PaymentMethodCode): boolean | undefined;
763
+ static getPaymentInstallmentOptions(paymentMethod: PaymentMethodCode): PaymentInstallmentsConfig;
764
+ static getStoredInstrumentForPaymentMethod<T = CardMetadata | PayPalMetadata>(paymentMethod: PaymentMethodCode): Array<StoredPaymentInstrument<T>>;
765
+ static getPaymentMethodForStoredInstrument<T extends CardMetadata | PayPalMetadata>(instrument: StoredPaymentInstrument<T>): {
766
+ id: string;
767
+ description?: string;
768
+ status: PAYMENT_INSTRUMENT_STATUS;
769
+ integrationType: INTEGRATION_TYPE;
770
+ config: ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig | undefined;
771
+ clientConfig?: {
772
+ flow?: PAYMENT_CLIENT_FLOW;
773
+ displayName?: string;
774
+ supportsInstallments?: boolean;
775
+ installments?: PaymentInstallmentsConfig;
776
+ supportsBillingInfo?: boolean;
777
+ schema?: JSONSchemaType;
778
+ additionalConfig?: any;
779
+ instrumentDataSchema?: JSONSchemaType;
679
780
  };
680
- postalCodeInput?: {
681
- wrapper?: Partial<CSSStyleDeclaration>;
682
- element?: Partial<CSSStyleDeclaration>;
683
- label?: Partial<CSSStyleDeclaration>;
781
+ payoutInstruments?: StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined;
782
+ paymentMethodCode: PaymentMethodCode;
783
+ payoutMethodCode?: PaymentMethodCode;
784
+ } | undefined;
785
+ static getPaymentMethodConfig(paymentMethod: StorablePaymentCompositionOption): {
786
+ id: string;
787
+ description?: string;
788
+ status: PAYMENT_INSTRUMENT_STATUS;
789
+ integrationType: INTEGRATION_TYPE;
790
+ config: ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig | undefined;
791
+ clientConfig?: {
792
+ flow?: PAYMENT_CLIENT_FLOW;
793
+ displayName?: string;
794
+ supportsInstallments?: boolean;
795
+ installments?: PaymentInstallmentsConfig;
796
+ supportsBillingInfo?: boolean;
797
+ schema?: JSONSchemaType;
798
+ additionalConfig?: any;
799
+ instrumentDataSchema?: JSONSchemaType;
684
800
  };
801
+ payoutInstruments?: StoredPaymentInstrument<CardMetadata | PayPalMetadata>[] | undefined;
802
+ paymentMethodCode: PaymentMethodCode;
803
+ payoutMethodCode?: PaymentMethodCode;
685
804
  };
686
- events?: {
687
- onBillingAddressChanged?: (e: IOnChange) => void;
688
- };
805
+ static updateInstallmentOptions(installmentOptions?: PaymentInstallmentsConfig): void;
806
+ static updateMeta<K extends ExecutionMetaKey>(key: K, value: ExecutionMetaByKey[K]): void;
807
+ static getAllowedMeta(): ExecutionMeta;
808
+ static getUpdatedMeta(): ExecutionMeta;
809
+ private static pickMetaByKeys;
689
810
  }
690
-
691
- interface StoreInstrumentElementOptions extends ElementOptions {
692
- showStoreInstrumentCheckbox?: boolean;
693
- alwaysStoreInstrument?: boolean;
694
- defaultStoreInstrumentState?: 'checked' | 'unchecked';
695
- translations?: {
696
- labels?: {
697
- storeInstrument?: string;
698
- saveInstrument?: string;
811
+ interface WorkflowExecutionResponse {
812
+ id: string;
813
+ merchantReference: string;
814
+ holderReference: string;
815
+ holderId?: string;
816
+ actionRequired?: string;
817
+ meta: ExecutionMeta;
818
+ status: Array<{
819
+ code: string;
820
+ time: string;
821
+ }>;
822
+ initialResults: Array<{
823
+ httpCode: number;
824
+ body: {
825
+ data: {
826
+ paymentCompositionOptions?: Array<StorablePaymentCompositionOption>;
827
+ payoutCompositionOptions?: Array<StorablePaymentCompositionOption>;
828
+ };
829
+ links: {
830
+ execution: string;
831
+ authorize?: {
832
+ href: string;
833
+ method: 'POST';
834
+ };
835
+ payout?: {
836
+ href: string;
837
+ method: 'POST';
838
+ };
839
+ startPaymentSession?: {
840
+ href: string;
841
+ method: 'POST';
842
+ };
843
+ createInstrument?: {
844
+ href: string;
845
+ method: 'POST';
846
+ };
847
+ };
848
+ name: 'lookup';
699
849
  };
700
- };
701
- styles?: {
702
- storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
703
- };
704
- events?: PayrailsSDKEvents;
705
- }
706
- declare class StoreInstrumentCheckbox extends PayrailsElement {
707
- private options;
708
- constructor(options: StoreInstrumentElementOptions);
709
- get isChecked(): boolean;
710
- private createHTML;
711
- private applyStyles;
712
- private addListeners;
713
- }
714
- declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
715
- protected options?: StoreInstrumentElementOptions | undefined;
716
- protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
717
- protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
718
- protected get shouldStoreInstrument(): boolean;
719
- }
720
-
721
- interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
722
- clientDomain?: string;
723
- showPaymentMethodLogo?: boolean;
724
- abortAfterAuthorizeFailed?: boolean;
725
- translations?: {
726
- labels?: {
727
- storeInstrument?: string;
728
- saveInstrument?: string;
729
- paymentScreenLabel?: string;
850
+ }>;
851
+ links: {
852
+ startPaymentSession?: {
853
+ href: string;
854
+ method: 'POST';
855
+ };
856
+ createInstrument?: {
857
+ href: string;
858
+ method: 'POST';
859
+ };
860
+ confirm?: {
861
+ href: string;
862
+ action?: {
863
+ parameters?: {
864
+ orderId?: string;
865
+ tokenId?: string;
866
+ };
867
+ paymentId?: string;
868
+ sdkToken?: string;
869
+ appToken?: string;
870
+ successUrl?: string;
871
+ failureUrl?: string;
872
+ sandbox?: boolean;
873
+ };
730
874
  };
875
+ redirect?: string;
876
+ '3ds'?: string;
877
+ self: string;
731
878
  };
732
- events?: PaymentEvents & Pick<UIEvents, 'onDeliveryAddressChanged'> & {
733
- onApplePayAvailable?: () => void;
879
+ workflow: {
880
+ code: string;
881
+ version: number;
734
882
  };
735
- styles?: {
736
- type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
737
- style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
738
- locale?: string;
739
- } & StoreInstrumentElementOptions['styles'];
740
883
  }
741
- declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
742
- protected options: ApplePayButtonOptions;
743
- private appleButton;
744
- private paymentExecutor;
745
- private action;
746
- private isProcessing;
747
- private completedSessions;
748
- private abortedSessionReasons;
749
- static isApplePayAvailable(): Promise<boolean>;
750
- constructor(options: ApplePayButtonOptions);
751
- mount(location: string): void;
752
- unmount(): void;
753
- private mountApplePayButton;
754
- private onAuthorizeFailedHandler;
755
- private completeApplePaySession;
756
- private createApplePaySession;
757
- /**
758
- * Apple Pay only exposes redacted contact fields here for privacy
759
- * (`countryCode`, `administrativeArea`, `locality`, `postalCode`); full
760
- * address is revealed in `onpaymentauthorized` after the user authorizes.
761
- *
762
- * The session must be answered with `completeShippingContactSelection`
763
- * within ~30s or Apple aborts the sheet — so the merchant's
764
- * `onDeliveryAddressChanged` callback must be fast.
765
- *
766
- * `amount` is passed in (rather than read from `getSDKConfig()`) so the
767
- * response carries the same total the session was created with, even if
768
- * the SDK config is mutated mid-flow.
769
- */
770
- private onApplePayShippingContactSelected;
771
- private onApplePayAuthorized;
772
- private doAuthorizedPayment;
773
- private doTokenize;
884
+ interface BasePaymentMethodConfig {
885
+ paymentMethodCode: PaymentMethodCode;
886
+ payoutMethodCode?: PaymentMethodCode;
774
887
  }
775
-
776
- interface BinLookupResponse {
777
- bin: string;
778
- network: string;
779
- issuer?: string;
780
- issuerCountry?: {
781
- code?: string;
782
- name?: string;
783
- iso3?: string;
784
- };
785
- type?: string;
888
+ interface BaseInstallmentOption {
889
+ count: number;
890
+ amount: number;
891
+ }
892
+ interface PaymentInstallmentsConfig {
893
+ [key: string]: BaseInstallmentOption[];
786
894
  }
787
-
788
- declare enum RedactionType {
789
- DEFAULT = "DEFAULT",
790
- PLAIN_TEXT = "PLAIN_TEXT",
791
- MASKED = "MASKED",
792
- REDACTED = "REDACTED"
895
+ interface InstallmentUpdateConfig {
896
+ defaultInstallment?: number | null;
897
+ installmentCountry?: string | null;
898
+ installmentOptions?: BaseInstallmentOption[] | null;
793
899
  }
794
- declare enum RequestMethod$1 {
795
- GET = "GET",
796
- POST = "POST",
797
- PUT = "PUT",
798
- PATCH = "PATCH",
799
- DELETE = "DELETE"
900
+ interface StorablePaymentCompositionOption<I = CardMetadata | PayPalMetadata, C = undefined | ApplePayConfig | PayPalConfig | GooglePayWorkflowConfig> extends BasePaymentMethodConfig {
901
+ id: string;
902
+ description?: string;
903
+ status: PAYMENT_INSTRUMENT_STATUS;
904
+ integrationType: INTEGRATION_TYPE;
905
+ config: C;
906
+ clientConfig?: {
907
+ flow?: PAYMENT_CLIENT_FLOW;
908
+ displayName?: string;
909
+ supportsInstallments?: boolean;
910
+ installments?: PaymentInstallmentsConfig;
911
+ supportsBillingInfo?: boolean;
912
+ schema?: JSONSchemaType;
913
+ additionalConfig?: any;
914
+ instrumentDataSchema?: JSONSchemaType;
915
+ };
916
+ paymentInstruments?: Array<StoredPaymentInstrument<I>>;
917
+ payoutInstruments?: Array<StoredPaymentInstrument<I>>;
800
918
  }
801
- declare enum EventName {
802
- CHANGE = "CHANGE",
803
- READY = "READY",
804
- FOCUS = "FOCUS",
805
- BLUR = "BLUR",
806
- SUBMIT = "SUBMIT"
919
+ interface GooglePayWorkflowConfig {
920
+ parameters: {
921
+ allowedAuthMethods: google.payments.api.CardAuthMethod[];
922
+ allowedCardNetworks: google.payments.api.CardNetwork[];
923
+ billingAddressParameters?: {
924
+ format?: string;
925
+ };
926
+ billingAddressRequired?: boolean;
927
+ };
928
+ tokenizationSpecification: google.payments.api.PaymentMethodTokenizationSpecification;
929
+ type: google.payments.api.PaymentMethodType;
930
+ apiVersion?: number;
931
+ apiVersionMinor?: number;
932
+ allowedPaymentMethods?: google.payments.api.PaymentMethodSpecification[];
933
+ emailRequired?: boolean;
934
+ shippingAddressRequired?: boolean;
935
+ shippingAddressParameters?: google.payments.api.ShippingAddressParameters;
936
+ merchantInfo?: google.payments.api.MerchantInfo;
937
+ existingPaymentMethodRequired?: boolean;
807
938
  }
808
- declare enum LogLevel {
809
- WARN = "WARN",
810
- INFO = "INFO",
811
- DEBUG = "DEBUG",
812
- ERROR = "ERROR"
939
+ interface PayPalConfig {
940
+ clientId: string;
941
+ merchantId: string;
942
+ captureMode: 'Delayed' | 'Instant' | 'Manual';
943
+ integrationMode: 'express' | 'normal';
813
944
  }
814
- declare enum Env {
815
- DEV = "DEV",
816
- PROD = "PROD"
945
+ interface ApplePayConfig {
946
+ parameters: {
947
+ merchantIdentifier: string;
948
+ supportedNetworks: string[];
949
+ countryCode: string;
950
+ merchantCapabilities: ApplePayJS.ApplePayMerchantCapability[];
951
+ requiredBillingContactFields?: ApplePayJS.ApplePayContactField[];
952
+ requiredShippingContactFields?: ApplePayJS.ApplePayContactField[];
953
+ };
954
+ type: string;
817
955
  }
818
- declare enum ValidationRuleType {
819
- REGEX_MATCH_RULE = "REGEX_MATCH_RULE",
820
- LENGTH_MATCH_RULE = "LENGTH_MATCH_RULE",
821
- ELEMENT_VALUE_MATCH_RULE = "ELEMENT_VALUE_MATCH_RULE"
956
+ interface StoredPaymentInstrument<T = CardMetadata | PayPalMetadata | BankAccountMetadata> {
957
+ id: string;
958
+ status: PAYMENT_INSTRUMENT_STATUS;
959
+ paymentMethod: PaymentMethodCode;
960
+ displayName?: string;
961
+ data?: T;
962
+ default?: boolean;
963
+ createdAt?: string;
964
+ updatedAt?: string;
965
+ holderId?: string;
966
+ fingerprint?: string;
967
+ futureUsage?: FutureUsages;
822
968
  }
823
- interface IInsertRecordInput {
824
- records: IInsertRecord[];
969
+ interface PayPalMetadata {
970
+ email?: string;
825
971
  }
826
- interface IInsertRecord {
827
- table: string;
828
- fields: Record<string, any>;
829
- skyflowID?: string;
972
+ interface Country {
973
+ code: string;
974
+ name: string;
975
+ iso3: string;
830
976
  }
831
- interface Context {
832
- logLevel: LogLevel;
833
- env: Env;
977
+ interface CardMetadata {
978
+ bin?: string;
979
+ suffix?: string;
980
+ network?: string;
981
+ binLookup?: {
982
+ issuerCountry: Country;
983
+ };
834
984
  }
835
- interface IValidationRule {
836
- type: ValidationRuleType;
837
- params: any;
985
+ interface BankAccountMetadata {
986
+ bankAccount: {
987
+ holder: HolderData;
988
+ bank: BankData;
989
+ account: AccountData;
990
+ };
838
991
  }
839
-
840
- interface IUpsertOptions {
841
- table: string;
842
- column: string;
992
+ interface HolderData {
993
+ firstName?: string;
994
+ lastName?: string;
995
+ companyName?: string;
996
+ address?: Address;
997
+ email?: string;
998
+ dob?: string;
999
+ country?: Country;
1000
+ city?: string;
1001
+ type: HolderType;
843
1002
  }
844
-
845
- declare enum ElementType$1 {
846
- CVV = "CVV",
847
- EXPIRATION_DATE = "EXPIRATION_DATE",
848
- CARD_NUMBER = "CARD_NUMBER",
849
- CARDHOLDER_NAME = "CARDHOLDER_NAME",
850
- INPUT_FIELD = "INPUT_FIELD",
851
- PIN = "PIN",
852
- EXPIRATION_MONTH = "EXPIRATION_MONTH",
853
- EXPIRATION_YEAR = "EXPIRATION_YEAR"
1003
+ type HolderType = 'individual' | 'corporate';
1004
+ interface BankData {
1005
+ name?: string;
1006
+ branchCode?: string;
1007
+ code?: string;
1008
+ address?: Address;
1009
+ swiftCode?: string;
854
1010
  }
855
-
856
- declare abstract class Container {
1011
+ interface AccountData {
1012
+ number?: string;
1013
+ iban?: string;
1014
+ currency?: string;
1015
+ type?: AccountType;
1016
+ country?: Country;
857
1017
  }
858
-
859
- declare class EventEmitter {
860
- events: Record<string, {
861
- priority: boolean;
862
- callback: Function;
863
- }[]>;
864
- constructor();
865
- on(event: string, callback: Function, priority?: boolean): void;
866
- off(event: string, callback: Function): void;
867
- _emit(event: string, ...args: any[]): void;
868
- hasListener(event: string): boolean;
869
- resetEvents(): void;
870
- static createChild(ChildObject: any): void;
1018
+ type AccountType = 'savings' | 'current';
1019
+ interface Address {
1020
+ country?: {
1021
+ code?: string;
1022
+ fullName?: string;
1023
+ iso3?: string;
1024
+ };
1025
+ postalCode?: string;
871
1026
  }
872
-
873
- declare abstract class SkyflowElement {
874
- abstract mount(domElementSelector: any): any;
875
- abstract unmount(): any;
876
- abstract setError(clientErrorText: string): any;
877
- abstract resetError(): any;
878
- abstract iframeName(): any;
879
- abstract getID(): any;
1027
+ declare enum PAYMENT_CLIENT_FLOW {
1028
+ 'REDIRECT' = "redirect",
1029
+ 'DIRECT' = "direct",
1030
+ 'EMBEDDED' = "embedded"
1031
+ }
1032
+ declare enum INTEGRATION_TYPE {
1033
+ API = "api",
1034
+ HPP = "hpp"
880
1035
  }
881
1036
 
882
- declare class CollectElement extends SkyflowElement {
883
- #private;
884
- elementType: string;
885
- type: string;
886
- containerId: string;
887
- constructor(elementId: string, elementGroup: any, metaData: any, container: any, isSingleElementAPI: boolean | undefined, destroyCallback: Function, updateCallback: Function, context: Context, groupEventEmitter?: EventEmitter);
888
- getID: () => string;
889
- mount: (domElement: any) => void;
890
- unmount: () => void;
891
- update: (group: any) => void;
892
- updateElement: (elementOptions: any) => void;
893
- getState: () => {
894
- isEmpty: boolean;
895
- isComplete: boolean;
896
- isValid: boolean;
897
- isFocused: boolean;
898
- value: string | Object | Blob | undefined;
899
- required: boolean;
900
- };
901
- getOptions: () => any;
902
- on(eventName: string, handler: any): void;
903
- iframeName(): string;
904
- isMounted(): boolean;
905
- isValidElement(): boolean;
906
- setError(clientErrorText: string): void;
907
- resetError(): void;
908
- setValue(elementValue: string): void;
909
- clearValue(): void;
910
- setAttribute(attribute: string, value: string | number): void;
911
- focus(): void;
1037
+ type FutureUsages = 'CardOnFile' | 'Subscription' | 'UnscheduledCardOnFile';
1038
+ interface SaveInstrumentResponse {
1039
+ id: string;
1040
+ createdAt: string;
1041
+ holderId: string;
1042
+ paymentMethod: PAYMENT_METHOD_CODES.CARD;
1043
+ status: PAYMENT_INSTRUMENT_STATUS;
1044
+ data: {
1045
+ bin: string;
1046
+ binLookup?: {
1047
+ bin: string;
1048
+ network: string;
1049
+ issuer?: string;
1050
+ issuerCountry?: {
1051
+ code?: string;
1052
+ name?: string;
1053
+ iso3?: string;
1054
+ };
1055
+ type?: string;
1056
+ };
1057
+ holderName?: string;
1058
+ network: string;
1059
+ suffix: string;
1060
+ expiryMonth?: string;
1061
+ expiryYear?: string;
1062
+ };
1063
+ fingerprint?: string;
1064
+ futureUsage?: string;
912
1065
  }
913
1066
 
914
- interface CollectElementInput$1 {
915
- table?: string;
916
- column?: string;
917
- inputStyles?: object;
918
- label?: string;
919
- labelStyles?: object;
920
- errorTextStyles?: object;
921
- placeholder?: string;
922
- type: ElementType$1;
923
- altText?: string;
924
- validations?: IValidationRule[];
925
- skyflowID?: string;
1067
+ interface SdkConfiguration {
1068
+ token: string;
1069
+ amount: PayrailsAmount;
1070
+ holderReference: string;
1071
+ links?: {
1072
+ binLookup?: Links;
1073
+ instrumentDelete?: Links;
1074
+ instrumentUpdate?: Links;
1075
+ };
1076
+ type?: 'tokenization' | 'dropIn' | 'secureFields';
1077
+ vaultConfiguration: {
1078
+ cardTableName: string;
1079
+ token: string;
1080
+ vaultId: string;
1081
+ vaultUrl: string;
1082
+ providerId: string;
1083
+ providerConfigId: string;
1084
+ vaultType: 'Payrails' | 'Test';
1085
+ encryptionPublicKey?: string;
1086
+ links: {
1087
+ saveInstrument: {
1088
+ href: string;
1089
+ };
1090
+ };
1091
+ };
1092
+ execution?: WorkflowExecutionResponse;
1093
+ featureConfig?: SdkFeatureConfig;
1094
+ morData?: MorData;
926
1095
  }
927
- interface ICollectOptions$1 {
928
- tokens?: boolean;
929
- additionalFields?: IInsertRecordInput;
930
- upsert?: Array<IUpsertOptions>;
1096
+ interface TaxLine {
1097
+ amount: string;
1098
+ currency: string;
1099
+ percentage?: string;
1100
+ type?: string;
931
1101
  }
932
- declare class CollectContainer extends Container {
933
- #private;
934
- type: string;
935
- private bus;
936
- private iframe;
937
- constructor(options: any, metaData: any, skyflowElements: any, context: any);
938
- create: (input: CollectElementInput$1, options?: any) => CollectElement;
939
- validate: () => Promise<unknown>;
940
- collect: (options?: ICollectOptions$1) => Promise<unknown>;
941
- reset(): void;
942
- unmount: () => void;
1102
+ interface TermsAndConditions {
1103
+ html?: string;
943
1104
  }
944
-
945
- /**
946
- * Descriptor for a custom font to be injected or referenced by the card/secure-fields iframes.
947
- *
948
- * This mirrors Stripe-like font configuration where you can provide either a CSS URL that
949
- * includes @font-face declarations (cssSrc) or provide full @font-face fields to be injected.
950
- *
951
- * Examples:
952
- * - { cssSrc: 'https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap' }
953
- * - { family: 'Inter', src: 'https://cdn.example.com/fonts/Inter.woff2', weight: 400, style: 'normal', display: 'swap' }
954
- */
955
- interface FontDescriptor {
956
- cssSrc?: string;
957
- family?: string;
958
- src?: string;
959
- style?: string;
960
- weight?: string | number;
961
- unicodeRange?: string;
962
- display?: string;
1105
+ interface MorData {
1106
+ taxLines?: TaxLine[];
1107
+ termsAndConditions?: TermsAndConditions;
1108
+ billingLines?: {
1109
+ form?: JSONSchemaType;
1110
+ };
963
1111
  }
964
-
965
- declare class ComposableElement {
966
- #private;
967
- type: string;
968
- constructor(name: any, eventEmitter: any);
969
- on(eventName: string, handler: any): void;
970
- focus(): void;
971
- update: (options: any) => void;
972
- setAttribute(attribute: string, value: string | number): void;
1112
+ interface SdkFeatureConfig {
1113
+ gpayIframeRollout?: number;
1114
+ secureFieldsRollout?: number;
973
1115
  }
974
-
975
- /**
976
- * Configuration interface for creating collect elements
977
- * Defines the structure and styling options for form input elements
978
- */
979
- interface CollectElementInput {
980
- table?: string;
981
- column?: string;
982
- inputStyles?: object;
983
- label?: string;
984
- labelStyles?: object;
985
- errorTextStyles?: object;
986
- placeholder?: string;
987
- type: ElementType$1;
988
- altText?: string;
989
- validations?: IValidationRule[];
990
- skyflowID?: string;
1116
+ interface PayrailsAmount {
1117
+ subTotal?: string;
1118
+ value: string;
1119
+ currency: string;
991
1120
  }
992
- /**
993
- * Options interface for the collect operation
994
- * Controls how data is collected and processed
995
- */
996
- interface ICollectOptions {
997
- tokens?: boolean;
998
- additionalFields?: IInsertRecordInput;
999
- upsert?: Array<IUpsertOptions>;
1121
+ interface LookupUpdateOptions {
1122
+ value?: string;
1123
+ currency?: string;
1124
+ installmentConfig?: InstallmentUpdateConfig | null;
1125
+ meta?: ExecutionMetaUpdate;
1000
1126
  }
1001
- /**
1002
- * ComposableContainer class - Main container for managing secure form elements
1003
- *
1004
- * This class extends the base Container and provides functionality to:
1005
- * - Create and manage secure iframe-based form elements
1006
- * - Handle secure communication between parent and iframe contexts
1007
- * - Collect and tokenize sensitive data while maintaining PCI compliance
1008
- * - Manage element lifecycle (create, mount, validate, collect, destroy)
1009
- */
1010
- declare class ComposableContainer extends Container {
1011
- #private;
1012
- type: string;
1013
- private bus;
1014
- private iframe;
1015
- /**
1016
- * Constructor - Initializes the composable container
1017
- *
1018
- * Sets up the secure iframe, establishes communication channels,
1019
- * and prepares the container for element creation and management.
1020
- *
1021
- * @param options - Container configuration (layout, styles, etc.)
1022
- * @param metaData - Client metadata and configuration
1023
- * @param skyflowElements - Global elements registry
1024
- * @param context - Application context with logging and config
1025
- */
1026
- constructor(options: any, metaData: any, skyflowElements: any, context: any);
1027
- /**
1028
- * Creates a new composable form element
1029
- *
1030
- * This method creates a secure form element (like card number, CVV, etc.)
1031
- * that will be rendered inside the secure iframe. The element is added to
1032
- * the container's element list but not yet mounted to the DOM.
1033
- *
1034
- * @param input - Element configuration (type, styles, validations, etc.)
1035
- * @param options - Additional options like required field validation
1036
- * @returns ComposableElement instance for further configuration
1037
- */
1038
- create: (input: CollectElementInput, options?: any) => ComposableElement;
1039
- /**
1040
- * Registers an event listener for container events
1041
- *
1042
- * Allows the application to listen for events like form submission,
1043
- * validation errors, or other container-level events.
1044
- *
1045
- * @param eventName - The name of the event to listen for
1046
- * @param handler - The callback function to execute when the event occurs
1047
- */
1048
- on: (eventName: string, handler: any) => void;
1049
- /**
1050
- * Mounts the container and its elements to a DOM element
1051
- *
1052
- * This method organizes the created elements according to the specified layout,
1053
- * applies styling, and renders them within the provided DOM element.
1054
- * The elements are rendered inside secure iframes for PCI compliance.
1055
- *
1056
- * @param domElement - The DOM element where the form should be mounted
1057
- */
1058
- mount: (domElement: any) => void;
1059
- /**
1060
- * Mounts the container element to the DOM and triggers a mounted event
1061
- *
1062
- * This method mounts the container element to the specified DOM element
1063
- * and then emits an event to notify the SDK that the container has been mounted.
1064
- *
1065
- * @param domElement - The DOM element where the container should be mounted
1066
- */
1067
- mountContainerElement: (domElement: string) => void;
1068
- /**
1069
- * Unmounts the container and cleans up all resources
1070
- *
1071
- * This method removes all elements from the DOM, clears internal state,
1072
- * and removes the iframe to prevent memory leaks.
1073
- */
1074
- unmount: () => void;
1075
- /**
1076
- * Validates all elements in the container
1077
- *
1078
- * Checks that all elements are mounted and triggers validation
1079
- * in the secure iframe. Returns a promise that resolves with
1080
- * validation results.
1081
- *
1082
- * @returns Promise that resolves with validation results
1083
- */
1084
- validate: () => Promise<unknown>;
1085
- /**
1086
- * Collects data from all elements in the container
1087
- *
1088
- * This method securely collects sensitive data from all mounted elements,
1089
- * validates the data, and optionally tokenizes it. The actual data collection
1090
- * happens within the secure iframe to maintain PCI compliance.
1091
- *
1092
- * @param options - Collection options (tokenization, additional fields, etc.)
1093
- * @returns Promise that resolves with collected/tokenized data
1094
- */
1095
- collect: (options?: ICollectOptions) => Promise<unknown>;
1096
- /**
1097
- * Resets all form elements to their initial state
1098
- *
1099
- * Clears all input values and resets validation states
1100
- * by sending a reset command to the secure iframe.
1101
- */
1102
- reset(): void;
1127
+ interface Links {
1128
+ method: 'GET' | 'POST';
1129
+ href: string;
1103
1130
  }
1104
1131
 
1105
- declare enum ContainerType {
1106
- COLLECT = "COLLECT",
1107
- COMPOSABLE = "COMPOSABLE"
1108
- }
1109
- interface ISkyflow {
1110
- vaultID?: string;
1111
- vaultURL?: string;
1112
- getBearerToken: () => Promise<string>;
1113
- options?: Record<string, any>;
1114
- }
1115
- declare class Skyflow {
1116
- #private;
1117
- private bus;
1118
- constructor(config: ISkyflow);
1119
- static init(config: ISkyflow): Skyflow;
1120
- container(type: ContainerType, options?: Record<string, any>): CollectContainer | ComposableContainer;
1121
- static get ContainerType(): typeof ContainerType;
1122
- static get ElementType(): typeof ElementType$1;
1123
- static get RedactionType(): typeof RedactionType;
1124
- static get RequestMethod(): typeof RequestMethod$1;
1125
- static get LogLevel(): typeof LogLevel;
1126
- static get EventName(): typeof EventName;
1127
- static get Env(): typeof Env;
1128
- static get ValidationRuleType(): typeof ValidationRuleType;
1132
+ interface ReturnInfo {
1133
+ success?: string;
1134
+ cancel?: string;
1135
+ error?: string;
1136
+ pending?: string;
1129
1137
  }
1130
-
1131
- interface TokenizeOptions {
1132
- futureUsage?: FutureUsages;
1133
- storeInstrument?: boolean;
1138
+ interface PayoutResponse {
1139
+ name: 'payout';
1140
+ executedAt: string;
1141
+ workspaceId: string;
1142
+ actionId: string;
1143
+ links: {
1144
+ execution: string;
1145
+ };
1134
1146
  }
1135
- declare abstract class Tokenizable extends PayrailsElement {
1136
- protected abstract collect(): Promise<any>;
1137
- protected abstract constructSaveInstrumentBody(tokens: any, opts?: TokenizeOptions): Promise<any>;
1138
- tokenize(_opts?: TokenizeOptions): Promise<any>;
1147
+ type PayoutComposition = Array<{
1148
+ integrationType: string;
1149
+ amount: PayrailsAmount;
1150
+ paymentMethodCode: PaymentMethodCode;
1151
+ paymentInstrumentId?: string;
1152
+ }>;
1153
+ interface PayoutReqBody {
1154
+ amount: PayrailsAmount;
1155
+ payoutComposition: PayoutComposition;
1139
1156
  }
1157
+ type ERROR_RESULT = 'Unknown' | 'UnexpectedProviderResponse' | 'ProviderUnknownError' | 'ProviderConnectionError' | 'Timeout' | 'ProviderTimeout' | 'GenericRejection' | 'DuplicateOperation' | 'OperationNotAllowed' | 'NetworkTransactionReferenceRejected' | 'PayerCanceled' | 'LimitExceeded' | 'InstrumentNotAllowed' | 'InvalidInstrument' | 'InsufficientBalance' | 'BlockedInstrument' | 'ExpiredInstrument' | 'ValidationError' | 'ParamsError' | 'ProviderConfigError' | 'InvalidSignature' | 'InternalServerError' | 'AuthenticationError' | 'PaymentMethodNotSupported' | 'PayerAuthenticationRequired' | 'PayerAuthenticationFailed' | 'FraudRisk';
1140
1158
 
1141
- declare enum ElementType {
1142
- CARD_NUMBER = "CARD_NUMBER",
1143
- CARDHOLDER_NAME = "CARDHOLDER_NAME",
1144
- CVV = "CVV",
1145
- EXPIRATION_MONTH = "EXPIRATION_MONTH",
1146
- EXPIRATION_YEAR = "EXPIRATION_YEAR",
1147
- EXPIRATION_DATE = "EXPIRATION_DATE"
1159
+ interface IAddress {
1160
+ country?: {
1161
+ code?: string;
1162
+ fullName?: string;
1163
+ iso3?: string;
1164
+ };
1165
+ postalCode?: string;
1148
1166
  }
1149
-
1150
- type FieldErrors = Partial<Record<'cardNumber' | 'expiry' | 'cvv' | 'holderName', string>>;
1151
- type ValidateCardFormResult = {
1167
+ interface IOnChange {
1152
1168
  isValid: boolean;
1153
- error?: string;
1154
- fieldErrors?: FieldErrors;
1155
- };
1156
- interface EncryptedCollectResult {
1157
- vaultProviderConfigId: string;
1158
- encryptedData: string;
1169
+ billingAddress?: IAddress;
1159
1170
  }
1160
- interface CollectElementOptions {
1161
- type: ElementType;
1162
- label?: string;
1163
- placeholder?: string;
1164
- altText?: string;
1165
- format?: string;
1166
- inputStyles?: object;
1167
- labelStyles?: object;
1168
- errorTextStyles?: object;
1169
- required?: boolean;
1170
- enableCardIcon?: boolean;
1171
+ interface AddressSelectorElementOptions extends ElementOptions {
1171
1172
  translations?: {
1172
- error?: {
1173
- default?: string;
1173
+ labels?: {
1174
+ countrySelector?: string;
1175
+ postalCodeInput?: string;
1176
+ };
1177
+ placeholders?: {
1178
+ postalCodeInput?: string;
1179
+ countrySelector?: string;
1174
1180
  };
1175
1181
  };
1176
- }
1177
- type PayrailsContainerType = 'COLLECT' | 'COMPOSABLE';
1178
- interface CollectContainerOptions {
1179
- layout?: number[];
1180
- cardTableName?: string;
1181
- containerType?: PayrailsContainerType;
1182
1182
  styles?: {
1183
- base?: Partial<CSSStyleDeclaration>;
1183
+ wrapper?: Partial<CSSStyleDeclaration>;
1184
+ countrySelector?: {
1185
+ wrapper?: Partial<CSSStyleDeclaration>;
1186
+ element?: Partial<CSSStyleDeclaration>;
1187
+ label?: Partial<CSSStyleDeclaration>;
1188
+ };
1189
+ postalCodeInput?: {
1190
+ wrapper?: Partial<CSSStyleDeclaration>;
1191
+ element?: Partial<CSSStyleDeclaration>;
1192
+ label?: Partial<CSSStyleDeclaration>;
1193
+ };
1184
1194
  };
1185
- errorTextStyles?: {
1186
- base?: Partial<CSSStyleDeclaration>;
1195
+ events?: {
1196
+ onBillingAddressChanged?: (e: IOnChange) => void;
1187
1197
  };
1188
- fonts?: FontDescriptor[];
1189
1198
  }
1190
- type PayrailsSecureFieldEvent = 'CHANGE' | 'FOCUS' | 'BLUR' | 'READY' | 'SUBMIT';
1191
- interface PayrailsSecureField {
1192
- on(eventName: PayrailsSecureFieldEvent, handler: any): void;
1193
- mount?: (domElement: any) => void;
1194
- unmount?: () => void;
1195
- focus?: () => void;
1196
- getState?: () => {
1197
- isEmpty: boolean;
1198
- isComplete: boolean;
1199
- isValid: boolean;
1200
- isFocused: boolean;
1201
- value: unknown;
1202
- required: boolean;
1199
+
1200
+ interface StoreInstrumentElementOptions extends ElementOptions {
1201
+ showStoreInstrumentCheckbox?: boolean;
1202
+ alwaysStoreInstrument?: boolean;
1203
+ defaultStoreInstrumentState?: 'checked' | 'unchecked';
1204
+ /** When true, visually positions the save-instrument checkbox above the payment button via CSS. */
1205
+ checkboxAboveButton?: boolean;
1206
+ translations?: {
1207
+ labels?: {
1208
+ storeInstrument?: string;
1209
+ saveInstrument?: string;
1210
+ };
1203
1211
  };
1204
- isValidElement?: () => boolean;
1205
- setError?: (clientErrorText: string) => void;
1206
- resetError?: () => void;
1207
- setValue?: (elementValue: string) => void;
1208
- clearValue?: () => void;
1209
- update?: (data: Partial<CollectElementOptions>) => void;
1210
- setAttribute: (attribute: string, value: string | number) => void;
1212
+ styles?: {
1213
+ storeInstrumentCheckbox?: Partial<CSSStyleDeclaration>;
1214
+ };
1215
+ events?: PayrailsSDKEvents;
1211
1216
  }
1212
- declare class PayrailsCollectContainer implements Mountable {
1213
- bin: string;
1214
- isBinLookupEnabled: boolean;
1215
- readonly id = "payrails-container-wrapper";
1216
- readonly dataTestId = "payrails-container-wrapper";
1217
- readonly className = "payrails-container-wrapper";
1218
- private static instance;
1219
- private readonly __container;
1220
- private element;
1221
- private readonly cardTableName;
1222
- private readonly containerType;
1223
- private manualErrorElements;
1224
- constructor(__client: Skyflow, options: CollectContainerOptions);
1225
- static init(vaultClient: Skyflow, options: CollectContainerOptions): PayrailsCollectContainer;
1226
- createCollectElement(options: CollectElementOptions): PayrailsSecureField;
1227
- mount(selector: string): void;
1217
+ declare class StoreInstrumentCheckbox extends PayrailsElement {
1218
+ private options;
1219
+ constructor(options: StoreInstrumentElementOptions);
1220
+ get isChecked(): boolean;
1221
+ private createHTML;
1222
+ private applyStyles;
1223
+ private addListeners;
1224
+ }
1225
+ declare abstract class PayrailsElementWithStoreInstrumentCheckbox extends PayrailsElement {
1226
+ protected options?: StoreInstrumentElementOptions | undefined;
1227
+ protected storeInstrumentCheckbox: StoreInstrumentCheckbox | null;
1228
+ protected constructor(elementType: string, options?: StoreInstrumentElementOptions | undefined);
1229
+ protected get shouldStoreInstrument(): boolean;
1230
+ }
1231
+
1232
+ interface ApplePayButtonOptions extends StoreInstrumentElementOptions {
1233
+ clientDomain?: string;
1234
+ showPaymentMethodLogo?: boolean;
1235
+ abortAfterAuthorizeFailed?: boolean;
1236
+ translations?: {
1237
+ labels?: {
1238
+ storeInstrument?: string;
1239
+ saveInstrument?: string;
1240
+ paymentScreenLabel?: string;
1241
+ };
1242
+ };
1243
+ events?: PaymentEvents & Pick<UIEvents, 'onDeliveryAddressChanged'> & {
1244
+ onApplePayAvailable?: () => void;
1245
+ };
1246
+ styles?: {
1247
+ type?: 'plain' | 'buy' | 'addMoney' | 'book' | 'checkout' | 'continue' | 'contribute' | 'donate' | 'inStore' | 'order' | 'reload' | 'rent' | 'setUp' | 'subscribe' | 'support' | 'tip' | 'topUp';
1248
+ style?: 'white' | 'whiteOutline' | 'black' | 'automatic';
1249
+ locale?: string;
1250
+ } & StoreInstrumentElementOptions['styles'];
1251
+ }
1252
+ declare class ApplePayButton extends PayrailsElementWithStoreInstrumentCheckbox {
1253
+ protected options: ApplePayButtonOptions;
1254
+ private appleButton;
1255
+ private paymentExecutor;
1256
+ private action;
1257
+ private isProcessing;
1258
+ private completedSessions;
1259
+ private abortedSessionReasons;
1260
+ static isApplePayAvailable(): Promise<boolean>;
1261
+ constructor(options: ApplePayButtonOptions);
1262
+ mount(location: string): void;
1228
1263
  unmount(): void;
1229
- validate(): Promise<ValidateCardFormResult>;
1230
- collect(): Promise<EncryptedCollectResult>;
1231
- reset(): void;
1232
- private collectPayrailsData;
1233
- tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
1234
- private constructSaveInstrumentBody;
1235
- private attachCustomEventHandler;
1236
- private formatBin;
1237
- private get elementToFieldMap();
1238
- fetchBinLookup: (bin: string) => Promise<BinLookupResponse | {
1239
- bin: string;
1240
- }>;
1264
+ private mountApplePayButton;
1265
+ private onAuthorizeFailedHandler;
1266
+ private completeApplePaySession;
1267
+ private createApplePaySession;
1268
+ /**
1269
+ * Apple Pay only exposes redacted contact fields here for privacy
1270
+ * (`countryCode`, `administrativeArea`, `locality`, `postalCode`); full
1271
+ * address is revealed in `onpaymentauthorized` after the user authorizes.
1272
+ *
1273
+ * The session must be answered with `completeShippingContactSelection`
1274
+ * within ~30s or Apple aborts the sheet — so the merchant's
1275
+ * `onDeliveryAddressChanged` callback must be fast.
1276
+ *
1277
+ * `amount` is passed in (rather than read from `getSDKConfig()`) so the
1278
+ * response carries the same total the session was created with, even if
1279
+ * the SDK config is mutated mid-flow.
1280
+ */
1281
+ private onApplePayShippingContactSelected;
1282
+ private onApplePayAuthorized;
1283
+ private doAuthorizedPayment;
1284
+ private doTokenize;
1241
1285
  }
1242
1286
 
1243
1287
  declare const regexes: {
@@ -1309,6 +1353,7 @@ type CardFormLayout = cardFormField[][];
1309
1353
  interface CardFormOptions extends StoreInstrumentElementOptions {
1310
1354
  showCardHolderName?: boolean;
1311
1355
  showSingleExpiryDateField?: boolean;
1356
+ injectedComponents?: PayrailsElement[];
1312
1357
  enrollInstrumentToNetworkOffers?: boolean;
1313
1358
  installmentConfig?: {
1314
1359
  defaultInstallment?: number | null;
@@ -1369,13 +1414,25 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
1369
1414
  private defaultStyles;
1370
1415
  private defaultTranslations;
1371
1416
  private eventsRef?;
1372
- constructor(collectContainer: PayrailsCollectContainer, options?: CardFormOptions | undefined);
1417
+ constructor(collectContainer: FramesContainer, options?: CardFormOptions | undefined);
1373
1418
  private initializeFormFields;
1374
1419
  getErrorTextStyles(errorTextStyles: any): any;
1375
1420
  private updateStyles;
1376
1421
  private updateTranslations;
1377
1422
  private updateEvents;
1378
1423
  update(options: Partial<Pick<CardFormOptions, 'styles' | 'translations' | 'events'>>): void;
1424
+ /**
1425
+ * Legacy (Skyflow) path: prepare per-field flat payloads and dispatch to
1426
+ * each field's vault element. Skyflow merges shallowly on its side.
1427
+ */
1428
+ private updateSkyflow;
1429
+ /**
1430
+ * Secure-fields path: forward styles/translations to the single CARD_FORM
1431
+ * frame 1:1; the frame fans them out per child via resolveFieldData. Host
1432
+ * defaults are deep-merged so successive updates accumulate symmetrically
1433
+ * with the frame's own accumulation.
1434
+ */
1435
+ private updateSecureFields;
1379
1436
  updateInstallmentConfig(installmentConfig?: InstallmentUpdateConfig): void;
1380
1437
  private createFormField;
1381
1438
  private isFieldRequired;
@@ -1383,7 +1440,7 @@ declare class CardForm extends PayrailsElementWithStoreInstrumentCheckbox {
1383
1440
  private hasFieldBeenUsed;
1384
1441
  private initializeDefaultLayout;
1385
1442
  private throttledFetchBinLookupIfChanged;
1386
- tokenize(opts: TokenizeOptions): Promise<SaveInstrumentResponse>;
1443
+ tokenize(opts: TokenizeOptions): Promise<any>;
1387
1444
  private createAddressSelector;
1388
1445
  show(): void;
1389
1446
  hide(options?: {
@@ -1481,6 +1538,8 @@ declare class CardPaymentButton extends PayrailsElement {
1481
1538
  private setStyles;
1482
1539
  private removeStyles;
1483
1540
  setLabel(label: string): void;
1541
+ private get showAmountAndCurrency();
1542
+ private getDefaultLabel;
1484
1543
  setCardForm(cardForm: CardForm): void;
1485
1544
  setPaymentInstallmentsDropdown(paymentInstallmentsDropdown: PayrailsElementWithPaymentInstallmentsDropdown): void;
1486
1545
  triggerLoading(isLoading: boolean): void;
@@ -1501,6 +1560,16 @@ declare enum AuthorizationFailureReasons {
1501
1560
  USER_CANCELLED = "USER_CANCELLED"
1502
1561
  }
1503
1562
 
1563
+ interface BillingAddressFormOptions {
1564
+ schema: JSONSchemaType;
1565
+ title?: string;
1566
+ styles?: DynamicElementStyles;
1567
+ translations?: DynamicElementTranslations;
1568
+ events?: {
1569
+ onReady?: () => void;
1570
+ };
1571
+ }
1572
+
1504
1573
  interface AuthFailedMsgOptions {
1505
1574
  translations?: {
1506
1575
  label?: string;
@@ -1520,7 +1589,7 @@ interface LoadingScreenStyles {
1520
1589
  [StyleKeys.loader]?: Partial<CSSStyleDeclaration>;
1521
1590
  }
1522
1591
 
1523
- type GooglePayConfigInput = google.payments.api.IsReadyToPayPaymentMethodSpecification[] | GooglePayConfig;
1592
+ type GooglePayConfigInput = google.payments.api.IsReadyToPayPaymentMethodSpecification[] | GooglePayWorkflowConfig;
1524
1593
  interface GooglePayButtonOptions extends StoreInstrumentElementOptions {
1525
1594
  environment?: PayrailsEnvironment;
1526
1595
  merchantInfo?: google.payments.api.MerchantInfo;
@@ -1617,6 +1686,36 @@ declare class LeanButton extends PayrailsElement {
1617
1686
  private onClick;
1618
1687
  }
1619
1688
 
1689
+ interface OrderSummaryLineItem {
1690
+ label: string;
1691
+ amount: string;
1692
+ currency: string;
1693
+ }
1694
+ interface OrderSummaryStateStyles {
1695
+ base?: Partial<CSSStyleDeclaration>;
1696
+ loading?: Partial<CSSStyleDeclaration>;
1697
+ hover?: Partial<CSSStyleDeclaration>;
1698
+ }
1699
+ interface OrderSummaryStyles {
1700
+ wrapper?: OrderSummaryStateStyles;
1701
+ header?: OrderSummaryStateStyles;
1702
+ subTotalRow?: OrderSummaryStateStyles;
1703
+ taxRows?: OrderSummaryStateStyles;
1704
+ totalRow?: OrderSummaryStateStyles;
1705
+ }
1706
+ interface OrderSummaryTranslations {
1707
+ labels?: {
1708
+ header?: string;
1709
+ subtotal?: string;
1710
+ total?: string;
1711
+ };
1712
+ }
1713
+ interface OrderSummaryElementOptions extends Omit<ElementOptions, 'styles'> {
1714
+ lineItems?: OrderSummaryLineItem[];
1715
+ translations?: OrderSummaryTranslations;
1716
+ styles?: OrderSummaryStyles;
1717
+ }
1718
+
1620
1719
  interface DropinElementEvents extends PaymentEvents {
1621
1720
  onActivate?: () => void;
1622
1721
  onDeactivate?: () => void;
@@ -1830,7 +1929,9 @@ declare class Dropin extends PayrailsElement {
1830
1929
  private paypal;
1831
1930
  private lean;
1832
1931
  private loadingScreen;
1833
- constructor(collectContainer: PayrailsCollectContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
1932
+ private billingAddressForm;
1933
+ private billingValidationBlocked;
1934
+ constructor(collectContainer: FramesContainer, clientConfig: PayrailsClientOptions, dropinConfig: DropinOptions);
1834
1935
  private get returnInfo();
1835
1936
  private isHppIntegration;
1836
1937
  private createStoredInstrumentElement;
@@ -1844,9 +1945,12 @@ declare class Dropin extends PayrailsElement {
1844
1945
  private createPayPalButton;
1845
1946
  private createLeanButton;
1846
1947
  private createCardForm;
1948
+ private createTermsAndConditionsElement;
1949
+ private createOrderSummaryElement;
1847
1950
  private createApplePayButton;
1848
1951
  private createCardPaymentButton;
1849
1952
  private onAuthorizeSuccess;
1953
+ private validateBillingAddress;
1850
1954
  private getElementEvents;
1851
1955
  private onAuthorizePending;
1852
1956
  private getErrorMessage;
@@ -1902,6 +2006,8 @@ interface DropinOptions {
1902
2006
  mercadoPago?: GenericRedirectDropinOptions['translations'];
1903
2007
  revolutPay?: GenericRedirectDropinOptions['translations'];
1904
2008
  addressSelector?: AddressSelectorElementOptions['translations'];
2009
+ orderSummary?: OrderSummaryElementOptions['translations'];
2010
+ billingAddressForm?: BillingAddressFormOptions['translations'];
1905
2011
  applePayButton?: ApplePayDropinOptions['translations'];
1906
2012
  leanButton?: LeanDropinOptions['translations'];
1907
2013
  errorMessages?: {
@@ -1922,6 +2028,9 @@ interface DropinOptions {
1922
2028
  authFailed?: Partial<CSSStyleDeclaration>;
1923
2029
  loadingScreen?: LoadingScreenStyles;
1924
2030
  addressSelector?: AddressSelectorElementOptions['styles'];
2031
+ orderSummary?: OrderSummaryElementOptions['styles'];
2032
+ termsAndConditions?: Partial<CSSStyleDeclaration>;
2033
+ billingAddressForm?: BillingAddressFormOptions['styles'];
1925
2034
  mercadoPago?: GenericRedirectDropinOptions['styles'];
1926
2035
  revolutPay?: GenericRedirectDropinOptions['styles'];
1927
2036
  };
@@ -1934,11 +2043,28 @@ interface ContainerStyles {
1934
2043
  styles?: Partial<CSSStyleDeclaration>;
1935
2044
  }
1936
2045
 
2046
+ interface DynamicElementFieldOptions {
2047
+ id: string;
2048
+ name: string;
2049
+ required?: boolean;
2050
+ property: JSONSchemaProperty;
2051
+ label: string;
2052
+ placeholder: string;
2053
+ value?: string;
2054
+ readOnly?: boolean;
2055
+ errors: DynamicElementErrorTranslation;
2056
+ styles?: DynamicElementFieldStyles;
2057
+ events: DynamicElementFieldEvents;
2058
+ }
2059
+
2060
+ type FieldOptionsWithoutEvents = Omit<DynamicElementFieldOptions, 'events'>;
2061
+
1937
2062
  interface DynamicElementOptions {
1938
2063
  styles?: DynamicElementStyles;
1939
2064
  translations?: DynamicElementTranslations;
1940
- paymentMethod: BasePaymentMethodConfig;
2065
+ paymentMethod?: BasePaymentMethodConfig;
1941
2066
  events?: DynamicElementEvents;
2067
+ fieldOverrides?: Record<string, Partial<FieldOptionsWithoutEvents>>;
1942
2068
  }
1943
2069
  interface FormConfig {
1944
2070
  schema: JSONSchemaType;
@@ -1952,7 +2078,7 @@ declare class DynamicElementForm extends Tokenizable {
1952
2078
  private __schema;
1953
2079
  private _previousFormValidState;
1954
2080
  constructor(options: DynamicElementOptions, formConfig: FormConfig, returnInfo?: ReturnInfo | undefined);
1955
- protected collect(): Promise<Record<string, any>>;
2081
+ collect(): Promise<Record<string, any>>;
1956
2082
  protected constructSaveInstrumentBody(tokens: any, opts?: TokenizeOptions): Promise<any>;
1957
2083
  private isFormValid;
1958
2084
  private isFormValidSilent;
@@ -2088,6 +2214,30 @@ interface PayPalScriptConfig {
2088
2214
  locale?: string;
2089
2215
  }
2090
2216
 
2217
+ interface PaymentAttemptContext {
2218
+ readonly executionId: string;
2219
+ readonly paymentMethodCode: PaymentMethodCode;
2220
+ }
2221
+ declare enum ACTION_REQUIRED_KIND {
2222
+ GENERIC_REDIRECT = "genericRedirect",
2223
+ THREE_DS = "3ds"
2224
+ }
2225
+ type ActionRequiredKind = `${ACTION_REQUIRED_KIND}`;
2226
+ interface ActionRequiredEvent extends PaymentAttemptContext {
2227
+ readonly url: string;
2228
+ readonly kind: ActionRequiredKind;
2229
+ /**
2230
+ * Call to take over the action. The SDK will not perform its default
2231
+ * behavior (navigate, mount the 3DS popup).
2232
+ */
2233
+ preventDefault(): void;
2234
+ }
2235
+ type PayrailsEvents = {
2236
+ actionRequired: ActionRequiredEvent;
2237
+ };
2238
+ type PayrailsEventName = keyof PayrailsEvents;
2239
+ type PayrailsEventHandler<K extends PayrailsEventName> = (event: PayrailsEvents[K]) => void | Promise<void>;
2240
+
2091
2241
  interface QueryDefinition<T> {
2092
2242
  path: string[];
2093
2243
  returnType: T;
@@ -2128,7 +2278,7 @@ declare class Payrails {
2128
2278
  static preloadCardForm: typeof SdkLoader.preloadCardForm;
2129
2279
  static init(initResponse: InitOptions, options?: PayrailsClientOptions): Payrails;
2130
2280
  update(updateOptions: LookupUpdateOptions): void;
2131
- collectContainer(containerOptions: CollectContainerOptions): PayrailsCollectContainer;
2281
+ collectContainer(containerOptions: CollectContainerOptions): FramesContainer;
2132
2282
  googlePayButton(options: GooglePayButtonOptions): GooglePayButton;
2133
2283
  isGooglePayAvailable(merchantInfo: google.payments.api.MerchantInfo): Promise<boolean>;
2134
2284
  applePayButton(options: ApplePayButtonOptions): ApplePayButton;
@@ -2151,11 +2301,13 @@ declare class Payrails {
2151
2301
  paypalButton(options?: PaypalButtonOptions): PaypalButton;
2152
2302
  leanButton(options: LeanButtonOptions): LeanButton;
2153
2303
  genericRedirectButton(options: GenericRedirectButtonOptions): GenericRedirectButton;
2154
- dynamicElement(options: DynamicElementOptions): DynamicElementForm;
2304
+ dynamicElement(options: DynamicElementOptions & Required<Pick<DynamicElementOptions, 'paymentMethod'>>): DynamicElementForm;
2155
2305
  getSavedPaypalAccounts(): StoredPaymentInstrument<PayPalMetadata>[];
2156
2306
  private logIntegrationMode;
2157
2307
  private constructor();
2158
2308
  private getContainerLayout;
2309
+ on<K extends PayrailsEventName>(name: K, handler: PayrailsEventHandler<K>): () => void;
2310
+ off<K extends PayrailsEventName>(name: K, handler: PayrailsEventHandler<K>): void;
2159
2311
  binLookup(): Promise<any>;
2160
2312
  }
2161
2313
  interface ClientEvents {
@@ -2281,5 +2433,5 @@ interface PayrailsClientOptions {
2281
2433
  };
2282
2434
  }
2283
2435
 
2284
- export { AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsCollectContainer, PayrailsEnvironment, REVOLUT_PAY_DEFAULT_LABEL, REVOLUT_PAY_DEFAULT_THEME };
2285
- export type { ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, CollectContainerOptions, DropinOptions, ExecutionMeta, ExecutionMetaCustomer, ExecutionMetaKey, GenericRedirectButtonOptions, GooglePayButtonOptions, InitOptions, LeanButtonOptions, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsSecureField, PayrailsSecureFieldEvent, ReturnInfo, RevolutPayButtonTheme, RevolutPayStyles, SaveInstrumentResponse, StorablePaymentCompositionOption, WorkflowExecutionResponse };
2436
+ export { ACTION_REQUIRED_KIND, AuthorizationFailureReasons, ElementType, INTEGRATION_TYPE, PAYMENT_METHOD_CODES, Payrails, PayrailsCollectContainer, PayrailsEnvironment, REVOLUT_PAY_DEFAULT_LABEL, REVOLUT_PAY_DEFAULT_THEME };
2437
+ export type { ActionRequiredEvent, ActionRequiredKind, ApplePayButtonOptions, CardFormOptions, CardListOptions, CardPaymentButtonOptions, CollectContainerOptions, DropinOptions, ExecutionMeta, ExecutionMetaCustomer, ExecutionMetaKey, GenericRedirectButtonOptions, GooglePayButtonOptions, InitOptions, LeanButtonOptions, PaymentAttemptContext, PaymentEvents, PaypalButtonOptions, PayrailsAmount, PayrailsClientOptions, PayrailsContainerType, PayrailsEventHandler, PayrailsEventName, PayrailsEvents, PayrailsSecureField, PayrailsSecureFieldEvent, ReturnInfo, RevolutPayButtonTheme, RevolutPayStyles, SaveInstrumentResponse, StorablePaymentCompositionOption, WorkflowExecutionResponse };