@stackonward/onex-checkout 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,939 @@
1
+ import { ApiClient } from '@stackonward/api-client';
2
+ import { z } from 'zod';
3
+
4
+ type ProtocolErrorCode = "invalid_request" | "invalid_response" | "unsupported_presentation";
5
+ declare class CheckoutProtocolError extends Error {
6
+ readonly code: ProtocolErrorCode;
7
+ constructor(code: ProtocolErrorCode, subject: string);
8
+ }
9
+ declare const purchaseOption: z.ZodObject<{
10
+ purchase_option_id: z.ZodOptional<z.ZodNumber>;
11
+ complete_without_payment: z.ZodOptional<z.ZodLiteral<true>>;
12
+ item_name: z.ZodEffects<z.ZodString, string, string>;
13
+ amount: z.ZodString;
14
+ currency: z.ZodString;
15
+ renewal_terms: z.ZodOptional<z.ZodObject<{
16
+ amount: z.ZodString;
17
+ currency: z.ZodString;
18
+ billing_period: z.ZodEnum<["weekly", "monthly", "quarterly", "semi_annual", "annual"]>;
19
+ billing_interval: z.ZodNumber;
20
+ }, "strip", z.ZodTypeAny, {
21
+ amount: string;
22
+ currency: string;
23
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
24
+ billing_interval: number;
25
+ }, {
26
+ amount: string;
27
+ currency: string;
28
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
29
+ billing_interval: number;
30
+ }>>;
31
+ }, "strip", z.ZodTypeAny, {
32
+ item_name: string;
33
+ amount: string;
34
+ currency: string;
35
+ purchase_option_id?: number | undefined;
36
+ complete_without_payment?: true | undefined;
37
+ renewal_terms?: {
38
+ amount: string;
39
+ currency: string;
40
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
41
+ billing_interval: number;
42
+ } | undefined;
43
+ }, {
44
+ item_name: string;
45
+ amount: string;
46
+ currency: string;
47
+ purchase_option_id?: number | undefined;
48
+ complete_without_payment?: true | undefined;
49
+ renewal_terms?: {
50
+ amount: string;
51
+ currency: string;
52
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
53
+ billing_interval: number;
54
+ } | undefined;
55
+ }>;
56
+ declare const session: z.ZodObject<{
57
+ checkout_session_no: z.ZodEffects<z.ZodString, string, string>;
58
+ status: z.ZodEnum<["open", "settling", "closing", "completing", "completed", "compensating", "compensated", "canceled", "expired", "requires_attention"]>;
59
+ revision: z.ZodNumber;
60
+ expires_at: z.ZodString;
61
+ active_execution_no: z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>;
62
+ purchase_options: z.ZodArray<z.ZodObject<{
63
+ purchase_option_id: z.ZodOptional<z.ZodNumber>;
64
+ complete_without_payment: z.ZodOptional<z.ZodLiteral<true>>;
65
+ item_name: z.ZodEffects<z.ZodString, string, string>;
66
+ amount: z.ZodString;
67
+ currency: z.ZodString;
68
+ renewal_terms: z.ZodOptional<z.ZodObject<{
69
+ amount: z.ZodString;
70
+ currency: z.ZodString;
71
+ billing_period: z.ZodEnum<["weekly", "monthly", "quarterly", "semi_annual", "annual"]>;
72
+ billing_interval: z.ZodNumber;
73
+ }, "strip", z.ZodTypeAny, {
74
+ amount: string;
75
+ currency: string;
76
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
77
+ billing_interval: number;
78
+ }, {
79
+ amount: string;
80
+ currency: string;
81
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
82
+ billing_interval: number;
83
+ }>>;
84
+ }, "strip", z.ZodTypeAny, {
85
+ item_name: string;
86
+ amount: string;
87
+ currency: string;
88
+ purchase_option_id?: number | undefined;
89
+ complete_without_payment?: true | undefined;
90
+ renewal_terms?: {
91
+ amount: string;
92
+ currency: string;
93
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
94
+ billing_interval: number;
95
+ } | undefined;
96
+ }, {
97
+ item_name: string;
98
+ amount: string;
99
+ currency: string;
100
+ purchase_option_id?: number | undefined;
101
+ complete_without_payment?: true | undefined;
102
+ renewal_terms?: {
103
+ amount: string;
104
+ currency: string;
105
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
106
+ billing_interval: number;
107
+ } | undefined;
108
+ }>, "many">;
109
+ available_actions: z.ZodArray<z.ZodEnum<["list_payment_methods", "complete_without_payment"]>, "many">;
110
+ }, "strip", z.ZodTypeAny, {
111
+ checkout_session_no: string;
112
+ status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
113
+ revision: number;
114
+ expires_at: string;
115
+ active_execution_no: string | null;
116
+ purchase_options: {
117
+ item_name: string;
118
+ amount: string;
119
+ currency: string;
120
+ purchase_option_id?: number | undefined;
121
+ complete_without_payment?: true | undefined;
122
+ renewal_terms?: {
123
+ amount: string;
124
+ currency: string;
125
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
126
+ billing_interval: number;
127
+ } | undefined;
128
+ }[];
129
+ available_actions: ("complete_without_payment" | "list_payment_methods")[];
130
+ }, {
131
+ checkout_session_no: string;
132
+ status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
133
+ revision: number;
134
+ expires_at: string;
135
+ active_execution_no: string | null;
136
+ purchase_options: {
137
+ item_name: string;
138
+ amount: string;
139
+ currency: string;
140
+ purchase_option_id?: number | undefined;
141
+ complete_without_payment?: true | undefined;
142
+ renewal_terms?: {
143
+ amount: string;
144
+ currency: string;
145
+ billing_period: "weekly" | "monthly" | "quarterly" | "semi_annual" | "annual";
146
+ billing_interval: number;
147
+ } | undefined;
148
+ }[];
149
+ available_actions: ("complete_without_payment" | "list_payment_methods")[];
150
+ }>;
151
+ declare const checkoutField: z.ZodObject<{
152
+ requirement: z.ZodEnum<["required", "conditional", "recommended", "provider_auto", "internal", "not_collected"]>;
153
+ collection: z.ZodEnum<["checkout_form", "provider_component", "wallet_sheet", "request_context", "not_collected"]>;
154
+ required_countries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
155
+ reason: z.ZodOptional<z.ZodString>;
156
+ }, "strip", z.ZodTypeAny, {
157
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
158
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
159
+ required_countries?: string[] | undefined;
160
+ reason?: string | undefined;
161
+ }, {
162
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
163
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
164
+ required_countries?: string[] | undefined;
165
+ reason?: string | undefined;
166
+ }>;
167
+ declare const method: z.ZodObject<{
168
+ method_reference: z.ZodEffects<z.ZodString, string, string>;
169
+ method_binding: z.ZodEffects<z.ZodString, string, string>;
170
+ provider: z.ZodEffects<z.ZodString, string, string>;
171
+ provider_environment: z.ZodEnum<["sandbox", "live"]>;
172
+ pm_id: z.ZodEffects<z.ZodString, string, string>;
173
+ name: z.ZodEffects<z.ZodString, string, string>;
174
+ logo: z.ZodOptional<z.ZodString>;
175
+ payment_authority_kind: z.ZodEnum<["catalog_purchase_option", "target_policy"]>;
176
+ purchase_option_id: z.ZodOptional<z.ZodNumber>;
177
+ purchase_option_label: z.ZodOptional<z.ZodString>;
178
+ renewal_policy: z.ZodOptional<z.ZodEnum<["manual", "auto"]>>;
179
+ amount: z.ZodString;
180
+ currency: z.ZodString;
181
+ payment_required: z.ZodBoolean;
182
+ provider_setup_required: z.ZodBoolean;
183
+ setup_requirement: z.ZodEnum<["none", "reusable_authorization", "hosted_subscription", "both"]>;
184
+ setup_execution_mode: z.ZodEnum<["none", "bundled_with_payment", "standalone"]>;
185
+ country_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
186
+ presentation_mode: z.ZodEffects<z.ZodString, string, string>;
187
+ presentation_flow: z.ZodEffects<z.ZodString, string, string>;
188
+ presentation_version: z.ZodNumber;
189
+ requires_provider_client_payload: z.ZodBoolean;
190
+ checkout_fields: z.ZodRecord<z.ZodString, z.ZodObject<{
191
+ requirement: z.ZodEnum<["required", "conditional", "recommended", "provider_auto", "internal", "not_collected"]>;
192
+ collection: z.ZodEnum<["checkout_form", "provider_component", "wallet_sheet", "request_context", "not_collected"]>;
193
+ required_countries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
194
+ reason: z.ZodOptional<z.ZodString>;
195
+ }, "strip", z.ZodTypeAny, {
196
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
197
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
198
+ required_countries?: string[] | undefined;
199
+ reason?: string | undefined;
200
+ }, {
201
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
202
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
203
+ required_countries?: string[] | undefined;
204
+ reason?: string | undefined;
205
+ }>>;
206
+ }, "strip", z.ZodTypeAny, {
207
+ amount: string;
208
+ currency: string;
209
+ method_reference: string;
210
+ method_binding: string;
211
+ provider: string;
212
+ provider_environment: "sandbox" | "live";
213
+ pm_id: string;
214
+ name: string;
215
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
216
+ payment_required: boolean;
217
+ provider_setup_required: boolean;
218
+ setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
219
+ setup_execution_mode: "none" | "bundled_with_payment" | "standalone";
220
+ presentation_mode: string;
221
+ presentation_flow: string;
222
+ presentation_version: number;
223
+ requires_provider_client_payload: boolean;
224
+ checkout_fields: Record<string, {
225
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
226
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
227
+ required_countries?: string[] | undefined;
228
+ reason?: string | undefined;
229
+ }>;
230
+ purchase_option_id?: number | undefined;
231
+ logo?: string | undefined;
232
+ purchase_option_label?: string | undefined;
233
+ renewal_policy?: "manual" | "auto" | undefined;
234
+ country_code?: string | null | undefined;
235
+ }, {
236
+ amount: string;
237
+ currency: string;
238
+ method_reference: string;
239
+ method_binding: string;
240
+ provider: string;
241
+ provider_environment: "sandbox" | "live";
242
+ pm_id: string;
243
+ name: string;
244
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
245
+ payment_required: boolean;
246
+ provider_setup_required: boolean;
247
+ setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
248
+ setup_execution_mode: "none" | "bundled_with_payment" | "standalone";
249
+ presentation_mode: string;
250
+ presentation_flow: string;
251
+ presentation_version: number;
252
+ requires_provider_client_payload: boolean;
253
+ checkout_fields: Record<string, {
254
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
255
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
256
+ required_countries?: string[] | undefined;
257
+ reason?: string | undefined;
258
+ }>;
259
+ purchase_option_id?: number | undefined;
260
+ logo?: string | undefined;
261
+ purchase_option_label?: string | undefined;
262
+ renewal_policy?: "manual" | "auto" | undefined;
263
+ country_code?: string | null | undefined;
264
+ }>;
265
+ declare const methods: z.ZodObject<{
266
+ session_revision: z.ZodNumber;
267
+ groups: z.ZodArray<z.ZodObject<{
268
+ key: z.ZodEffects<z.ZodString, string, string>;
269
+ label: z.ZodString;
270
+ methods: z.ZodArray<z.ZodObject<{
271
+ method_reference: z.ZodEffects<z.ZodString, string, string>;
272
+ method_binding: z.ZodEffects<z.ZodString, string, string>;
273
+ provider: z.ZodEffects<z.ZodString, string, string>;
274
+ provider_environment: z.ZodEnum<["sandbox", "live"]>;
275
+ pm_id: z.ZodEffects<z.ZodString, string, string>;
276
+ name: z.ZodEffects<z.ZodString, string, string>;
277
+ logo: z.ZodOptional<z.ZodString>;
278
+ payment_authority_kind: z.ZodEnum<["catalog_purchase_option", "target_policy"]>;
279
+ purchase_option_id: z.ZodOptional<z.ZodNumber>;
280
+ purchase_option_label: z.ZodOptional<z.ZodString>;
281
+ renewal_policy: z.ZodOptional<z.ZodEnum<["manual", "auto"]>>;
282
+ amount: z.ZodString;
283
+ currency: z.ZodString;
284
+ payment_required: z.ZodBoolean;
285
+ provider_setup_required: z.ZodBoolean;
286
+ setup_requirement: z.ZodEnum<["none", "reusable_authorization", "hosted_subscription", "both"]>;
287
+ setup_execution_mode: z.ZodEnum<["none", "bundled_with_payment", "standalone"]>;
288
+ country_code: z.ZodOptional<z.ZodNullable<z.ZodString>>;
289
+ presentation_mode: z.ZodEffects<z.ZodString, string, string>;
290
+ presentation_flow: z.ZodEffects<z.ZodString, string, string>;
291
+ presentation_version: z.ZodNumber;
292
+ requires_provider_client_payload: z.ZodBoolean;
293
+ checkout_fields: z.ZodRecord<z.ZodString, z.ZodObject<{
294
+ requirement: z.ZodEnum<["required", "conditional", "recommended", "provider_auto", "internal", "not_collected"]>;
295
+ collection: z.ZodEnum<["checkout_form", "provider_component", "wallet_sheet", "request_context", "not_collected"]>;
296
+ required_countries: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
297
+ reason: z.ZodOptional<z.ZodString>;
298
+ }, "strip", z.ZodTypeAny, {
299
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
300
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
301
+ required_countries?: string[] | undefined;
302
+ reason?: string | undefined;
303
+ }, {
304
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
305
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
306
+ required_countries?: string[] | undefined;
307
+ reason?: string | undefined;
308
+ }>>;
309
+ }, "strip", z.ZodTypeAny, {
310
+ amount: string;
311
+ currency: string;
312
+ method_reference: string;
313
+ method_binding: string;
314
+ provider: string;
315
+ provider_environment: "sandbox" | "live";
316
+ pm_id: string;
317
+ name: string;
318
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
319
+ payment_required: boolean;
320
+ provider_setup_required: boolean;
321
+ setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
322
+ setup_execution_mode: "none" | "bundled_with_payment" | "standalone";
323
+ presentation_mode: string;
324
+ presentation_flow: string;
325
+ presentation_version: number;
326
+ requires_provider_client_payload: boolean;
327
+ checkout_fields: Record<string, {
328
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
329
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
330
+ required_countries?: string[] | undefined;
331
+ reason?: string | undefined;
332
+ }>;
333
+ purchase_option_id?: number | undefined;
334
+ logo?: string | undefined;
335
+ purchase_option_label?: string | undefined;
336
+ renewal_policy?: "manual" | "auto" | undefined;
337
+ country_code?: string | null | undefined;
338
+ }, {
339
+ amount: string;
340
+ currency: string;
341
+ method_reference: string;
342
+ method_binding: string;
343
+ provider: string;
344
+ provider_environment: "sandbox" | "live";
345
+ pm_id: string;
346
+ name: string;
347
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
348
+ payment_required: boolean;
349
+ provider_setup_required: boolean;
350
+ setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
351
+ setup_execution_mode: "none" | "bundled_with_payment" | "standalone";
352
+ presentation_mode: string;
353
+ presentation_flow: string;
354
+ presentation_version: number;
355
+ requires_provider_client_payload: boolean;
356
+ checkout_fields: Record<string, {
357
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
358
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
359
+ required_countries?: string[] | undefined;
360
+ reason?: string | undefined;
361
+ }>;
362
+ purchase_option_id?: number | undefined;
363
+ logo?: string | undefined;
364
+ purchase_option_label?: string | undefined;
365
+ renewal_policy?: "manual" | "auto" | undefined;
366
+ country_code?: string | null | undefined;
367
+ }>, "many">;
368
+ }, "strip", z.ZodTypeAny, {
369
+ key: string;
370
+ label: string;
371
+ methods: {
372
+ amount: string;
373
+ currency: string;
374
+ method_reference: string;
375
+ method_binding: string;
376
+ provider: string;
377
+ provider_environment: "sandbox" | "live";
378
+ pm_id: string;
379
+ name: string;
380
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
381
+ payment_required: boolean;
382
+ provider_setup_required: boolean;
383
+ setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
384
+ setup_execution_mode: "none" | "bundled_with_payment" | "standalone";
385
+ presentation_mode: string;
386
+ presentation_flow: string;
387
+ presentation_version: number;
388
+ requires_provider_client_payload: boolean;
389
+ checkout_fields: Record<string, {
390
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
391
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
392
+ required_countries?: string[] | undefined;
393
+ reason?: string | undefined;
394
+ }>;
395
+ purchase_option_id?: number | undefined;
396
+ logo?: string | undefined;
397
+ purchase_option_label?: string | undefined;
398
+ renewal_policy?: "manual" | "auto" | undefined;
399
+ country_code?: string | null | undefined;
400
+ }[];
401
+ }, {
402
+ key: string;
403
+ label: string;
404
+ methods: {
405
+ amount: string;
406
+ currency: string;
407
+ method_reference: string;
408
+ method_binding: string;
409
+ provider: string;
410
+ provider_environment: "sandbox" | "live";
411
+ pm_id: string;
412
+ name: string;
413
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
414
+ payment_required: boolean;
415
+ provider_setup_required: boolean;
416
+ setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
417
+ setup_execution_mode: "none" | "bundled_with_payment" | "standalone";
418
+ presentation_mode: string;
419
+ presentation_flow: string;
420
+ presentation_version: number;
421
+ requires_provider_client_payload: boolean;
422
+ checkout_fields: Record<string, {
423
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
424
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
425
+ required_countries?: string[] | undefined;
426
+ reason?: string | undefined;
427
+ }>;
428
+ purchase_option_id?: number | undefined;
429
+ logo?: string | undefined;
430
+ purchase_option_label?: string | undefined;
431
+ renewal_policy?: "manual" | "auto" | undefined;
432
+ country_code?: string | null | undefined;
433
+ }[];
434
+ }>, "many">;
435
+ }, "strip", z.ZodTypeAny, {
436
+ session_revision: number;
437
+ groups: {
438
+ key: string;
439
+ label: string;
440
+ methods: {
441
+ amount: string;
442
+ currency: string;
443
+ method_reference: string;
444
+ method_binding: string;
445
+ provider: string;
446
+ provider_environment: "sandbox" | "live";
447
+ pm_id: string;
448
+ name: string;
449
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
450
+ payment_required: boolean;
451
+ provider_setup_required: boolean;
452
+ setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
453
+ setup_execution_mode: "none" | "bundled_with_payment" | "standalone";
454
+ presentation_mode: string;
455
+ presentation_flow: string;
456
+ presentation_version: number;
457
+ requires_provider_client_payload: boolean;
458
+ checkout_fields: Record<string, {
459
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
460
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
461
+ required_countries?: string[] | undefined;
462
+ reason?: string | undefined;
463
+ }>;
464
+ purchase_option_id?: number | undefined;
465
+ logo?: string | undefined;
466
+ purchase_option_label?: string | undefined;
467
+ renewal_policy?: "manual" | "auto" | undefined;
468
+ country_code?: string | null | undefined;
469
+ }[];
470
+ }[];
471
+ }, {
472
+ session_revision: number;
473
+ groups: {
474
+ key: string;
475
+ label: string;
476
+ methods: {
477
+ amount: string;
478
+ currency: string;
479
+ method_reference: string;
480
+ method_binding: string;
481
+ provider: string;
482
+ provider_environment: "sandbox" | "live";
483
+ pm_id: string;
484
+ name: string;
485
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
486
+ payment_required: boolean;
487
+ provider_setup_required: boolean;
488
+ setup_requirement: "none" | "reusable_authorization" | "hosted_subscription" | "both";
489
+ setup_execution_mode: "none" | "bundled_with_payment" | "standalone";
490
+ presentation_mode: string;
491
+ presentation_flow: string;
492
+ presentation_version: number;
493
+ requires_provider_client_payload: boolean;
494
+ checkout_fields: Record<string, {
495
+ requirement: "required" | "conditional" | "recommended" | "provider_auto" | "internal" | "not_collected";
496
+ collection: "not_collected" | "checkout_form" | "provider_component" | "wallet_sheet" | "request_context";
497
+ required_countries?: string[] | undefined;
498
+ reason?: string | undefined;
499
+ }>;
500
+ purchase_option_id?: number | undefined;
501
+ logo?: string | undefined;
502
+ purchase_option_label?: string | undefined;
503
+ renewal_policy?: "manual" | "auto" | undefined;
504
+ country_code?: string | null | undefined;
505
+ }[];
506
+ }[];
507
+ }>;
508
+ declare const billingAddress: z.ZodObject<{
509
+ line1: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
510
+ line2: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
511
+ city: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
512
+ state: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
513
+ postal_code: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
514
+ country: z.ZodOptional<z.ZodString>;
515
+ }, "strict", z.ZodTypeAny, {
516
+ line1?: string | undefined;
517
+ line2?: string | undefined;
518
+ city?: string | undefined;
519
+ state?: string | undefined;
520
+ postal_code?: string | undefined;
521
+ country?: string | undefined;
522
+ }, {
523
+ line1?: string | undefined;
524
+ line2?: string | undefined;
525
+ city?: string | undefined;
526
+ state?: string | undefined;
527
+ postal_code?: string | undefined;
528
+ country?: string | undefined;
529
+ }>;
530
+ declare const execution: z.ZodObject<{
531
+ checkout_session_no: z.ZodEffects<z.ZodString, string, string>;
532
+ execution_no: z.ZodEffects<z.ZodString, string, string>;
533
+ status: z.ZodEnum<["prepared", "dispatch_pending", "processing", "requires_action", "succeeded", "failed", "cancel_requested", "canceling", "canceled", "expired", "unknown"]>;
534
+ purpose: z.ZodEnum<["payment", "provider_setup"]>;
535
+ selection_status: z.ZodOptional<z.ZodEnum<["active", "superseded", "session_closed"]>>;
536
+ order_no: z.ZodOptional<z.ZodString>;
537
+ customer_name: z.ZodOptional<z.ZodString>;
538
+ billing_address: z.ZodOptional<z.ZodObject<{
539
+ line1: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
540
+ line2: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
541
+ city: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
542
+ state: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
543
+ postal_code: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
544
+ country: z.ZodOptional<z.ZodString>;
545
+ }, "strict", z.ZodTypeAny, {
546
+ line1?: string | undefined;
547
+ line2?: string | undefined;
548
+ city?: string | undefined;
549
+ state?: string | undefined;
550
+ postal_code?: string | undefined;
551
+ country?: string | undefined;
552
+ }, {
553
+ line1?: string | undefined;
554
+ line2?: string | undefined;
555
+ city?: string | undefined;
556
+ state?: string | undefined;
557
+ postal_code?: string | undefined;
558
+ country?: string | undefined;
559
+ }>>;
560
+ payment_no: z.ZodOptional<z.ZodNullable<z.ZodEffects<z.ZodString, string, string>>>;
561
+ provider: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
562
+ pm_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
563
+ payment_authority_kind: z.ZodEnum<["catalog_purchase_option", "target_policy"]>;
564
+ purchase_option_id: z.ZodOptional<z.ZodNumber>;
565
+ method_binding: z.ZodEffects<z.ZodString, string, string>;
566
+ amount: z.ZodString;
567
+ currency: z.ZodString;
568
+ presentation: z.ZodNullable<z.ZodObject<{
569
+ mode: z.ZodEffects<z.ZodString, string, string>;
570
+ flow: z.ZodEffects<z.ZodString, string, string>;
571
+ version: z.ZodNumber;
572
+ checkout_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
573
+ payload: z.ZodUnknown;
574
+ }, "strip", z.ZodTypeAny, {
575
+ mode: string;
576
+ flow: string;
577
+ version: number;
578
+ checkout_url?: string | null | undefined;
579
+ payload?: unknown;
580
+ }, {
581
+ mode: string;
582
+ flow: string;
583
+ version: number;
584
+ checkout_url?: string | null | undefined;
585
+ payload?: unknown;
586
+ }>>;
587
+ command_status: z.ZodOptional<z.ZodString>;
588
+ }, "strip", z.ZodTypeAny, {
589
+ checkout_session_no: string;
590
+ status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
591
+ amount: string;
592
+ currency: string;
593
+ method_binding: string;
594
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
595
+ execution_no: string;
596
+ purpose: "payment" | "provider_setup";
597
+ presentation: {
598
+ mode: string;
599
+ flow: string;
600
+ version: number;
601
+ checkout_url?: string | null | undefined;
602
+ payload?: unknown;
603
+ } | null;
604
+ purchase_option_id?: number | undefined;
605
+ provider?: string | undefined;
606
+ pm_id?: string | undefined;
607
+ selection_status?: "active" | "superseded" | "session_closed" | undefined;
608
+ order_no?: string | undefined;
609
+ customer_name?: string | undefined;
610
+ billing_address?: {
611
+ line1?: string | undefined;
612
+ line2?: string | undefined;
613
+ city?: string | undefined;
614
+ state?: string | undefined;
615
+ postal_code?: string | undefined;
616
+ country?: string | undefined;
617
+ } | undefined;
618
+ payment_no?: string | null | undefined;
619
+ command_status?: string | undefined;
620
+ }, {
621
+ checkout_session_no: string;
622
+ status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
623
+ amount: string;
624
+ currency: string;
625
+ method_binding: string;
626
+ payment_authority_kind: "catalog_purchase_option" | "target_policy";
627
+ execution_no: string;
628
+ purpose: "payment" | "provider_setup";
629
+ presentation: {
630
+ mode: string;
631
+ flow: string;
632
+ version: number;
633
+ checkout_url?: string | null | undefined;
634
+ payload?: unknown;
635
+ } | null;
636
+ purchase_option_id?: number | undefined;
637
+ provider?: string | undefined;
638
+ pm_id?: string | undefined;
639
+ selection_status?: "active" | "superseded" | "session_closed" | undefined;
640
+ order_no?: string | undefined;
641
+ customer_name?: string | undefined;
642
+ billing_address?: {
643
+ line1?: string | undefined;
644
+ line2?: string | undefined;
645
+ city?: string | undefined;
646
+ state?: string | undefined;
647
+ postal_code?: string | undefined;
648
+ country?: string | undefined;
649
+ } | undefined;
650
+ payment_no?: string | null | undefined;
651
+ command_status?: string | undefined;
652
+ }>;
653
+ declare const cancellation: z.ZodObject<{
654
+ checkout_session_no: z.ZodEffects<z.ZodString, string, string>;
655
+ execution_no: z.ZodEffects<z.ZodString, string, string>;
656
+ session_status: z.ZodEnum<["open", "settling", "closing", "completing", "completed", "compensating", "compensated", "canceled", "expired", "requires_attention"]>;
657
+ execution_status: z.ZodEnum<["prepared", "dispatch_pending", "processing", "requires_action", "succeeded", "failed", "cancel_requested", "canceling", "canceled", "expired", "unknown"]>;
658
+ command_status: z.ZodString;
659
+ pending_provider_commands: z.ZodNumber;
660
+ }, "strip", z.ZodTypeAny, {
661
+ checkout_session_no: string;
662
+ execution_no: string;
663
+ command_status: string;
664
+ session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
665
+ execution_status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
666
+ pending_provider_commands: number;
667
+ }, {
668
+ checkout_session_no: string;
669
+ execution_no: string;
670
+ command_status: string;
671
+ session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
672
+ execution_status: "canceled" | "expired" | "unknown" | "prepared" | "dispatch_pending" | "processing" | "requires_action" | "succeeded" | "failed" | "cancel_requested" | "canceling";
673
+ pending_provider_commands: number;
674
+ }>;
675
+ declare const completion: z.ZodObject<{
676
+ checkout_session_no: z.ZodEffects<z.ZodString, string, string>;
677
+ session_status: z.ZodEnum<["open", "settling", "closing", "completing", "completed", "compensating", "compensated", "canceled", "expired", "requires_attention"]>;
678
+ order_no: z.ZodEffects<z.ZodString, string, string>;
679
+ fulfillment_status: z.ZodEffects<z.ZodString, string, string>;
680
+ }, "strip", z.ZodTypeAny, {
681
+ checkout_session_no: string;
682
+ order_no: string;
683
+ session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
684
+ fulfillment_status: string;
685
+ }, {
686
+ checkout_session_no: string;
687
+ order_no: string;
688
+ session_status: "open" | "settling" | "closing" | "completing" | "completed" | "compensating" | "compensated" | "canceled" | "expired" | "requires_attention";
689
+ fulfillment_status: string;
690
+ }>;
691
+ declare const startInput: z.ZodObject<{
692
+ session_revision: z.ZodNumber;
693
+ method_reference: z.ZodEffects<z.ZodString, string, string>;
694
+ customer_name: z.ZodOptional<z.ZodString>;
695
+ billing_address: z.ZodOptional<z.ZodObject<{
696
+ line1: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
697
+ line2: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
698
+ city: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
699
+ state: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
700
+ postal_code: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
701
+ country: z.ZodOptional<z.ZodString>;
702
+ }, "strict", z.ZodTypeAny, {
703
+ line1?: string | undefined;
704
+ line2?: string | undefined;
705
+ city?: string | undefined;
706
+ state?: string | undefined;
707
+ postal_code?: string | undefined;
708
+ country?: string | undefined;
709
+ }, {
710
+ line1?: string | undefined;
711
+ line2?: string | undefined;
712
+ city?: string | undefined;
713
+ state?: string | undefined;
714
+ postal_code?: string | undefined;
715
+ country?: string | undefined;
716
+ }>>;
717
+ }, "strict", z.ZodTypeAny, {
718
+ session_revision: number;
719
+ method_reference: string;
720
+ customer_name?: string | undefined;
721
+ billing_address?: {
722
+ line1?: string | undefined;
723
+ line2?: string | undefined;
724
+ city?: string | undefined;
725
+ state?: string | undefined;
726
+ postal_code?: string | undefined;
727
+ country?: string | undefined;
728
+ } | undefined;
729
+ }, {
730
+ session_revision: number;
731
+ method_reference: string;
732
+ customer_name?: string | undefined;
733
+ billing_address?: {
734
+ line1?: string | undefined;
735
+ line2?: string | undefined;
736
+ city?: string | undefined;
737
+ state?: string | undefined;
738
+ postal_code?: string | undefined;
739
+ country?: string | undefined;
740
+ } | undefined;
741
+ }>;
742
+ type PurchaseOption = z.infer<typeof purchaseOption>;
743
+ type SessionState = z.infer<typeof session>;
744
+ type PaymentMethods = z.infer<typeof methods>;
745
+ type CheckoutMethod = z.infer<typeof method>;
746
+ type CheckoutField = z.infer<typeof checkoutField>;
747
+ type BillingAddress = z.infer<typeof billingAddress>;
748
+ type StartInput = z.infer<typeof startInput>;
749
+ type Cancellation = z.infer<typeof cancellation>;
750
+ type Completion = z.infer<typeof completion>;
751
+ type ExecutionResponse = z.infer<typeof execution>;
752
+
753
+ declare const airwallexMethods: readonly [{
754
+ readonly id: "card";
755
+ readonly submission: "form";
756
+ readonly requiresCardholderName: true;
757
+ }, {
758
+ readonly id: "apple_pay";
759
+ readonly submission: "native";
760
+ readonly requiresCardholderName: false;
761
+ }, {
762
+ readonly id: "google_pay";
763
+ readonly submission: "native";
764
+ readonly requiresCardholderName: false;
765
+ }];
766
+ declare const airwallexPayload: z.ZodObject<{
767
+ sdk_environment: z.ZodEnum<["demo", "prod"]>;
768
+ merchant_display_name: z.ZodEffects<z.ZodString, string, string>;
769
+ client_secret: z.ZodEffects<z.ZodString, string, string>;
770
+ payment_intent_id: z.ZodEffects<z.ZodString, string, string>;
771
+ customer_id: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
772
+ payment_consent: z.ZodOptional<z.ZodObject<{
773
+ next_triggered_by: z.ZodLiteral<"merchant">;
774
+ merchant_trigger_reason: z.ZodLiteral<"scheduled">;
775
+ }, "strip", z.ZodTypeAny, {
776
+ next_triggered_by: "merchant";
777
+ merchant_trigger_reason: "scheduled";
778
+ }, {
779
+ next_triggered_by: "merchant";
780
+ merchant_trigger_reason: "scheduled";
781
+ }>>;
782
+ country_code: z.ZodOptional<z.ZodString>;
783
+ merchant_country_code: z.ZodOptional<z.ZodString>;
784
+ }, "strip", z.ZodTypeAny, {
785
+ sdk_environment: "prod" | "demo";
786
+ merchant_display_name: string;
787
+ client_secret: string;
788
+ payment_intent_id: string;
789
+ country_code?: string | undefined;
790
+ customer_id?: string | undefined;
791
+ payment_consent?: {
792
+ next_triggered_by: "merchant";
793
+ merchant_trigger_reason: "scheduled";
794
+ } | undefined;
795
+ merchant_country_code?: string | undefined;
796
+ }, {
797
+ sdk_environment: "prod" | "demo";
798
+ merchant_display_name: string;
799
+ client_secret: string;
800
+ payment_intent_id: string;
801
+ country_code?: string | undefined;
802
+ customer_id?: string | undefined;
803
+ payment_consent?: {
804
+ next_triggered_by: "merchant";
805
+ merchant_trigger_reason: "scheduled";
806
+ } | undefined;
807
+ merchant_country_code?: string | undefined;
808
+ }>;
809
+ interface AirwallexPresentation extends Presentation {
810
+ flow: "airwallex_dropin";
811
+ version: 2;
812
+ payload: z.infer<typeof airwallexPayload>;
813
+ }
814
+ declare function airwallexEnvironment(environment: CheckoutMethod["provider_environment"]): "prod" | "demo";
815
+ declare function airwallexSession(execution: Execution<AirwallexPresentation>): {
816
+ kind: "setup";
817
+ customerId: string;
818
+ intentId: string;
819
+ amount: string;
820
+ currency: string;
821
+ clientSecret: string;
822
+ } | {
823
+ kind: "recurring";
824
+ intentId: string;
825
+ customerId: string;
826
+ amount: string;
827
+ currency: string;
828
+ clientSecret: string;
829
+ } | {
830
+ kind: "payment";
831
+ intentId: string;
832
+ amount: string;
833
+ currency: string;
834
+ clientSecret: string;
835
+ };
836
+
837
+ interface Presentation {
838
+ mode: "embedded";
839
+ flow: string;
840
+ version: number;
841
+ payload: unknown;
842
+ }
843
+ type PresentationContext = Pick<ExecutionResponse, "amount" | "purpose" | "provider" | "pm_id">;
844
+ interface PresentationDecoder<T extends Presentation> {
845
+ readonly flow: T["flow"];
846
+ readonly version: T["version"];
847
+ decode(payload: unknown, context: PresentationContext): T;
848
+ assertMethod?(method: CheckoutMethod, presentation: T): void;
849
+ }
850
+ type Decoded<Decoders extends readonly PresentationDecoder<Presentation>[]> = ReturnType<Decoders[number]["decode"]>;
851
+ type Execution<T extends Presentation = AirwallexPresentation> = Omit<ExecutionResponse, "presentation"> & {
852
+ presentation: T | null;
853
+ };
854
+ declare function parsePresentation(value: unknown, context: PresentationContext, decoders?: undefined): AirwallexPresentation;
855
+ declare function parsePresentation<const Decoders extends readonly PresentationDecoder<Presentation>[]>(value: unknown, context: PresentationContext, decoders: Decoders): AirwallexPresentation | Decoded<Decoders>;
856
+ declare function parsePresentation<const Decoders extends readonly PresentationDecoder<Presentation>[]>(value: unknown, context: PresentationContext, decoders: Decoders | undefined): AirwallexPresentation | Decoded<Decoders>;
857
+ declare function parsePresentation<T extends Presentation>(value: unknown, context: PresentationContext, decoders: readonly PresentationDecoder<T>[] | undefined): AirwallexPresentation | T;
858
+ declare function assertExecutionMethod<T extends Presentation>(method: CheckoutMethod, execution: Execution<T>, decoders?: readonly PresentationDecoder<Presentation>[]): void;
859
+
860
+ interface CheckoutClientOptions<T extends Presentation = never> {
861
+ transport: Pick<ApiClient, "get" | "post">;
862
+ basePath: string;
863
+ mutationHeaders?: () => HeadersInit | Promise<HeadersInit>;
864
+ presentations?: readonly PresentationDecoder<T>[];
865
+ }
866
+ interface CheckoutClient<T extends Presentation = never> {
867
+ session(no: string, signal?: AbortSignal): Promise<SessionState>;
868
+ methods(no: string, signal?: AbortSignal): Promise<PaymentMethods>;
869
+ start(no: string, input: StartInput, idempotencyKey: string, signal?: AbortSignal): Promise<Execution<AirwallexPresentation | T>>;
870
+ execution(no: string, executionNo: string, signal?: AbortSignal): Promise<Execution<AirwallexPresentation | T>>;
871
+ reconcile(no: string, executionNo: string, signal?: AbortSignal): Promise<Execution<AirwallexPresentation | T>>;
872
+ cancel(no: string, executionNo: string, idempotencyKey: string, signal?: AbortSignal): Promise<Cancellation>;
873
+ complete(no: string, expectedRevision: number, idempotencyKey: string, signal?: AbortSignal): Promise<Completion>;
874
+ }
875
+ interface RegisteredCheckoutClient<T extends Presentation = never> extends CheckoutClient<T> {
876
+ assertMethod(method: CheckoutMethod, execution: Execution<AirwallexPresentation | T>): void;
877
+ }
878
+ type ClientOptions = Omit<CheckoutClientOptions, "presentations">;
879
+ type DecoderList = readonly PresentationDecoder<Presentation>[];
880
+ declare function createCheckoutClient<const Decoders extends DecoderList>(options: ClientOptions & {
881
+ presentations: Decoders;
882
+ }): RegisteredCheckoutClient<Decoded<Decoders>>;
883
+ declare function createCheckoutClient(options: ClientOptions & {
884
+ presentations?: undefined;
885
+ }): RegisteredCheckoutClient;
886
+ declare function createCheckoutClient<const Decoders extends DecoderList>(options: ClientOptions & {
887
+ presentations?: Decoders | undefined;
888
+ }): RegisteredCheckoutClient<Decoded<Decoders>>;
889
+ declare function createCheckoutClient<T extends Presentation = never>(options: CheckoutClientOptions<T>): RegisteredCheckoutClient<T>;
890
+
891
+ interface PayerValues extends BillingAddress {
892
+ cardholder_name?: string;
893
+ phone_number?: string;
894
+ }
895
+ declare const definitions: readonly [{
896
+ readonly code: "cardholder_name";
897
+ readonly key: "cardholder_name";
898
+ readonly autocomplete: "cc-name";
899
+ readonly maxLength: 120;
900
+ }, {
901
+ readonly code: "phone_number";
902
+ readonly key: "phone_number";
903
+ readonly autocomplete: "tel";
904
+ }, {
905
+ readonly code: "billing_line1";
906
+ readonly key: "line1";
907
+ readonly autocomplete: "address-line1";
908
+ }, {
909
+ readonly code: "billing_line2";
910
+ readonly key: "line2";
911
+ readonly autocomplete: "address-line2";
912
+ }, {
913
+ readonly code: "billing_city";
914
+ readonly key: "city";
915
+ readonly autocomplete: "address-level2";
916
+ }, {
917
+ readonly code: "billing_country";
918
+ readonly key: "country";
919
+ readonly autocomplete: "country";
920
+ }, {
921
+ readonly code: "billing_region";
922
+ readonly key: "state";
923
+ readonly autocomplete: "address-level1";
924
+ }, {
925
+ readonly code: "billing_postal_code";
926
+ readonly key: "postal_code";
927
+ readonly autocomplete: "postal-code";
928
+ }];
929
+ type PayerField = (typeof definitions)[number] & {
930
+ required: boolean;
931
+ };
932
+ declare function collectPayerFields(fields: CheckoutMethod["checkout_fields"], country?: string): PayerField[];
933
+ declare function isCardholderNameValid(name: string): boolean;
934
+ declare function hasValidPayerValues(fields: readonly PayerField[], values: PayerValues): boolean;
935
+ declare function billingAddressInput(fields: readonly PayerField[], values: PayerValues): BillingAddress | undefined;
936
+ declare function supportsPayerFields(fields: CheckoutMethod["checkout_fields"]): boolean;
937
+
938
+ export { CheckoutProtocolError, airwallexEnvironment, airwallexMethods, airwallexSession, assertExecutionMethod, billingAddressInput, collectPayerFields, createCheckoutClient, hasValidPayerValues, isCardholderNameValid, parsePresentation, supportsPayerFields };
939
+ export type { AirwallexPresentation, BillingAddress, Cancellation, CheckoutClient, CheckoutClientOptions, CheckoutField, CheckoutMethod, Completion, Execution, PayerField, PayerValues, PaymentMethods, Presentation, PresentationContext, PresentationDecoder, ProtocolErrorCode, PurchaseOption, RegisteredCheckoutClient, SessionState, StartInput };