@xpayeg/sdk 1.0.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,3874 @@
1
+ /**
2
+ * Generated by orval v7.21.0 🍺
3
+ * Do not edit manually.
4
+ * XPay Checkout API
5
+ * API for the XPay checkout flow — client endpoints and SSR
6
+ * OpenAPI spec version: 1.0
7
+ */
8
+ interface AddressDto {
9
+ city: string;
10
+ country: string;
11
+ line1: string;
12
+ line2: string;
13
+ postalCode: string;
14
+ state: string;
15
+ }
16
+
17
+ /**
18
+ * Generated by orval v7.21.0 🍺
19
+ * Do not edit manually.
20
+ * XPay Checkout API
21
+ * API for the XPay checkout flow — client endpoints and SSR
22
+ * OpenAPI spec version: 1.0
23
+ */
24
+ interface AddressResponseDto {
25
+ /** Address line 1 */
26
+ line1?: string;
27
+ /** Address line 2 */
28
+ line2?: string;
29
+ /** City */
30
+ city?: string;
31
+ /** State/Province */
32
+ state?: string;
33
+ /** Postal code */
34
+ postalCode?: string;
35
+ /** Country code */
36
+ country?: string;
37
+ }
38
+
39
+ /**
40
+ * Generated by orval v7.21.0 🍺
41
+ * Do not edit manually.
42
+ * XPay Checkout API
43
+ * API for the XPay checkout flow — client endpoints and SSR
44
+ * OpenAPI spec version: 1.0
45
+ */
46
+ interface AdjustableQuantityDto {
47
+ /** Whether adjustable quantity is enabled */
48
+ enabled: boolean;
49
+ /** Minimum quantity allowed */
50
+ minimum?: number;
51
+ /** Maximum quantity allowed */
52
+ maximum?: number;
53
+ }
54
+
55
+ /**
56
+ * Generated by orval v7.21.0 🍺
57
+ * Do not edit manually.
58
+ * XPay Checkout API
59
+ * API for the XPay checkout flow — client endpoints and SSR
60
+ * OpenAPI spec version: 1.0
61
+ */
62
+ interface AmountDetailsTaxDto {
63
+ /** Tax amount charged on this payment, in the smallest currency unit (e.g. piasters for EGP). */
64
+ amount: number;
65
+ /** Tax rate applied, in basis points (1% = 100 bps). For example, `1400` means 14%. */
66
+ rateBps: number;
67
+ }
68
+
69
+ /**
70
+ * Generated by orval v7.21.0 🍺
71
+ * Do not edit manually.
72
+ * XPay Checkout API
73
+ * API for the XPay checkout flow — client endpoints and SSR
74
+ * OpenAPI spec version: 1.0
75
+ */
76
+
77
+ /**
78
+ * Tax breakdown for this payment. `null` if no tax was collected.
79
+ * @nullable
80
+ */
81
+ type AmountDetailsDtoTax = AmountDetailsTaxDto | null;
82
+
83
+ /**
84
+ * Generated by orval v7.21.0 🍺
85
+ * Do not edit manually.
86
+ * XPay Checkout API
87
+ * API for the XPay checkout flow — client endpoints and SSR
88
+ * OpenAPI spec version: 1.0
89
+ */
90
+ interface AmountDetailsPlatformFeesDto {
91
+ /** Platform fee charged by XPay on this payment, in the smallest currency unit. */
92
+ amount: number;
93
+ /** VAT charged on the platform fee itself, in the smallest currency unit. */
94
+ vatAmount: number;
95
+ }
96
+
97
+ /**
98
+ * Generated by orval v7.21.0 🍺
99
+ * Do not edit manually.
100
+ * XPay Checkout API
101
+ * API for the XPay checkout flow — client endpoints and SSR
102
+ * OpenAPI spec version: 1.0
103
+ */
104
+
105
+ /**
106
+ * Platform fee breakdown for this payment. `null` if not surfaced to the customer.
107
+ * @nullable
108
+ */
109
+ type AmountDetailsDtoPlatformFees = AmountDetailsPlatformFeesDto | null;
110
+
111
+ /**
112
+ * Generated by orval v7.21.0 🍺
113
+ * Do not edit manually.
114
+ * XPay Checkout API
115
+ * API for the XPay checkout flow — client endpoints and SSR
116
+ * OpenAPI spec version: 1.0
117
+ */
118
+
119
+ interface AmountDetailsDto {
120
+ /** Amount that pays for the product/service itself, in the smallest currency unit. Excludes tax, platform fees, tip, and discount. */
121
+ productAmount: number;
122
+ /**
123
+ * Tax breakdown for this payment. `null` if no tax was collected.
124
+ * @nullable
125
+ */
126
+ tax?: AmountDetailsDtoTax;
127
+ /**
128
+ * Platform fee breakdown for this payment. `null` if not surfaced to the customer.
129
+ * @nullable
130
+ */
131
+ platformFees?: AmountDetailsDtoPlatformFees;
132
+ /**
133
+ * Tip amount included in this payment, in the smallest currency unit. `null` if no tip.
134
+ * @nullable
135
+ */
136
+ tip?: number | null;
137
+ /**
138
+ * Discount amount applied, in the smallest currency unit. `null` if no discount.
139
+ * @nullable
140
+ */
141
+ discount?: number | null;
142
+ }
143
+
144
+ /**
145
+ * Generated by orval v7.21.0 🍺
146
+ * Do not edit manually.
147
+ * XPay Checkout API
148
+ * API for the XPay checkout flow — client endpoints and SSR
149
+ * OpenAPI spec version: 1.0
150
+ */
151
+ type BalanceTransactionFeeDetailDtoCurrency = typeof BalanceTransactionFeeDetailDtoCurrency[keyof typeof BalanceTransactionFeeDetailDtoCurrency];
152
+ declare const BalanceTransactionFeeDetailDtoCurrency: {
153
+ readonly EGP: "EGP";
154
+ readonly USD: "USD";
155
+ readonly EUR: "EUR";
156
+ readonly GBP: "GBP";
157
+ readonly SAR: "SAR";
158
+ readonly AED: "AED";
159
+ readonly QAR: "QAR";
160
+ readonly KWD: "KWD";
161
+ readonly JOD: "JOD";
162
+ readonly OMR: "OMR";
163
+ readonly BHD: "BHD";
164
+ readonly LYD: "LYD";
165
+ readonly AUD: "AUD";
166
+ readonly CAD: "CAD";
167
+ readonly CNY: "CNY";
168
+ };
169
+
170
+ /**
171
+ * Generated by orval v7.21.0 🍺
172
+ * Do not edit manually.
173
+ * XPay Checkout API
174
+ * API for the XPay checkout flow — client endpoints and SSR
175
+ * OpenAPI spec version: 1.0
176
+ */
177
+
178
+ interface BalanceTransactionFeeDetailDto {
179
+ amount: number;
180
+ currency: BalanceTransactionFeeDetailDtoCurrency;
181
+ description: string;
182
+ /** Fee type. PROCESSOR_COST entries are internal (platform COGS) and are filtered out of merchant-facing payloads. */
183
+ type: string;
184
+ /** @nullable */
185
+ application: string | null;
186
+ }
187
+
188
+ /**
189
+ * Generated by orval v7.21.0 🍺
190
+ * Do not edit manually.
191
+ * XPay Checkout API
192
+ * API for the XPay checkout flow — client endpoints and SSR
193
+ * OpenAPI spec version: 1.0
194
+ */
195
+ type BalanceTransactionPayoutBatchDtoCurrency = typeof BalanceTransactionPayoutBatchDtoCurrency[keyof typeof BalanceTransactionPayoutBatchDtoCurrency];
196
+ declare const BalanceTransactionPayoutBatchDtoCurrency: {
197
+ readonly EGP: "EGP";
198
+ readonly USD: "USD";
199
+ readonly EUR: "EUR";
200
+ readonly GBP: "GBP";
201
+ readonly SAR: "SAR";
202
+ readonly AED: "AED";
203
+ readonly QAR: "QAR";
204
+ readonly KWD: "KWD";
205
+ readonly JOD: "JOD";
206
+ readonly OMR: "OMR";
207
+ readonly BHD: "BHD";
208
+ readonly LYD: "LYD";
209
+ readonly AUD: "AUD";
210
+ readonly CAD: "CAD";
211
+ readonly CNY: "CNY";
212
+ };
213
+
214
+ /**
215
+ * Generated by orval v7.21.0 🍺
216
+ * Do not edit manually.
217
+ * XPay Checkout API
218
+ * API for the XPay checkout flow — client endpoints and SSR
219
+ * OpenAPI spec version: 1.0
220
+ */
221
+ /**
222
+ * Batch lifecycle status. Merchant-facing status equals the batch status (not the individual payout status).
223
+ */
224
+ type BalanceTransactionPayoutBatchDtoStatus = typeof BalanceTransactionPayoutBatchDtoStatus[keyof typeof BalanceTransactionPayoutBatchDtoStatus];
225
+ declare const BalanceTransactionPayoutBatchDtoStatus: {
226
+ readonly open: "open";
227
+ readonly processing: "processing";
228
+ readonly in_transit: "in_transit";
229
+ readonly paid: "paid";
230
+ readonly partial_failed: "partial_failed";
231
+ readonly failed: "failed";
232
+ readonly canceled: "canceled";
233
+ };
234
+
235
+ /**
236
+ * Generated by orval v7.21.0 🍺
237
+ * Do not edit manually.
238
+ * XPay Checkout API
239
+ * API for the XPay checkout flow — client endpoints and SSR
240
+ * OpenAPI spec version: 1.0
241
+ */
242
+
243
+ interface BalanceTransactionPayoutBatchDto {
244
+ /** PayoutBatch ID */
245
+ id: string;
246
+ object: string;
247
+ /** Total disbursement amount (batch total) */
248
+ amount: number;
249
+ currency: BalanceTransactionPayoutBatchDtoCurrency;
250
+ /** Batch lifecycle status. Merchant-facing status equals the batch status (not the individual payout status). */
251
+ status: BalanceTransactionPayoutBatchDtoStatus;
252
+ /**
253
+ * Expected / actual arrival date (ISO date, merchant business calendar). Null while batch is still OPEN / PROCESSING.
254
+ * @nullable
255
+ */
256
+ arrivalDate?: string | null;
257
+ /** Batch created timestamp (ISO 8601) */
258
+ createdAt: string;
259
+ /** Batch last-updated timestamp (ISO 8601) */
260
+ updatedAt: string;
261
+ }
262
+
263
+ /**
264
+ * Generated by orval v7.21.0 🍺
265
+ * Do not edit manually.
266
+ * XPay Checkout API
267
+ * API for the XPay checkout flow — client endpoints and SSR
268
+ * OpenAPI spec version: 1.0
269
+ */
270
+ /**
271
+ * Currency
272
+ */
273
+ type BalanceTransactionResponseDtoCurrency = typeof BalanceTransactionResponseDtoCurrency[keyof typeof BalanceTransactionResponseDtoCurrency];
274
+ declare const BalanceTransactionResponseDtoCurrency: {
275
+ readonly EGP: "EGP";
276
+ readonly USD: "USD";
277
+ readonly EUR: "EUR";
278
+ readonly GBP: "GBP";
279
+ readonly SAR: "SAR";
280
+ readonly AED: "AED";
281
+ readonly QAR: "QAR";
282
+ readonly KWD: "KWD";
283
+ readonly JOD: "JOD";
284
+ readonly OMR: "OMR";
285
+ readonly BHD: "BHD";
286
+ readonly LYD: "LYD";
287
+ readonly AUD: "AUD";
288
+ readonly CAD: "CAD";
289
+ readonly CNY: "CNY";
290
+ };
291
+
292
+ /**
293
+ * Generated by orval v7.21.0 🍺
294
+ * Do not edit manually.
295
+ * XPay Checkout API
296
+ * API for the XPay checkout flow — client endpoints and SSR
297
+ * OpenAPI spec version: 1.0
298
+ */
299
+ /**
300
+ * Transaction status
301
+ */
302
+ type BalanceTransactionResponseDtoStatus = typeof BalanceTransactionResponseDtoStatus[keyof typeof BalanceTransactionResponseDtoStatus];
303
+ declare const BalanceTransactionResponseDtoStatus: {
304
+ readonly AVAILABLE: "AVAILABLE";
305
+ readonly PENDING: "PENDING";
306
+ };
307
+
308
+ /**
309
+ * Generated by orval v7.21.0 🍺
310
+ * Do not edit manually.
311
+ * XPay Checkout API
312
+ * API for the XPay checkout flow — client endpoints and SSR
313
+ * OpenAPI spec version: 1.0
314
+ */
315
+ /**
316
+ * Transaction type
317
+ */
318
+ type BalanceTransactionResponseDtoType = typeof BalanceTransactionResponseDtoType[keyof typeof BalanceTransactionResponseDtoType];
319
+ declare const BalanceTransactionResponseDtoType: {
320
+ readonly CHARGE: "CHARGE";
321
+ readonly PAYMENT: "PAYMENT";
322
+ readonly PAYMENT_FAILURE_REFUND: "PAYMENT_FAILURE_REFUND";
323
+ readonly PAYMENT_REFUND: "PAYMENT_REFUND";
324
+ readonly PAYMENT_REVERSAL: "PAYMENT_REVERSAL";
325
+ readonly REFUND: "REFUND";
326
+ readonly REFUND_FAILURE: "REFUND_FAILURE";
327
+ readonly ADJUSTMENT: "ADJUSTMENT";
328
+ readonly ADVANCE: "ADVANCE";
329
+ readonly ADVANCE_FUNDING: "ADVANCE_FUNDING";
330
+ readonly PAYOUT: "PAYOUT";
331
+ readonly PAYOUT_CANCEL: "PAYOUT_CANCEL";
332
+ readonly PAYOUT_FAILURE: "PAYOUT_FAILURE";
333
+ readonly PAYOUT_MINIMUM_BALANCE_HOLD: "PAYOUT_MINIMUM_BALANCE_HOLD";
334
+ readonly PAYOUT_MINIMUM_BALANCE_RELEASE: "PAYOUT_MINIMUM_BALANCE_RELEASE";
335
+ readonly RESERVED_FUNDS: "RESERVED_FUNDS";
336
+ readonly RESERVE_HOLD: "RESERVE_HOLD";
337
+ readonly RESERVE_RELEASE: "RESERVE_RELEASE";
338
+ readonly RECOVERY_FROM_FUTURE_FUNDS: "RECOVERY_FROM_FUTURE_FUNDS";
339
+ readonly XPAY_FEE: "XPAY_FEE";
340
+ readonly XPAY_FX_FEE: "XPAY_FX_FEE";
341
+ readonly TAX_FEE: "TAX_FEE";
342
+ readonly TOPUP: "TOPUP";
343
+ readonly TOPUP_REVERSAL: "TOPUP_REVERSAL";
344
+ };
345
+
346
+ /**
347
+ * Generated by orval v7.21.0 🍺
348
+ * Do not edit manually.
349
+ * XPay Checkout API
350
+ * API for the XPay checkout flow — client endpoints and SSR
351
+ * OpenAPI spec version: 1.0
352
+ */
353
+
354
+ /**
355
+ * The PayoutBatch this balance transaction was included in, or null until it's batched.
356
+ * @nullable
357
+ */
358
+ type BalanceTransactionResponseDtoPayoutBatch = BalanceTransactionPayoutBatchDto | null;
359
+
360
+ /**
361
+ * Generated by orval v7.21.0 🍺
362
+ * Do not edit manually.
363
+ * XPay Checkout API
364
+ * API for the XPay checkout flow — client endpoints and SSR
365
+ * OpenAPI spec version: 1.0
366
+ */
367
+
368
+ /**
369
+ * A Balance Transaction records every movement of money in or out of your xpay balance: successful charges, refunds, payouts, processing fees, and adjustments. Each Balance Transaction links back to its `source` (the Charge, Refund, or Payout that produced it) and breaks down `gross`, `fee`, and `net` amounts. Use Balance Transactions to reconcile what was paid into your account against what was settled to your bank.
370
+ */
371
+ interface BalanceTransactionResponseDto {
372
+ /** Balance transaction ID */
373
+ id: string;
374
+ /** Object type */
375
+ object: string;
376
+ /** Gross amount (positive for money in, negative for money out) in smallest currency unit */
377
+ amount: number;
378
+ /**
379
+ * Timestamp when funds become available in balance (ISO 8601)
380
+ * @nullable
381
+ */
382
+ availableOn?: string | null;
383
+ /** Created timestamp (ISO 8601) */
384
+ createdAt: string;
385
+ /** Currency */
386
+ currency: BalanceTransactionResponseDtoCurrency;
387
+ /**
388
+ * Human-readable description
389
+ * @nullable
390
+ */
391
+ description?: string | null;
392
+ /** Total fees in smallest currency unit */
393
+ fee: number;
394
+ /** Net amount after fees in smallest currency unit */
395
+ net: number;
396
+ /** Breakdown of the `fee`. Platform COGS entries (PROCESSOR_COST) are stripped before emission — merchants only see the fees they care about. */
397
+ feeDetails: BalanceTransactionFeeDetailDto[];
398
+ /** Transaction status */
399
+ status: BalanceTransactionResponseDtoStatus;
400
+ /** Transaction type */
401
+ type: BalanceTransactionResponseDtoType;
402
+ /** Reporting category for accounting/analytics. Falls back to `type` when the entity has no explicit override. */
403
+ reportingCategory: string;
404
+ /**
405
+ * Exchange rate when currency conversion occurred
406
+ * @nullable
407
+ */
408
+ exchangeRate?: number | null;
409
+ /** Source resource id (charge, refund, payout, topup, dispute). Scalar id only — merchants query the source explicitly. */
410
+ source: string;
411
+ /**
412
+ * The PayoutBatch this balance transaction was included in, or null until it's batched.
413
+ * @nullable
414
+ */
415
+ payoutBatch: BalanceTransactionResponseDtoPayoutBatch;
416
+ /**
417
+ * Associated payment intent ID (if applicable)
418
+ * @nullable
419
+ */
420
+ paymentIntentId?: string | null;
421
+ /** Merchant ID owning this balance transaction */
422
+ merchantId: string;
423
+ }
424
+
425
+ /**
426
+ * Generated by orval v7.21.0 🍺
427
+ * Do not edit manually.
428
+ * XPay Checkout API
429
+ * API for the XPay checkout flow — client endpoints and SSR
430
+ * OpenAPI spec version: 1.0
431
+ */
432
+ type BankTransferDestinationDetailsDtoReferenceStatus = typeof BankTransferDestinationDetailsDtoReferenceStatus[keyof typeof BankTransferDestinationDetailsDtoReferenceStatus];
433
+ declare const BankTransferDestinationDetailsDtoReferenceStatus: {
434
+ readonly pending: "pending";
435
+ readonly available: "available";
436
+ readonly unavailable: "unavailable";
437
+ };
438
+
439
+ /**
440
+ * Generated by orval v7.21.0 🍺
441
+ * Do not edit manually.
442
+ * XPay Checkout API
443
+ * API for the XPay checkout flow — client endpoints and SSR
444
+ * OpenAPI spec version: 1.0
445
+ */
446
+
447
+ interface BankTransferDestinationDetailsDto {
448
+ reference?: string;
449
+ referenceStatus?: BankTransferDestinationDetailsDtoReferenceStatus;
450
+ }
451
+
452
+ /**
453
+ * Generated by orval v7.21.0 🍺
454
+ * Do not edit manually.
455
+ * XPay Checkout API
456
+ * API for the XPay checkout flow — client endpoints and SSR
457
+ * OpenAPI spec version: 1.0
458
+ */
459
+
460
+ interface BillingDetailsDto {
461
+ address: AddressDto;
462
+ email: string;
463
+ name: string;
464
+ phone: string;
465
+ }
466
+
467
+ /**
468
+ * Generated by orval v7.21.0 🍺
469
+ * Do not edit manually.
470
+ * XPay Checkout API
471
+ * API for the XPay checkout flow — client endpoints and SSR
472
+ * OpenAPI spec version: 1.0
473
+ */
474
+
475
+ interface BillingDetailsResponseDto {
476
+ /** Cardholder name (name on card) */
477
+ name?: string;
478
+ /** Billing email */
479
+ email?: string;
480
+ /** Billing phone */
481
+ phone?: string;
482
+ /** Billing address */
483
+ address?: AddressResponseDto;
484
+ }
485
+
486
+ /**
487
+ * Generated by orval v7.21.0 🍺
488
+ * Do not edit manually.
489
+ * XPay Checkout API
490
+ * API for the XPay checkout flow — client endpoints and SSR
491
+ * OpenAPI spec version: 1.0
492
+ */
493
+ /**
494
+ * Dark mode preference
495
+ */
496
+ type BrandingSettingsResponseDtoColorMode = typeof BrandingSettingsResponseDtoColorMode[keyof typeof BrandingSettingsResponseDtoColorMode];
497
+ declare const BrandingSettingsResponseDtoColorMode: {
498
+ readonly light: "light";
499
+ readonly dark: "dark";
500
+ readonly system: "system";
501
+ };
502
+
503
+ /**
504
+ * Generated by orval v7.21.0 🍺
505
+ * Do not edit manually.
506
+ * XPay Checkout API
507
+ * API for the XPay checkout flow — client endpoints and SSR
508
+ * OpenAPI spec version: 1.0
509
+ */
510
+ /**
511
+ * Border style for inputs, buttons, cards
512
+ */
513
+ type BrandingSettingsResponseDtoBorderStyle = typeof BrandingSettingsResponseDtoBorderStyle[keyof typeof BrandingSettingsResponseDtoBorderStyle];
514
+ declare const BrandingSettingsResponseDtoBorderStyle: {
515
+ readonly rounded: "rounded";
516
+ readonly sharp: "sharp";
517
+ readonly pill: "pill";
518
+ };
519
+
520
+ /**
521
+ * Generated by orval v7.21.0 🍺
522
+ * Do not edit manually.
523
+ * XPay Checkout API
524
+ * API for the XPay checkout flow — client endpoints and SSR
525
+ * OpenAPI spec version: 1.0
526
+ */
527
+ /**
528
+ * Spacing density
529
+ */
530
+ type BrandingSettingsResponseDtoSpacing = typeof BrandingSettingsResponseDtoSpacing[keyof typeof BrandingSettingsResponseDtoSpacing];
531
+ declare const BrandingSettingsResponseDtoSpacing: {
532
+ readonly condensed: "condensed";
533
+ readonly normal: "normal";
534
+ readonly spacious: "spacious";
535
+ };
536
+
537
+ /**
538
+ * Generated by orval v7.21.0 🍺
539
+ * Do not edit manually.
540
+ * XPay Checkout API
541
+ * API for the XPay checkout flow — client endpoints and SSR
542
+ * OpenAPI spec version: 1.0
543
+ */
544
+ /**
545
+ * Input field size
546
+ */
547
+ type BrandingSettingsResponseDtoInputSize = typeof BrandingSettingsResponseDtoInputSize[keyof typeof BrandingSettingsResponseDtoInputSize];
548
+ declare const BrandingSettingsResponseDtoInputSize: {
549
+ readonly small: "small";
550
+ readonly medium: "medium";
551
+ readonly large: "large";
552
+ };
553
+
554
+ /**
555
+ * Generated by orval v7.21.0 🍺
556
+ * Do not edit manually.
557
+ * XPay Checkout API
558
+ * API for the XPay checkout flow — client endpoints and SSR
559
+ * OpenAPI spec version: 1.0
560
+ */
561
+ /**
562
+ * Input field style
563
+ */
564
+ type BrandingSettingsResponseDtoInputStyle = typeof BrandingSettingsResponseDtoInputStyle[keyof typeof BrandingSettingsResponseDtoInputStyle];
565
+ declare const BrandingSettingsResponseDtoInputStyle: {
566
+ readonly flat: "flat";
567
+ readonly outlined: "outlined";
568
+ readonly filled: "filled";
569
+ };
570
+
571
+ /**
572
+ * Generated by orval v7.21.0 🍺
573
+ * Do not edit manually.
574
+ * XPay Checkout API
575
+ * API for the XPay checkout flow — client endpoints and SSR
576
+ * OpenAPI spec version: 1.0
577
+ */
578
+ /**
579
+ * Form layout density
580
+ */
581
+ type BrandingSettingsResponseDtoFormLayout = typeof BrandingSettingsResponseDtoFormLayout[keyof typeof BrandingSettingsResponseDtoFormLayout];
582
+ declare const BrandingSettingsResponseDtoFormLayout: {
583
+ readonly compact: "compact";
584
+ readonly spacious: "spacious";
585
+ };
586
+
587
+ /**
588
+ * Generated by orval v7.21.0 🍺
589
+ * Do not edit manually.
590
+ * XPay Checkout API
591
+ * API for the XPay checkout flow — client endpoints and SSR
592
+ * OpenAPI spec version: 1.0
593
+ */
594
+ interface ColorCustomizationResponseDto {
595
+ /** Primary brand color (buttons, links, accents). Hex only, e.g. `#635bff`. */
596
+ primary?: string;
597
+ /** Primary foreground (text on primary background). Hex only. */
598
+ primaryForeground?: string;
599
+ /** Page background color. Hex only. */
600
+ background?: string;
601
+ /** Main text color. Hex only. */
602
+ foreground?: string;
603
+ /** Border color. Hex only. */
604
+ border?: string;
605
+ /** Input, button, and dropdown border color. Hex only. */
606
+ input?: string;
607
+ /** Focus ring color. Hex only. */
608
+ ring?: string;
609
+ /** Muted/secondary background. Hex only. */
610
+ muted?: string;
611
+ /** Muted text color. Hex only. */
612
+ mutedForeground?: string;
613
+ /** Accent background. Hex only. */
614
+ accent?: string;
615
+ /** Accent text color. Hex only. */
616
+ accentForeground?: string;
617
+ /** Destructive/error color. Hex only. */
618
+ destructive?: string;
619
+ }
620
+
621
+ /**
622
+ * Generated by orval v7.21.0 🍺
623
+ * Do not edit manually.
624
+ * XPay Checkout API
625
+ * API for the XPay checkout flow — client endpoints and SSR
626
+ * OpenAPI spec version: 1.0
627
+ */
628
+
629
+ interface BrandingSettingsResponseDto {
630
+ /** Dark mode preference */
631
+ colorMode?: BrandingSettingsResponseDtoColorMode;
632
+ /** Border style for inputs, buttons, cards */
633
+ borderStyle?: BrandingSettingsResponseDtoBorderStyle;
634
+ /** Spacing density */
635
+ spacing?: BrandingSettingsResponseDtoSpacing;
636
+ /** Input field size */
637
+ inputSize?: BrandingSettingsResponseDtoInputSize;
638
+ /** Input field style */
639
+ inputStyle?: BrandingSettingsResponseDtoInputStyle;
640
+ /** Form layout density */
641
+ formLayout?: BrandingSettingsResponseDtoFormLayout;
642
+ /** Color customization options */
643
+ colors?: ColorCustomizationResponseDto;
644
+ /** Font family override */
645
+ fontFamily?: string;
646
+ }
647
+
648
+ /**
649
+ * Generated by orval v7.21.0 🍺
650
+ * Do not edit manually.
651
+ * XPay Checkout API
652
+ * API for the XPay checkout flow — client endpoints and SSR
653
+ * OpenAPI spec version: 1.0
654
+ */
655
+ type CardDestinationDetailsDtoReferenceStatus = typeof CardDestinationDetailsDtoReferenceStatus[keyof typeof CardDestinationDetailsDtoReferenceStatus];
656
+ declare const CardDestinationDetailsDtoReferenceStatus: {
657
+ readonly pending: "pending";
658
+ readonly available: "available";
659
+ readonly unavailable: "unavailable";
660
+ };
661
+
662
+ /**
663
+ * Generated by orval v7.21.0 🍺
664
+ * Do not edit manually.
665
+ * XPay Checkout API
666
+ * API for the XPay checkout flow — client endpoints and SSR
667
+ * OpenAPI spec version: 1.0
668
+ */
669
+ type CardDestinationDetailsDtoType = typeof CardDestinationDetailsDtoType[keyof typeof CardDestinationDetailsDtoType];
670
+ declare const CardDestinationDetailsDtoType: {
671
+ readonly pending: "pending";
672
+ readonly refund: "refund";
673
+ readonly reversal: "reversal";
674
+ };
675
+
676
+ /**
677
+ * Generated by orval v7.21.0 🍺
678
+ * Do not edit manually.
679
+ * XPay Checkout API
680
+ * API for the XPay checkout flow — client endpoints and SSR
681
+ * OpenAPI spec version: 1.0
682
+ */
683
+
684
+ interface CardDestinationDetailsDto {
685
+ /** Acquirer reference number (ARN) */
686
+ reference?: string;
687
+ referenceStatus?: CardDestinationDetailsDtoReferenceStatus;
688
+ referenceType?: string;
689
+ type?: CardDestinationDetailsDtoType;
690
+ }
691
+
692
+ /**
693
+ * Generated by orval v7.21.0 🍺
694
+ * Do not edit manually.
695
+ * XPay Checkout API
696
+ * API for the XPay checkout flow — client endpoints and SSR
697
+ * OpenAPI spec version: 1.0
698
+ */
699
+ interface CardInfoResponseDto {
700
+ /** Card brand (e.g., Visa, Mastercard) */
701
+ brand: string;
702
+ /** Whether this is an on-us transaction (same bank) */
703
+ isOnUs: boolean;
704
+ /** Whether this is an international card */
705
+ isInternational: boolean;
706
+ }
707
+
708
+ /**
709
+ * Generated by orval v7.21.0 🍺
710
+ * Do not edit manually.
711
+ * XPay Checkout API
712
+ * API for the XPay checkout flow — client endpoints and SSR
713
+ * OpenAPI spec version: 1.0
714
+ */
715
+ interface ThreeDSecureDto {
716
+ authenticationFlow: string;
717
+ electronicCommerceIndicator: string;
718
+ exemptionIndicator: string;
719
+ result: string;
720
+ resultReason: string;
721
+ transactionId: string;
722
+ version: string;
723
+ }
724
+
725
+ /**
726
+ * Generated by orval v7.21.0 🍺
727
+ * Do not edit manually.
728
+ * XPay Checkout API
729
+ * API for the XPay checkout flow — client endpoints and SSR
730
+ * OpenAPI spec version: 1.0
731
+ */
732
+ interface WalletDto {
733
+ type: string;
734
+ dynamicLast4: string;
735
+ }
736
+
737
+ /**
738
+ * Generated by orval v7.21.0 🍺
739
+ * Do not edit manually.
740
+ * XPay Checkout API
741
+ * API for the XPay checkout flow — client endpoints and SSR
742
+ * OpenAPI spec version: 1.0
743
+ */
744
+
745
+ interface ChargeCardDetailsDto {
746
+ brand: string;
747
+ country: string;
748
+ expMonth: number;
749
+ expYear: number;
750
+ funding: string;
751
+ last4: string;
752
+ network: string;
753
+ /** Card fingerprint for identifying the same card across customers */
754
+ fingerprint: string;
755
+ threeDSecure: ThreeDSecureDto;
756
+ wallet: WalletDto;
757
+ }
758
+
759
+ /**
760
+ * Generated by orval v7.21.0 🍺
761
+ * Do not edit manually.
762
+ * XPay Checkout API
763
+ * API for the XPay checkout flow — client endpoints and SSR
764
+ * OpenAPI spec version: 1.0
765
+ */
766
+ interface ChargeConfigDto {
767
+ vatCollectionEnabled: boolean;
768
+ vatCollectionRate: number;
769
+ collectedVatAmount: number;
770
+ platformFeePassThrough: boolean;
771
+ merchantFeeDeduction: number;
772
+ }
773
+
774
+ /**
775
+ * Generated by orval v7.21.0 🍺
776
+ * Do not edit manually.
777
+ * XPay Checkout API
778
+ * API for the XPay checkout flow — client endpoints and SSR
779
+ * OpenAPI spec version: 1.0
780
+ */
781
+ interface ChargeGeocodingLocationDto {
782
+ /** ISO 3166-1 alpha-2 country code */
783
+ countryCode?: string;
784
+ /** English country name */
785
+ countryName?: string;
786
+ /** ISO 3166-2 region code */
787
+ regionCode?: string;
788
+ /** English region/state name */
789
+ regionName?: string;
790
+ /** English city name */
791
+ cityName?: string;
792
+ }
793
+
794
+ /**
795
+ * Generated by orval v7.21.0 🍺
796
+ * Do not edit manually.
797
+ * XPay Checkout API
798
+ * API for the XPay checkout flow — client endpoints and SSR
799
+ * OpenAPI spec version: 1.0
800
+ */
801
+
802
+ interface ChargeGeocodingDto {
803
+ /** The IP address that was resolved */
804
+ ipAddress: string;
805
+ location?: ChargeGeocodingLocationDto;
806
+ }
807
+
808
+ /**
809
+ * Generated by orval v7.21.0 🍺
810
+ * Do not edit manually.
811
+ * XPay Checkout API
812
+ * API for the XPay checkout flow — client endpoints and SSR
813
+ * OpenAPI spec version: 1.0
814
+ */
815
+ type ChargeResponseDtoCurrency = typeof ChargeResponseDtoCurrency[keyof typeof ChargeResponseDtoCurrency];
816
+ declare const ChargeResponseDtoCurrency: {
817
+ readonly EGP: "EGP";
818
+ readonly USD: "USD";
819
+ readonly EUR: "EUR";
820
+ readonly GBP: "GBP";
821
+ readonly SAR: "SAR";
822
+ readonly AED: "AED";
823
+ readonly QAR: "QAR";
824
+ readonly KWD: "KWD";
825
+ readonly JOD: "JOD";
826
+ readonly OMR: "OMR";
827
+ readonly BHD: "BHD";
828
+ readonly LYD: "LYD";
829
+ readonly AUD: "AUD";
830
+ readonly CAD: "CAD";
831
+ readonly CNY: "CNY";
832
+ };
833
+
834
+ /**
835
+ * Generated by orval v7.21.0 🍺
836
+ * Do not edit manually.
837
+ * XPay Checkout API
838
+ * API for the XPay checkout flow — client endpoints and SSR
839
+ * OpenAPI spec version: 1.0
840
+ */
841
+
842
+ /**
843
+ * @nullable
844
+ */
845
+ type PaymentMethodDetailsDtoCard = ChargeCardDetailsDto | null;
846
+
847
+ /**
848
+ * Generated by orval v7.21.0 🍺
849
+ * Do not edit manually.
850
+ * XPay Checkout API
851
+ * API for the XPay checkout flow — client endpoints and SSR
852
+ * OpenAPI spec version: 1.0
853
+ */
854
+ interface ValuDetailsDto {
855
+ /**
856
+ * Loan number from the provider
857
+ * @nullable
858
+ */
859
+ loanNumber?: string | null;
860
+ /**
861
+ * Loan tenure in months
862
+ * @nullable
863
+ */
864
+ tenure?: number | null;
865
+ /**
866
+ * Monthly installment amount
867
+ * @nullable
868
+ */
869
+ emi?: string | null;
870
+ /**
871
+ * Down payment amount
872
+ * @nullable
873
+ */
874
+ downPayment?: string | null;
875
+ /**
876
+ * Total financed amount
877
+ * @nullable
878
+ */
879
+ financedAmount?: string | null;
880
+ /**
881
+ * First EMI due date
882
+ * @nullable
883
+ */
884
+ firstEmiDueDate?: string | null;
885
+ /**
886
+ * Last installment date
887
+ * @nullable
888
+ */
889
+ lastInstallmentDate?: string | null;
890
+ }
891
+
892
+ /**
893
+ * Generated by orval v7.21.0 🍺
894
+ * Do not edit manually.
895
+ * XPay Checkout API
896
+ * API for the XPay checkout flow — client endpoints and SSR
897
+ * OpenAPI spec version: 1.0
898
+ */
899
+
900
+ /**
901
+ * ValU details (if type is 'valu')
902
+ * @nullable
903
+ */
904
+ type PaymentMethodDetailsDtoValu = ValuDetailsDto | null;
905
+
906
+ /**
907
+ * Generated by orval v7.21.0 🍺
908
+ * Do not edit manually.
909
+ * XPay Checkout API
910
+ * API for the XPay checkout flow — client endpoints and SSR
911
+ * OpenAPI spec version: 1.0
912
+ */
913
+
914
+ interface PaymentMethodDetailsDto {
915
+ /** Concrete PaymentMethodType value: 'card', 'valu', etc. */
916
+ type: string;
917
+ /** @nullable */
918
+ card?: PaymentMethodDetailsDtoCard;
919
+ /**
920
+ * ValU details (if type is 'valu')
921
+ * @nullable
922
+ */
923
+ valu?: PaymentMethodDetailsDtoValu;
924
+ }
925
+
926
+ /**
927
+ * Generated by orval v7.21.0 🍺
928
+ * Do not edit manually.
929
+ * XPay Checkout API
930
+ * API for the XPay checkout flow — client endpoints and SSR
931
+ * OpenAPI spec version: 1.0
932
+ */
933
+ interface OutcomeDto {
934
+ networkStatus: string;
935
+ reason: string;
936
+ riskLevel: string;
937
+ riskScore: number;
938
+ sellerMessage: string;
939
+ type: string;
940
+ }
941
+
942
+ /**
943
+ * Generated by orval v7.21.0 🍺
944
+ * Do not edit manually.
945
+ * XPay Checkout API
946
+ * API for the XPay checkout flow — client endpoints and SSR
947
+ * OpenAPI spec version: 1.0
948
+ */
949
+
950
+ /**
951
+ * @nullable
952
+ */
953
+ type ChargeResponseDtoBalanceTransaction = BalanceTransactionResponseDto | null;
954
+
955
+ /**
956
+ * Generated by orval v7.21.0 🍺
957
+ * Do not edit manually.
958
+ * XPay Checkout API
959
+ * API for the XPay checkout flow — client endpoints and SSR
960
+ * OpenAPI spec version: 1.0
961
+ */
962
+ /**
963
+ * Customer's currency code (ISO 4217)
964
+ */
965
+ type PresentmentDetailsDtoCurrency = typeof PresentmentDetailsDtoCurrency[keyof typeof PresentmentDetailsDtoCurrency];
966
+ declare const PresentmentDetailsDtoCurrency: {
967
+ readonly EGP: "EGP";
968
+ readonly USD: "USD";
969
+ readonly EUR: "EUR";
970
+ readonly GBP: "GBP";
971
+ readonly SAR: "SAR";
972
+ readonly AED: "AED";
973
+ readonly QAR: "QAR";
974
+ readonly KWD: "KWD";
975
+ readonly JOD: "JOD";
976
+ readonly OMR: "OMR";
977
+ readonly BHD: "BHD";
978
+ readonly LYD: "LYD";
979
+ readonly AUD: "AUD";
980
+ readonly CAD: "CAD";
981
+ readonly CNY: "CNY";
982
+ };
983
+
984
+ /**
985
+ * Generated by orval v7.21.0 🍺
986
+ * Do not edit manually.
987
+ * XPay Checkout API
988
+ * API for the XPay checkout flow — client endpoints and SSR
989
+ * OpenAPI spec version: 1.0
990
+ */
991
+
992
+ interface PresentmentDetailsDto {
993
+ /** Amount in the customer's currency (smallest unit — e.g. fils for KWD, cents for USD) */
994
+ amount: number;
995
+ /** Customer's currency code (ISO 4217) */
996
+ currency: PresentmentDetailsDtoCurrency;
997
+ /** Locked exchange rate: presentment_major × rate = processing_major. Reused for refunds/disputes. Stored as numeric(15,6) — frontend can call `.toFixed(6)` to render the full 6-decimal string when needed. */
998
+ exchangeRate: number;
999
+ /** Reference to the immutable ExchangeRate record used — audit trail for FX reconciliation */
1000
+ exchangeRateId: string;
1001
+ }
1002
+
1003
+ /**
1004
+ * Generated by orval v7.21.0 🍺
1005
+ * Do not edit manually.
1006
+ * XPay Checkout API
1007
+ * API for the XPay checkout flow — client endpoints and SSR
1008
+ * OpenAPI spec version: 1.0
1009
+ */
1010
+ /**
1011
+ * Three-letter ISO currency code
1012
+ */
1013
+ type RefundResponseDtoCurrency = typeof RefundResponseDtoCurrency[keyof typeof RefundResponseDtoCurrency];
1014
+ declare const RefundResponseDtoCurrency: {
1015
+ readonly EGP: "EGP";
1016
+ readonly USD: "USD";
1017
+ readonly EUR: "EUR";
1018
+ readonly GBP: "GBP";
1019
+ readonly SAR: "SAR";
1020
+ readonly AED: "AED";
1021
+ readonly QAR: "QAR";
1022
+ readonly KWD: "KWD";
1023
+ readonly JOD: "JOD";
1024
+ readonly OMR: "OMR";
1025
+ readonly BHD: "BHD";
1026
+ readonly LYD: "LYD";
1027
+ readonly AUD: "AUD";
1028
+ readonly CAD: "CAD";
1029
+ readonly CNY: "CNY";
1030
+ };
1031
+
1032
+ /**
1033
+ * Generated by orval v7.21.0 🍺
1034
+ * Do not edit manually.
1035
+ * XPay Checkout API
1036
+ * API for the XPay checkout flow — client endpoints and SSR
1037
+ * OpenAPI spec version: 1.0
1038
+ */
1039
+ /**
1040
+ * Status of the refund (pending, requires_action, succeeded, failed, canceled)
1041
+ */
1042
+ type RefundResponseDtoStatus = typeof RefundResponseDtoStatus[keyof typeof RefundResponseDtoStatus];
1043
+ declare const RefundResponseDtoStatus: {
1044
+ readonly PENDING: "PENDING";
1045
+ readonly REQUIRES_ACTION: "REQUIRES_ACTION";
1046
+ readonly SUCCEEDED: "SUCCEEDED";
1047
+ readonly FAILED: "FAILED";
1048
+ readonly CANCELED: "CANCELED";
1049
+ };
1050
+
1051
+ /**
1052
+ * Generated by orval v7.21.0 🍺
1053
+ * Do not edit manually.
1054
+ * XPay Checkout API
1055
+ * API for the XPay checkout flow — client endpoints and SSR
1056
+ * OpenAPI spec version: 1.0
1057
+ */
1058
+ /**
1059
+ * Reason for the refund
1060
+ */
1061
+ type RefundResponseDtoReason = typeof RefundResponseDtoReason[keyof typeof RefundResponseDtoReason];
1062
+ declare const RefundResponseDtoReason: {
1063
+ readonly DUPLICATE: "DUPLICATE";
1064
+ readonly FRAUDULENT: "FRAUDULENT";
1065
+ readonly REQUESTED_BY_CUSTOMER: "REQUESTED_BY_CUSTOMER";
1066
+ readonly RISK_HOLD_CAPTURE: "RISK_HOLD_CAPTURE";
1067
+ };
1068
+
1069
+ /**
1070
+ * Generated by orval v7.21.0 🍺
1071
+ * Do not edit manually.
1072
+ * XPay Checkout API
1073
+ * API for the XPay checkout flow — client endpoints and SSR
1074
+ * OpenAPI spec version: 1.0
1075
+ */
1076
+ /**
1077
+ * Reason for refund failure
1078
+ */
1079
+ type RefundResponseDtoFailureReason = typeof RefundResponseDtoFailureReason[keyof typeof RefundResponseDtoFailureReason];
1080
+ declare const RefundResponseDtoFailureReason: {
1081
+ readonly lost_or_stolen_card: "lost_or_stolen_card";
1082
+ readonly expired_or_canceled_card: "expired_or_canceled_card";
1083
+ readonly charge_for_pending_refund_disputed: "charge_for_pending_refund_disputed";
1084
+ readonly insufficient_funds: "insufficient_funds";
1085
+ readonly declined: "declined";
1086
+ readonly merchant_request: "merchant_request";
1087
+ readonly unknown: "unknown";
1088
+ };
1089
+
1090
+ /**
1091
+ * Generated by orval v7.21.0 🍺
1092
+ * Do not edit manually.
1093
+ * XPay Checkout API
1094
+ * API for the XPay checkout flow — client endpoints and SSR
1095
+ * OpenAPI spec version: 1.0
1096
+ */
1097
+ /**
1098
+ * Reason for pending status
1099
+ */
1100
+ type RefundResponseDtoPendingReason = typeof RefundResponseDtoPendingReason[keyof typeof RefundResponseDtoPendingReason];
1101
+ declare const RefundResponseDtoPendingReason: {
1102
+ readonly processing: "processing";
1103
+ readonly insufficient_funds: "insufficient_funds";
1104
+ readonly charge_pending: "charge_pending";
1105
+ };
1106
+
1107
+ /**
1108
+ * Generated by orval v7.21.0 🍺
1109
+ * Do not edit manually.
1110
+ * XPay Checkout API
1111
+ * API for the XPay checkout flow — client endpoints and SSR
1112
+ * OpenAPI spec version: 1.0
1113
+ */
1114
+ type RefundDestinationDetailsDtoType = typeof RefundDestinationDetailsDtoType[keyof typeof RefundDestinationDetailsDtoType];
1115
+ declare const RefundDestinationDetailsDtoType: {
1116
+ readonly card: "card";
1117
+ readonly wallet: "wallet";
1118
+ readonly bank_transfer: "bank_transfer";
1119
+ readonly kiosk: "kiosk";
1120
+ };
1121
+
1122
+ /**
1123
+ * Generated by orval v7.21.0 🍺
1124
+ * Do not edit manually.
1125
+ * XPay Checkout API
1126
+ * API for the XPay checkout flow — client endpoints and SSR
1127
+ * OpenAPI spec version: 1.0
1128
+ */
1129
+ interface WalletDestinationDetailsDto {
1130
+ /** Wallet transaction reference */
1131
+ reference?: string;
1132
+ /** Wallet provider (e.g., vodafone_cash, fawry) */
1133
+ provider?: string;
1134
+ }
1135
+
1136
+ /**
1137
+ * Generated by orval v7.21.0 🍺
1138
+ * Do not edit manually.
1139
+ * XPay Checkout API
1140
+ * API for the XPay checkout flow — client endpoints and SSR
1141
+ * OpenAPI spec version: 1.0
1142
+ */
1143
+ interface KioskDestinationDetailsDto {
1144
+ reference?: string;
1145
+ provider?: string;
1146
+ }
1147
+
1148
+ /**
1149
+ * Generated by orval v7.21.0 🍺
1150
+ * Do not edit manually.
1151
+ * XPay Checkout API
1152
+ * API for the XPay checkout flow — client endpoints and SSR
1153
+ * OpenAPI spec version: 1.0
1154
+ */
1155
+
1156
+ interface RefundDestinationDetailsDto {
1157
+ type: RefundDestinationDetailsDtoType;
1158
+ card?: CardDestinationDetailsDto;
1159
+ wallet?: WalletDestinationDetailsDto;
1160
+ bankTransfer?: BankTransferDestinationDetailsDto;
1161
+ kiosk?: KioskDestinationDetailsDto;
1162
+ }
1163
+
1164
+ /**
1165
+ * Generated by orval v7.21.0 🍺
1166
+ * Do not edit manually.
1167
+ * XPay Checkout API
1168
+ * API for the XPay checkout flow — client endpoints and SSR
1169
+ * OpenAPI spec version: 1.0
1170
+ */
1171
+ interface RefundNextActionDisplayDetailsDto {
1172
+ /** Email sent timestamp (ISO 8601) */
1173
+ emailSentAt?: string;
1174
+ emailSentTo?: string;
1175
+ /** Expiration timestamp (ISO 8601) */
1176
+ expiresAt?: string;
1177
+ }
1178
+
1179
+ /**
1180
+ * Generated by orval v7.21.0 🍺
1181
+ * Do not edit manually.
1182
+ * XPay Checkout API
1183
+ * API for the XPay checkout flow — client endpoints and SSR
1184
+ * OpenAPI spec version: 1.0
1185
+ */
1186
+
1187
+ interface RefundNextActionDto {
1188
+ type: string;
1189
+ displayDetails?: RefundNextActionDisplayDetailsDto;
1190
+ }
1191
+
1192
+ /**
1193
+ * Generated by orval v7.21.0 🍺
1194
+ * Do not edit manually.
1195
+ * XPay Checkout API
1196
+ * API for the XPay checkout flow — client endpoints and SSR
1197
+ * OpenAPI spec version: 1.0
1198
+ */
1199
+
1200
+ /**
1201
+ * A Refund returns funds from a successful Charge back to the customer's original payment method. Refunds can be full or partial, and a single Charge can be refunded multiple times up to its original amount. The Refund's `status` reflects the processor's progress as the money makes its way back: `pending` while in flight, `succeeded` once the funds have been returned, or `failed` if the processor rejected the request.
1202
+ */
1203
+ interface RefundResponseDto {
1204
+ /** Unique identifier for the refund */
1205
+ id: string;
1206
+ /** Object type */
1207
+ object: string;
1208
+ /** Refund amount in smallest currency unit */
1209
+ amount: number;
1210
+ /** ID of the charge being refunded */
1211
+ chargeId: string;
1212
+ /** ID of the PaymentIntent being refunded */
1213
+ paymentIntentId: string;
1214
+ /**
1215
+ * ID of the balance transaction for the refund, null until settled
1216
+ * @nullable
1217
+ */
1218
+ balanceTransactionId: string | null;
1219
+ /**
1220
+ * Balance transaction for failed refund reversal, null unless the refund failed
1221
+ * @nullable
1222
+ */
1223
+ failureBalanceTransactionId: string | null;
1224
+ /**
1225
+ * Processor-side refund id, null when not yet reconciled
1226
+ * @nullable
1227
+ */
1228
+ externalRefundId: string | null;
1229
+ /** Time at which the refund was created (ISO 8601) */
1230
+ createdAt: string;
1231
+ /** Three-letter ISO currency code */
1232
+ currency: RefundResponseDtoCurrency;
1233
+ /** Customer-facing view of the refund — amount in the original charge's presentment currency using the charge's LOCKED exchange rate. Populated only when the charge had a presentment currency different from processing. */
1234
+ presentmentDetails?: PresentmentDetailsDto;
1235
+ /** Status of the refund (pending, requires_action, succeeded, failed, canceled) */
1236
+ status: RefundResponseDtoStatus;
1237
+ /** Reason for the refund */
1238
+ reason?: RefundResponseDtoReason;
1239
+ /** Reason for refund failure */
1240
+ failureReason?: RefundResponseDtoFailureReason;
1241
+ /** Reason for pending status */
1242
+ pendingReason?: RefundResponseDtoPendingReason;
1243
+ /** Description for non-card refunds */
1244
+ description?: string;
1245
+ /** Payment method-specific refund details */
1246
+ destinationDetails?: RefundDestinationDetailsDto;
1247
+ /** Next action if requires_action */
1248
+ nextAction?: RefundNextActionDto;
1249
+ /** Email for refund instructions */
1250
+ instructionsEmail?: string;
1251
+ /** Receipt number for email receipts */
1252
+ receiptNumber?: string;
1253
+ /** Original platform fee (NOT refunded - kept by platform) */
1254
+ feeAmount?: number;
1255
+ }
1256
+
1257
+ /**
1258
+ * Generated by orval v7.21.0 🍺
1259
+ * Do not edit manually.
1260
+ * XPay Checkout API
1261
+ * API for the XPay checkout flow — client endpoints and SSR
1262
+ * OpenAPI spec version: 1.0
1263
+ */
1264
+ interface ChargeSessionDto {
1265
+ browser?: string;
1266
+ browserVersion?: string;
1267
+ platform?: string;
1268
+ device?: string;
1269
+ deviceVendor?: string;
1270
+ deviceModel?: string;
1271
+ }
1272
+
1273
+ /**
1274
+ * Generated by orval v7.21.0 🍺
1275
+ * Do not edit manually.
1276
+ * XPay Checkout API
1277
+ * API for the XPay checkout flow — client endpoints and SSR
1278
+ * OpenAPI spec version: 1.0
1279
+ */
1280
+ interface ProcessorCapabilitiesDto {
1281
+ /** Whether this processor supports refunds */
1282
+ supportsRefund: boolean;
1283
+ /** Whether partial refunds are supported */
1284
+ supportsPartialRefund: boolean;
1285
+ }
1286
+
1287
+ /**
1288
+ * Generated by orval v7.21.0 🍺
1289
+ * Do not edit manually.
1290
+ * XPay Checkout API
1291
+ * API for the XPay checkout flow — client endpoints and SSR
1292
+ * OpenAPI spec version: 1.0
1293
+ */
1294
+ /**
1295
+ * Settlement model snapshotted at charge time
1296
+ */
1297
+ type ChargeResponseDtoSettlementModel = typeof ChargeResponseDtoSettlementModel[keyof typeof ChargeResponseDtoSettlementModel];
1298
+ declare const ChargeResponseDtoSettlementModel: {
1299
+ readonly aggregated: "aggregated";
1300
+ readonly direct: "direct";
1301
+ };
1302
+
1303
+ /**
1304
+ * Generated by orval v7.21.0 🍺
1305
+ * Do not edit manually.
1306
+ * XPay Checkout API
1307
+ * API for the XPay checkout flow — client endpoints and SSR
1308
+ * OpenAPI spec version: 1.0
1309
+ */
1310
+
1311
+ /**
1312
+ * A Charge represents a single attempt to move money from a customer's payment method to your account. It records what was paid, by whom, through which processor, and the final outcome: `succeeded`, `failed`, or `refunded`. A single PaymentIntent may produce multiple Charges if earlier attempts fail; only the most recent successful Charge actually moves funds, and any subsequent Refunds reference it directly.
1313
+ */
1314
+ interface ChargeResponseDto {
1315
+ id: string;
1316
+ object: string;
1317
+ amount: number;
1318
+ amountCaptured: number;
1319
+ amountRefunded: number;
1320
+ currency: ChargeResponseDtoCurrency;
1321
+ /** Created timestamp (ISO 8601) */
1322
+ createdAt: string;
1323
+ status: string;
1324
+ paid: boolean;
1325
+ refunded: boolean;
1326
+ captured: boolean;
1327
+ /** Captured timestamp (ISO 8601) */
1328
+ capturedAt: string;
1329
+ failureCode: string;
1330
+ failureMessage: string;
1331
+ receiptUrl: string;
1332
+ receiptEmail: string;
1333
+ billingDetails: BillingDetailsDto;
1334
+ paymentMethodDetails: PaymentMethodDetailsDto;
1335
+ outcome: OutcomeDto;
1336
+ /** @nullable */
1337
+ balanceTransaction: ChargeResponseDtoBalanceTransaction;
1338
+ /** Present when customer paid in a different currency than settlement (EGP) */
1339
+ presentmentDetails?: PresentmentDetailsDto;
1340
+ /** Refunds issued against this charge, ordered newest-first. */
1341
+ refunds: RefundResponseDto[];
1342
+ paymentIntentId: string;
1343
+ paymentMethodId: string;
1344
+ calculatedStatementDescriptor: string;
1345
+ disputed: boolean;
1346
+ externalChargeId: string;
1347
+ config: ChargeConfigDto;
1348
+ geocoding?: ChargeGeocodingDto;
1349
+ session?: ChargeSessionDto;
1350
+ processorCapabilities?: ProcessorCapabilitiesDto;
1351
+ /**
1352
+ * ID of the currently-active risk hold on this charge, if any
1353
+ * @nullable
1354
+ */
1355
+ activeHoldId?: string | null;
1356
+ /** Settlement model snapshotted at charge time */
1357
+ settlementModel: ChargeResponseDtoSettlementModel;
1358
+ }
1359
+
1360
+ /**
1361
+ * Generated by orval v7.21.0 🍺
1362
+ * Do not edit manually.
1363
+ * XPay Checkout API
1364
+ * API for the XPay checkout flow — client endpoints and SSR
1365
+ * OpenAPI spec version: 1.0
1366
+ */
1367
+ /**
1368
+ * Customer type. `registered` is a permanent merchant-managed record; `guest` is a session-scope dedup unit created automatically when `customerCreation` is `if_required`.
1369
+ */
1370
+ type CheckoutSessionCustomerDtoType = typeof CheckoutSessionCustomerDtoType[keyof typeof CheckoutSessionCustomerDtoType];
1371
+ declare const CheckoutSessionCustomerDtoType: {
1372
+ readonly guest: "guest";
1373
+ readonly registered: "registered";
1374
+ };
1375
+
1376
+ /**
1377
+ * Generated by orval v7.21.0 🍺
1378
+ * Do not edit manually.
1379
+ * XPay Checkout API
1380
+ * API for the XPay checkout flow — client endpoints and SSR
1381
+ * OpenAPI spec version: 1.0
1382
+ */
1383
+
1384
+ interface ShippingResponseDto {
1385
+ /** Recipient name */
1386
+ name?: string;
1387
+ /** Recipient phone */
1388
+ phone?: string;
1389
+ /** Shipping address */
1390
+ address?: AddressResponseDto;
1391
+ }
1392
+
1393
+ /**
1394
+ * Generated by orval v7.21.0 🍺
1395
+ * Do not edit manually.
1396
+ * XPay Checkout API
1397
+ * API for the XPay checkout flow — client endpoints and SSR
1398
+ * OpenAPI spec version: 1.0
1399
+ */
1400
+ /**
1401
+ * Customer metadata
1402
+ */
1403
+ type CheckoutSessionCustomerDtoMetadata = {
1404
+ [key: string]: unknown;
1405
+ };
1406
+
1407
+ /**
1408
+ * Generated by orval v7.21.0 🍺
1409
+ * Do not edit manually.
1410
+ * XPay Checkout API
1411
+ * API for the XPay checkout flow — client endpoints and SSR
1412
+ * OpenAPI spec version: 1.0
1413
+ */
1414
+
1415
+ interface CheckoutSessionCustomerDto {
1416
+ /** Customer ID */
1417
+ id: string;
1418
+ /** Customer type. `registered` is a permanent merchant-managed record; `guest` is a session-scope dedup unit created automatically when `customerCreation` is `if_required`. */
1419
+ type: CheckoutSessionCustomerDtoType;
1420
+ /** Customer name */
1421
+ name?: string;
1422
+ /** Customer email */
1423
+ email?: string;
1424
+ /** Customer phone */
1425
+ phone?: string;
1426
+ /** Customer address */
1427
+ address?: AddressResponseDto;
1428
+ /** Customer shipping details */
1429
+ shipping?: ShippingResponseDto;
1430
+ /** Customer metadata */
1431
+ metadata?: CheckoutSessionCustomerDtoMetadata;
1432
+ }
1433
+
1434
+ /**
1435
+ * Generated by orval v7.21.0 🍺
1436
+ * Do not edit manually.
1437
+ * XPay Checkout API
1438
+ * API for the XPay checkout flow — client endpoints and SSR
1439
+ * OpenAPI spec version: 1.0
1440
+ */
1441
+ /**
1442
+ * Session mode
1443
+ */
1444
+ type CheckoutSessionResponseDtoMode = typeof CheckoutSessionResponseDtoMode[keyof typeof CheckoutSessionResponseDtoMode];
1445
+ declare const CheckoutSessionResponseDtoMode: {
1446
+ readonly payment: "payment";
1447
+ readonly setup: "setup";
1448
+ readonly subscription: "subscription";
1449
+ };
1450
+
1451
+ /**
1452
+ * Generated by orval v7.21.0 🍺
1453
+ * Do not edit manually.
1454
+ * XPay Checkout API
1455
+ * API for the XPay checkout flow — client endpoints and SSR
1456
+ * OpenAPI spec version: 1.0
1457
+ */
1458
+ /**
1459
+ * UI mode
1460
+ */
1461
+ type CheckoutSessionResponseDtoUiMode = typeof CheckoutSessionResponseDtoUiMode[keyof typeof CheckoutSessionResponseDtoUiMode];
1462
+ declare const CheckoutSessionResponseDtoUiMode: {
1463
+ readonly hosted: "hosted";
1464
+ readonly embedded: "embedded";
1465
+ readonly custom: "custom";
1466
+ };
1467
+
1468
+ /**
1469
+ * Generated by orval v7.21.0 🍺
1470
+ * Do not edit manually.
1471
+ * XPay Checkout API
1472
+ * API for the XPay checkout flow — client endpoints and SSR
1473
+ * OpenAPI spec version: 1.0
1474
+ */
1475
+ /**
1476
+ * Submit type
1477
+ */
1478
+ type CheckoutSessionResponseDtoSubmitType = typeof CheckoutSessionResponseDtoSubmitType[keyof typeof CheckoutSessionResponseDtoSubmitType];
1479
+ declare const CheckoutSessionResponseDtoSubmitType: {
1480
+ readonly PAY: "PAY";
1481
+ readonly SUBSCRIBE: "SUBSCRIBE";
1482
+ readonly BOOK: "BOOK";
1483
+ readonly DONATE: "DONATE";
1484
+ };
1485
+
1486
+ /**
1487
+ * Generated by orval v7.21.0 🍺
1488
+ * Do not edit manually.
1489
+ * XPay Checkout API
1490
+ * API for the XPay checkout flow — client endpoints and SSR
1491
+ * OpenAPI spec version: 1.0
1492
+ */
1493
+ /**
1494
+ * Customer creation mode
1495
+ */
1496
+ type CheckoutSessionResponseDtoCustomerCreation = typeof CheckoutSessionResponseDtoCustomerCreation[keyof typeof CheckoutSessionResponseDtoCustomerCreation];
1497
+ declare const CheckoutSessionResponseDtoCustomerCreation: {
1498
+ readonly always: "always";
1499
+ readonly if_required: "if_required";
1500
+ };
1501
+
1502
+ /**
1503
+ * Generated by orval v7.21.0 🍺
1504
+ * Do not edit manually.
1505
+ * XPay Checkout API
1506
+ * API for the XPay checkout flow — client endpoints and SSR
1507
+ * OpenAPI spec version: 1.0
1508
+ */
1509
+ /**
1510
+ * Session status
1511
+ */
1512
+ type CheckoutSessionResponseDtoStatus = typeof CheckoutSessionResponseDtoStatus[keyof typeof CheckoutSessionResponseDtoStatus];
1513
+ declare const CheckoutSessionResponseDtoStatus: {
1514
+ readonly open: "open";
1515
+ readonly complete: "complete";
1516
+ readonly expired: "expired";
1517
+ };
1518
+
1519
+ /**
1520
+ * Generated by orval v7.21.0 🍺
1521
+ * Do not edit manually.
1522
+ * XPay Checkout API
1523
+ * API for the XPay checkout flow — client endpoints and SSR
1524
+ * OpenAPI spec version: 1.0
1525
+ */
1526
+ /**
1527
+ * Payment status
1528
+ */
1529
+ type CheckoutSessionResponseDtoPaymentStatus = typeof CheckoutSessionResponseDtoPaymentStatus[keyof typeof CheckoutSessionResponseDtoPaymentStatus];
1530
+ declare const CheckoutSessionResponseDtoPaymentStatus: {
1531
+ readonly paid: "paid";
1532
+ readonly unpaid: "unpaid";
1533
+ readonly no_payment_required: "no_payment_required";
1534
+ };
1535
+
1536
+ /**
1537
+ * Generated by orval v7.21.0 🍺
1538
+ * Do not edit manually.
1539
+ * XPay Checkout API
1540
+ * API for the XPay checkout flow — client endpoints and SSR
1541
+ * OpenAPI spec version: 1.0
1542
+ */
1543
+ /**
1544
+ * Currency code (ISO 4217)
1545
+ */
1546
+ type CheckoutSessionResponseDtoCurrency = typeof CheckoutSessionResponseDtoCurrency[keyof typeof CheckoutSessionResponseDtoCurrency];
1547
+ declare const CheckoutSessionResponseDtoCurrency: {
1548
+ readonly EGP: "EGP";
1549
+ readonly USD: "USD";
1550
+ readonly EUR: "EUR";
1551
+ readonly GBP: "GBP";
1552
+ readonly SAR: "SAR";
1553
+ readonly AED: "AED";
1554
+ readonly QAR: "QAR";
1555
+ readonly KWD: "KWD";
1556
+ readonly JOD: "JOD";
1557
+ readonly OMR: "OMR";
1558
+ readonly BHD: "BHD";
1559
+ readonly LYD: "LYD";
1560
+ readonly AUD: "AUD";
1561
+ readonly CAD: "CAD";
1562
+ readonly CNY: "CNY";
1563
+ };
1564
+
1565
+ /**
1566
+ * Generated by orval v7.21.0 🍺
1567
+ * Do not edit manually.
1568
+ * XPay Checkout API
1569
+ * API for the XPay checkout flow — client endpoints and SSR
1570
+ * OpenAPI spec version: 1.0
1571
+ */
1572
+ interface TotalDetailsResponseDto {
1573
+ /** Discount amount */
1574
+ amountDiscount: number;
1575
+ /** Shipping amount */
1576
+ amountShipping?: number;
1577
+ /** Tax amount */
1578
+ amountTax: number;
1579
+ /** Platform fee amount (only when feesPassThrough is enabled) */
1580
+ amountPlatformFee?: number;
1581
+ /** Collected VAT amount (only when vatCollectionEnabled is enabled) */
1582
+ amountCollectedVat?: number;
1583
+ }
1584
+
1585
+ /**
1586
+ * Generated by orval v7.21.0 🍺
1587
+ * Do not edit manually.
1588
+ * XPay Checkout API
1589
+ * API for the XPay checkout flow — client endpoints and SSR
1590
+ * OpenAPI spec version: 1.0
1591
+ */
1592
+ /**
1593
+ * Customer's currency code (ISO 4217)
1594
+ */
1595
+ type SessionPresentmentDetailsDtoCurrency = typeof SessionPresentmentDetailsDtoCurrency[keyof typeof SessionPresentmentDetailsDtoCurrency];
1596
+ declare const SessionPresentmentDetailsDtoCurrency: {
1597
+ readonly EGP: "EGP";
1598
+ readonly USD: "USD";
1599
+ readonly EUR: "EUR";
1600
+ readonly GBP: "GBP";
1601
+ readonly SAR: "SAR";
1602
+ readonly AED: "AED";
1603
+ readonly QAR: "QAR";
1604
+ readonly KWD: "KWD";
1605
+ readonly JOD: "JOD";
1606
+ readonly OMR: "OMR";
1607
+ readonly BHD: "BHD";
1608
+ readonly LYD: "LYD";
1609
+ readonly AUD: "AUD";
1610
+ readonly CAD: "CAD";
1611
+ readonly CNY: "CNY";
1612
+ };
1613
+
1614
+ /**
1615
+ * Generated by orval v7.21.0 🍺
1616
+ * Do not edit manually.
1617
+ * XPay Checkout API
1618
+ * API for the XPay checkout flow — client endpoints and SSR
1619
+ * OpenAPI spec version: 1.0
1620
+ */
1621
+
1622
+ interface SessionPresentmentDetailsDto {
1623
+ /** Amount in the customer's currency (smallest unit — e.g. fils for KWD, cents for USD) */
1624
+ amount: number;
1625
+ /** Customer's currency code (ISO 4217) */
1626
+ currency: SessionPresentmentDetailsDtoCurrency;
1627
+ /** Locked exchange rate: presentment_major × rate = processing_major. Reused for refunds/disputes. Stored as numeric(15,6) — frontend can call `.toFixed(6)` to render the full 6-decimal string when needed. */
1628
+ exchangeRate: number;
1629
+ /** Reference to the immutable ExchangeRate record used — audit trail for FX reconciliation */
1630
+ exchangeRateId: string;
1631
+ /** Subtotal before discounts/fees, in presentment smallest unit */
1632
+ amountSubtotal: number;
1633
+ /** Final total the customer sees, in presentment smallest unit */
1634
+ amountTotal: number;
1635
+ /** Discount applied, in presentment smallest unit (0 when no discount) */
1636
+ amountDiscount: number;
1637
+ /** Collected VAT in presentment smallest unit (only when VAT collection is enabled) */
1638
+ amountCollectedVat?: number;
1639
+ /** Platform fee in presentment smallest unit (only when feesPassThrough is enabled) */
1640
+ amountPlatformFee?: number;
1641
+ /** Tax in presentment smallest unit (only when tax is charged) */
1642
+ amountTax?: number;
1643
+ }
1644
+
1645
+ /**
1646
+ * Generated by orval v7.21.0 🍺
1647
+ * Do not edit manually.
1648
+ * XPay Checkout API
1649
+ * API for the XPay checkout flow — client endpoints and SSR
1650
+ * OpenAPI spec version: 1.0
1651
+ */
1652
+ /**
1653
+ * What happens after payment: redirect to merchant URL or show hosted confirmation page
1654
+ */
1655
+ type CheckoutSessionResponseDtoAfterCompletion = {
1656
+ [key: string]: unknown;
1657
+ };
1658
+
1659
+ /**
1660
+ * Generated by orval v7.21.0 🍺
1661
+ * Do not edit manually.
1662
+ * XPay Checkout API
1663
+ * API for the XPay checkout flow — client endpoints and SSR
1664
+ * OpenAPI spec version: 1.0
1665
+ */
1666
+
1667
+ interface CustomerDetailsResponseDto {
1668
+ /** Customer name */
1669
+ name?: string;
1670
+ /** Customer email */
1671
+ email?: string;
1672
+ /** Customer phone */
1673
+ phone?: string;
1674
+ /** Billing details including cardholder name and address */
1675
+ billingDetails?: BillingDetailsResponseDto;
1676
+ /** Shipping details */
1677
+ shipping?: ShippingResponseDto;
1678
+ }
1679
+
1680
+ /**
1681
+ * Generated by orval v7.21.0 🍺
1682
+ * Do not edit manually.
1683
+ * XPay Checkout API
1684
+ * API for the XPay checkout flow — client endpoints and SSR
1685
+ * OpenAPI spec version: 1.0
1686
+ */
1687
+ /**
1688
+ * ISO 4217 currency code this payment is denominated in.
1689
+ */
1690
+ type NestedPaymentIntentResponseDtoCurrency = typeof NestedPaymentIntentResponseDtoCurrency[keyof typeof NestedPaymentIntentResponseDtoCurrency];
1691
+ declare const NestedPaymentIntentResponseDtoCurrency: {
1692
+ readonly EGP: "EGP";
1693
+ readonly USD: "USD";
1694
+ readonly EUR: "EUR";
1695
+ readonly GBP: "GBP";
1696
+ readonly SAR: "SAR";
1697
+ readonly AED: "AED";
1698
+ readonly QAR: "QAR";
1699
+ readonly KWD: "KWD";
1700
+ readonly JOD: "JOD";
1701
+ readonly OMR: "OMR";
1702
+ readonly BHD: "BHD";
1703
+ readonly LYD: "LYD";
1704
+ readonly AUD: "AUD";
1705
+ readonly CAD: "CAD";
1706
+ readonly CNY: "CNY";
1707
+ };
1708
+
1709
+ /**
1710
+ * Generated by orval v7.21.0 🍺
1711
+ * Do not edit manually.
1712
+ * XPay Checkout API
1713
+ * API for the XPay checkout flow — client endpoints and SSR
1714
+ * OpenAPI spec version: 1.0
1715
+ */
1716
+ /**
1717
+ * Lifecycle status. Combines the raw processor state with refund state, so values like `REFUNDED`, `PARTIALLY_REFUNDED`, `UNCAPTURED`, and `FAILED` may appear in addition to the base processor states.
1718
+ */
1719
+ type NestedPaymentIntentResponseDtoStatus = typeof NestedPaymentIntentResponseDtoStatus[keyof typeof NestedPaymentIntentResponseDtoStatus];
1720
+ declare const NestedPaymentIntentResponseDtoStatus: {
1721
+ readonly REQUIRES_PAYMENT_METHOD: "REQUIRES_PAYMENT_METHOD";
1722
+ readonly REQUIRES_CONFIRMATION: "REQUIRES_CONFIRMATION";
1723
+ readonly REQUIRES_ACTION: "REQUIRES_ACTION";
1724
+ readonly PROCESSING: "PROCESSING";
1725
+ readonly UNCAPTURED: "UNCAPTURED";
1726
+ readonly CANCELED: "CANCELED";
1727
+ readonly SUCCEEDED: "SUCCEEDED";
1728
+ readonly FAILED: "FAILED";
1729
+ readonly REFUNDED: "REFUNDED";
1730
+ readonly PARTIALLY_REFUNDED: "PARTIALLY_REFUNDED";
1731
+ readonly AMOUNT_CAPTURABLE_UPDATED: "AMOUNT_CAPTURABLE_UPDATED";
1732
+ };
1733
+
1734
+ /**
1735
+ * Generated by orval v7.21.0 🍺
1736
+ * Do not edit manually.
1737
+ * XPay Checkout API
1738
+ * API for the XPay checkout flow — client endpoints and SSR
1739
+ * OpenAPI spec version: 1.0
1740
+ */
1741
+ /**
1742
+ * When to capture funds from the customer. `automatic` (default) captures immediately on successful confirmation. `manual` only authorizes — call the capture endpoint later (within 7 days) to actually move the money.
1743
+ */
1744
+ type NestedPaymentIntentResponseDtoCaptureMethod = typeof NestedPaymentIntentResponseDtoCaptureMethod[keyof typeof NestedPaymentIntentResponseDtoCaptureMethod];
1745
+ declare const NestedPaymentIntentResponseDtoCaptureMethod: {
1746
+ readonly automatic: "automatic";
1747
+ readonly manual: "manual";
1748
+ };
1749
+
1750
+ /**
1751
+ * Generated by orval v7.21.0 🍺
1752
+ * Do not edit manually.
1753
+ * XPay Checkout API
1754
+ * API for the XPay checkout flow — client endpoints and SSR
1755
+ * OpenAPI spec version: 1.0
1756
+ */
1757
+ /**
1758
+ * How the PaymentIntent moves out of `REQUIRES_CONFIRMATION`. `automatic` (default) confirms as soon as a payment method is attached. `manual` requires you to call confirm explicitly.
1759
+ */
1760
+ type NestedPaymentIntentResponseDtoConfirmationMethod = typeof NestedPaymentIntentResponseDtoConfirmationMethod[keyof typeof NestedPaymentIntentResponseDtoConfirmationMethod];
1761
+ declare const NestedPaymentIntentResponseDtoConfirmationMethod: {
1762
+ readonly automatic: "automatic";
1763
+ readonly manual: "manual";
1764
+ };
1765
+
1766
+ /**
1767
+ * Generated by orval v7.21.0 🍺
1768
+ * Do not edit manually.
1769
+ * XPay Checkout API
1770
+ * API for the XPay checkout flow — client endpoints and SSR
1771
+ * OpenAPI spec version: 1.0
1772
+ */
1773
+
1774
+ interface ShippingDto {
1775
+ /** Shipping address. */
1776
+ address: AddressDto;
1777
+ /**
1778
+ * Recipient name as provided by the customer.
1779
+ * @nullable
1780
+ */
1781
+ name?: string | null;
1782
+ /**
1783
+ * Recipient phone number as provided by the customer.
1784
+ * @nullable
1785
+ */
1786
+ phone?: string | null;
1787
+ }
1788
+
1789
+ /**
1790
+ * Generated by orval v7.21.0 🍺
1791
+ * Do not edit manually.
1792
+ * XPay Checkout API
1793
+ * API for the XPay checkout flow — client endpoints and SSR
1794
+ * OpenAPI spec version: 1.0
1795
+ */
1796
+
1797
+ /**
1798
+ * Shipping address and recipient details for this payment. `null` if no shipping was collected.
1799
+ * @nullable
1800
+ */
1801
+ type NestedPaymentIntentResponseDtoShipping = ShippingDto | null;
1802
+
1803
+ /**
1804
+ * Generated by orval v7.21.0 🍺
1805
+ * Do not edit manually.
1806
+ * XPay Checkout API
1807
+ * API for the XPay checkout flow — client endpoints and SSR
1808
+ * OpenAPI spec version: 1.0
1809
+ */
1810
+
1811
+ /**
1812
+ * Breakdown of `amount` into product amount, tax, platform fees, tip, and discount. `null` for legacy payments without itemized breakdown.
1813
+ * @nullable
1814
+ */
1815
+ type NestedPaymentIntentResponseDtoAmountDetails = AmountDetailsDto | null;
1816
+
1817
+ /**
1818
+ * Generated by orval v7.21.0 🍺
1819
+ * Do not edit manually.
1820
+ * XPay Checkout API
1821
+ * API for the XPay checkout flow — client endpoints and SSR
1822
+ * OpenAPI spec version: 1.0
1823
+ */
1824
+
1825
+ /**
1826
+ * Mirror of `amount` / `currency` in the currency the customer actually saw at checkout, when different from the settlement currency. `null` when customer paid in the same currency.
1827
+ * @nullable
1828
+ */
1829
+ type NestedPaymentIntentResponseDtoPresentmentDetails = PresentmentDetailsDto | null;
1830
+
1831
+ /**
1832
+ * Generated by orval v7.21.0 🍺
1833
+ * Do not edit manually.
1834
+ * XPay Checkout API
1835
+ * API for the XPay checkout flow — client endpoints and SSR
1836
+ * OpenAPI spec version: 1.0
1837
+ */
1838
+
1839
+ /**
1840
+ * The most recent Charge attempt for this PaymentIntent. `null` if no Charge has been attempted yet.
1841
+ * @nullable
1842
+ */
1843
+ type NestedPaymentIntentResponseDtoLatestCharge = ChargeResponseDto | null;
1844
+
1845
+ /**
1846
+ * Generated by orval v7.21.0 🍺
1847
+ * Do not edit manually.
1848
+ * XPay Checkout API
1849
+ * API for the XPay checkout flow — client endpoints and SSR
1850
+ * OpenAPI spec version: 1.0
1851
+ */
1852
+ type PaymentMethodCardDtoNetworks = {
1853
+ [key: string]: unknown;
1854
+ };
1855
+
1856
+ /**
1857
+ * Generated by orval v7.21.0 🍺
1858
+ * Do not edit manually.
1859
+ * XPay Checkout API
1860
+ * API for the XPay checkout flow — client endpoints and SSR
1861
+ * OpenAPI spec version: 1.0
1862
+ */
1863
+ interface ThreeDSecureUsageDto {
1864
+ supported: boolean;
1865
+ }
1866
+
1867
+ /**
1868
+ * Generated by orval v7.21.0 🍺
1869
+ * Do not edit manually.
1870
+ * XPay Checkout API
1871
+ * API for the XPay checkout flow — client endpoints and SSR
1872
+ * OpenAPI spec version: 1.0
1873
+ */
1874
+
1875
+ interface PaymentMethodCardDto {
1876
+ brand: string;
1877
+ country: string;
1878
+ displayBrand: string;
1879
+ expMonth: number;
1880
+ expYear: number;
1881
+ fingerprint: string;
1882
+ funding: string;
1883
+ last4: string;
1884
+ networks: PaymentMethodCardDtoNetworks;
1885
+ regulatedStatus: string;
1886
+ threeDSecureUsage: ThreeDSecureUsageDto;
1887
+ wallet: WalletDto;
1888
+ }
1889
+
1890
+ /**
1891
+ * Generated by orval v7.21.0 🍺
1892
+ * Do not edit manually.
1893
+ * XPay Checkout API
1894
+ * API for the XPay checkout flow — client endpoints and SSR
1895
+ * OpenAPI spec version: 1.0
1896
+ */
1897
+
1898
+ /**
1899
+ * @nullable
1900
+ */
1901
+ type PaymentMethodObjectDtoCard = PaymentMethodCardDto | null;
1902
+
1903
+ /**
1904
+ * Generated by orval v7.21.0 🍺
1905
+ * Do not edit manually.
1906
+ * XPay Checkout API
1907
+ * API for the XPay checkout flow — client endpoints and SSR
1908
+ * OpenAPI spec version: 1.0
1909
+ */
1910
+
1911
+ /**
1912
+ * ValU details (if type is 'valu')
1913
+ * @nullable
1914
+ */
1915
+ type PaymentMethodObjectDtoValu = ValuDetailsDto | null;
1916
+
1917
+ /**
1918
+ * Generated by orval v7.21.0 🍺
1919
+ * Do not edit manually.
1920
+ * XPay Checkout API
1921
+ * API for the XPay checkout flow — client endpoints and SSR
1922
+ * OpenAPI spec version: 1.0
1923
+ */
1924
+ type PaymentMethodObjectDtoType = typeof PaymentMethodObjectDtoType[keyof typeof PaymentMethodObjectDtoType];
1925
+ declare const PaymentMethodObjectDtoType: {
1926
+ readonly card: "card";
1927
+ readonly fawry: "fawry";
1928
+ readonly aman: "aman";
1929
+ readonly valu: "valu";
1930
+ readonly sympl: "sympl";
1931
+ readonly tabby: "tabby";
1932
+ readonly tamara: "tamara";
1933
+ readonly vodafone_cash: "vodafone_cash";
1934
+ readonly etisalat_cash: "etisalat_cash";
1935
+ readonly orange_cash: "orange_cash";
1936
+ readonly we_pay: "we_pay";
1937
+ readonly apple_pay: "apple_pay";
1938
+ readonly google_pay: "google_pay";
1939
+ readonly samsung_pay: "samsung_pay";
1940
+ readonly instapay: "instapay";
1941
+ readonly bank_transfer: "bank_transfer";
1942
+ readonly cash_on_delivery: "cash_on_delivery";
1943
+ };
1944
+
1945
+ /**
1946
+ * Generated by orval v7.21.0 🍺
1947
+ * Do not edit manually.
1948
+ * XPay Checkout API
1949
+ * API for the XPay checkout flow — client endpoints and SSR
1950
+ * OpenAPI spec version: 1.0
1951
+ */
1952
+
1953
+ interface PaymentMethodObjectDto {
1954
+ id: string;
1955
+ object: string;
1956
+ /** @nullable */
1957
+ card: PaymentMethodObjectDtoCard;
1958
+ /**
1959
+ * ValU details (if type is 'valu')
1960
+ * @nullable
1961
+ */
1962
+ valu?: PaymentMethodObjectDtoValu;
1963
+ billingDetails: BillingDetailsDto;
1964
+ type: PaymentMethodObjectDtoType;
1965
+ /** Created timestamp (ISO 8601) */
1966
+ createdAt: string;
1967
+ }
1968
+
1969
+ /**
1970
+ * Generated by orval v7.21.0 🍺
1971
+ * Do not edit manually.
1972
+ * XPay Checkout API
1973
+ * API for the XPay checkout flow — client endpoints and SSR
1974
+ * OpenAPI spec version: 1.0
1975
+ */
1976
+
1977
+ /**
1978
+ * Payment method attached to this PaymentIntent. `null` before a method is attached or after a failure clears it.
1979
+ * @nullable
1980
+ */
1981
+ type NestedPaymentIntentResponseDtoPaymentMethod = PaymentMethodObjectDto | null;
1982
+
1983
+ /**
1984
+ * Generated by orval v7.21.0 🍺
1985
+ * Do not edit manually.
1986
+ * XPay Checkout API
1987
+ * API for the XPay checkout flow — client endpoints and SSR
1988
+ * OpenAPI spec version: 1.0
1989
+ */
1990
+ interface CustomerDto {
1991
+ /** ID of the Customer associated with this payment. */
1992
+ id: string;
1993
+ /**
1994
+ * Customer's name as captured for this payment. Prefers the billing-details snapshot from the latest charge (immutable) over the Customer entity's current name.
1995
+ * @nullable
1996
+ */
1997
+ name?: string | null;
1998
+ /**
1999
+ * Customer's email captured for this payment. Falls back to the Customer entity's email if no billing-details email was provided.
2000
+ * @nullable
2001
+ */
2002
+ email?: string | null;
2003
+ /**
2004
+ * Customer's phone captured for this payment, in E.164 format when available.
2005
+ * @nullable
2006
+ */
2007
+ phone?: string | null;
2008
+ }
2009
+
2010
+ /**
2011
+ * Generated by orval v7.21.0 🍺
2012
+ * Do not edit manually.
2013
+ * XPay Checkout API
2014
+ * API for the XPay checkout flow — client endpoints and SSR
2015
+ * OpenAPI spec version: 1.0
2016
+ */
2017
+
2018
+ /**
2019
+ * The Customer this payment belongs to. `null` if no Customer is associated.
2020
+ * @nullable
2021
+ */
2022
+ type NestedPaymentIntentResponseDtoCustomer = CustomerDto | null;
2023
+
2024
+ /**
2025
+ * Generated by orval v7.21.0 🍺
2026
+ * Do not edit manually.
2027
+ * XPay Checkout API
2028
+ * API for the XPay checkout flow — client endpoints and SSR
2029
+ * OpenAPI spec version: 1.0
2030
+ */
2031
+ interface NextActionRedirectDto {
2032
+ /** URL to redirect the customer to in order to complete the next step (typically 3-D Secure). */
2033
+ url: string;
2034
+ /**
2035
+ * URL the customer is sent back to after completing the redirect step. `null` if no return URL was configured.
2036
+ * @nullable
2037
+ */
2038
+ returnUrl?: string | null;
2039
+ }
2040
+
2041
+ /**
2042
+ * Generated by orval v7.21.0 🍺
2043
+ * Do not edit manually.
2044
+ * XPay Checkout API
2045
+ * API for the XPay checkout flow — client endpoints and SSR
2046
+ * OpenAPI spec version: 1.0
2047
+ */
2048
+
2049
+ /**
2050
+ * Redirect details when `type` is `redirect_to_url`. `null` for any other action type.
2051
+ * @nullable
2052
+ */
2053
+ type NextActionDetailDtoRedirectToUrl = NextActionRedirectDto | null;
2054
+
2055
+ /**
2056
+ * Generated by orval v7.21.0 🍺
2057
+ * Do not edit manually.
2058
+ * XPay Checkout API
2059
+ * API for the XPay checkout flow — client endpoints and SSR
2060
+ * OpenAPI spec version: 1.0
2061
+ */
2062
+
2063
+ interface NextActionDetailDto {
2064
+ /** Kind of action the customer must take next. Today the only value is `redirect_to_url`; future payment methods may add new types. */
2065
+ type: string;
2066
+ /**
2067
+ * Redirect details when `type` is `redirect_to_url`. `null` for any other action type.
2068
+ * @nullable
2069
+ */
2070
+ redirectToUrl?: NextActionDetailDtoRedirectToUrl;
2071
+ }
2072
+
2073
+ /**
2074
+ * Generated by orval v7.21.0 🍺
2075
+ * Do not edit manually.
2076
+ * XPay Checkout API
2077
+ * API for the XPay checkout flow — client endpoints and SSR
2078
+ * OpenAPI spec version: 1.0
2079
+ */
2080
+
2081
+ /**
2082
+ * Action the customer must take to advance the payment (e.g. complete 3-D Secure). `null` when no further action is needed.
2083
+ * @nullable
2084
+ */
2085
+ type NestedPaymentIntentResponseDtoNextAction = NextActionDetailDto | null;
2086
+
2087
+ /**
2088
+ * Generated by orval v7.21.0 🍺
2089
+ * Do not edit manually.
2090
+ * XPay Checkout API
2091
+ * API for the XPay checkout flow — client endpoints and SSR
2092
+ * OpenAPI spec version: 1.0
2093
+ */
2094
+ /**
2095
+ * Custom key/value pairs you attached when creating or updating the PaymentIntent. Useful for reconciling with your own systems. Empty object if none.
2096
+ */
2097
+ type NestedPaymentIntentResponseDtoMetadata = {
2098
+ [key: string]: unknown;
2099
+ };
2100
+
2101
+ /**
2102
+ * Generated by orval v7.21.0 🍺
2103
+ * Do not edit manually.
2104
+ * XPay Checkout API
2105
+ * API for the XPay checkout flow — client endpoints and SSR
2106
+ * OpenAPI spec version: 1.0
2107
+ */
2108
+ /**
2109
+ * Advice on whether and how to retry. One of `confirm_card_data`, `do_not_try_again`, `try_again_later`. `null` if no specific advice applies.
2110
+ * @nullable
2111
+ */
2112
+ type LastPaymentErrorDetailDtoAdviceCode = typeof LastPaymentErrorDetailDtoAdviceCode[keyof typeof LastPaymentErrorDetailDtoAdviceCode] | null;
2113
+ declare const LastPaymentErrorDetailDtoAdviceCode: {
2114
+ readonly confirm_card_data: "confirm_card_data";
2115
+ readonly do_not_try_again: "do_not_try_again";
2116
+ readonly try_again_later: "try_again_later";
2117
+ };
2118
+
2119
+ /**
2120
+ * Generated by orval v7.21.0 🍺
2121
+ * Do not edit manually.
2122
+ * XPay Checkout API
2123
+ * API for the XPay checkout flow — client endpoints and SSR
2124
+ * OpenAPI spec version: 1.0
2125
+ */
2126
+ /**
2127
+ * Snapshot of the payment method as it existed at the time of failure (brand, last 4, billing details, etc.). `null` if no payment method was attached when the error occurred.
2128
+ * @nullable
2129
+ */
2130
+ type LastPaymentErrorDetailDtoPaymentMethod = {
2131
+ [key: string]: unknown;
2132
+ } | null;
2133
+
2134
+ /**
2135
+ * Generated by orval v7.21.0 🍺
2136
+ * Do not edit manually.
2137
+ * XPay Checkout API
2138
+ * API for the XPay checkout flow — client endpoints and SSR
2139
+ * OpenAPI spec version: 1.0
2140
+ */
2141
+ /**
2142
+ * Error category. One of `card_error`, `payment_method_error`, `api_error`, `invalid_request_error`. Use this for high-level branching in your error handling.
2143
+ */
2144
+ type LastPaymentErrorDetailDtoType = typeof LastPaymentErrorDetailDtoType[keyof typeof LastPaymentErrorDetailDtoType];
2145
+ declare const LastPaymentErrorDetailDtoType: {
2146
+ readonly card_error: "card_error";
2147
+ readonly payment_method_error: "payment_method_error";
2148
+ readonly api_error: "api_error";
2149
+ readonly invalid_request_error: "invalid_request_error";
2150
+ };
2151
+
2152
+ /**
2153
+ * Generated by orval v7.21.0 🍺
2154
+ * Do not edit manually.
2155
+ * XPay Checkout API
2156
+ * API for the XPay checkout flow — client endpoints and SSR
2157
+ * OpenAPI spec version: 1.0
2158
+ */
2159
+
2160
+ interface LastPaymentErrorDetailDto {
2161
+ /**
2162
+ * Short machine-readable error code describing what failed (e.g. `card_declined`, `expired_card`, `incorrect_cvc`). `null` if no code applies.
2163
+ * @nullable
2164
+ */
2165
+ code?: string | null;
2166
+ /**
2167
+ * More specific reason for a decline (e.g. `insufficient_funds`, `generic_decline`). Present when `code` is `card_declined`; otherwise `null`.
2168
+ * @nullable
2169
+ */
2170
+ declineCode?: string | null;
2171
+ /**
2172
+ * Decline code returned by the card network itself, when different from `declineCode`. `null` if the network did not provide one.
2173
+ * @nullable
2174
+ */
2175
+ networkDeclineCode?: string | null;
2176
+ /**
2177
+ * Link to documentation explaining this error and how to recover from it.
2178
+ * @nullable
2179
+ */
2180
+ docUrl?: string | null;
2181
+ /** Customer-safe message describing what went wrong. Safe to display in your UI. */
2182
+ message: string;
2183
+ /**
2184
+ * Internal message for the merchant with more detail than `message`. Do NOT show this to customers. `null` if no merchant-only context is available.
2185
+ * @nullable
2186
+ */
2187
+ merchantMessage?: string | null;
2188
+ /**
2189
+ * Advice on whether and how to retry. One of `confirm_card_data`, `do_not_try_again`, `try_again_later`. `null` if no specific advice applies.
2190
+ * @nullable
2191
+ */
2192
+ adviceCode?: LastPaymentErrorDetailDtoAdviceCode;
2193
+ /**
2194
+ * Name of the request parameter that caused the error (e.g. `amount`, `payment_method`). `null` when the failure isn't tied to a specific parameter.
2195
+ * @nullable
2196
+ */
2197
+ param?: string | null;
2198
+ /**
2199
+ * ID of the failed Charge that triggered this error. `null` if no charge was created.
2200
+ * @nullable
2201
+ */
2202
+ chargeId?: string | null;
2203
+ /**
2204
+ * Snapshot of the payment method as it existed at the time of failure (brand, last 4, billing details, etc.). `null` if no payment method was attached when the error occurred.
2205
+ * @nullable
2206
+ */
2207
+ paymentMethod?: LastPaymentErrorDetailDtoPaymentMethod;
2208
+ /**
2209
+ * Type of the payment method that failed (e.g. `card`, `valu`, `fawry`). `null` if unknown.
2210
+ * @nullable
2211
+ */
2212
+ paymentMethodType?: string | null;
2213
+ /** Error category. One of `card_error`, `payment_method_error`, `api_error`, `invalid_request_error`. Use this for high-level branching in your error handling. */
2214
+ type: LastPaymentErrorDetailDtoType;
2215
+ /**
2216
+ * Raw error code returned by the upstream processor, unmapped. Useful for support tickets and processor-specific debugging. Most applications should rely on `code` and `declineCode` instead.
2217
+ * @nullable
2218
+ */
2219
+ processorCode?: string | null;
2220
+ /**
2221
+ * Raw error message returned by the upstream processor, unmapped. Useful for support tickets and processor-specific debugging. Most applications should rely on `message` instead.
2222
+ * @nullable
2223
+ */
2224
+ processorMessage?: string | null;
2225
+ }
2226
+
2227
+ /**
2228
+ * Generated by orval v7.21.0 🍺
2229
+ * Do not edit manually.
2230
+ * XPay Checkout API
2231
+ * API for the XPay checkout flow — client endpoints and SSR
2232
+ * OpenAPI spec version: 1.0
2233
+ */
2234
+
2235
+ /**
2236
+ * Details of the most recent failed payment attempt for this PaymentIntent. `null` if no attempts have failed.
2237
+ * @nullable
2238
+ */
2239
+ type NestedPaymentIntentResponseDtoLastPaymentError = LastPaymentErrorDetailDto | null;
2240
+
2241
+ /**
2242
+ * Generated by orval v7.21.0 🍺
2243
+ * Do not edit manually.
2244
+ * XPay Checkout API
2245
+ * API for the XPay checkout flow — client endpoints and SSR
2246
+ * OpenAPI spec version: 1.0
2247
+ */
2248
+
2249
+ /**
2250
+ * A PaymentIntent embedded inside a CheckoutSession. Same fields as PaymentIntent, but without the `checkoutSession` back-reference (you are already reading this from the enclosing CheckoutSession).
2251
+ */
2252
+ interface NestedPaymentIntentResponseDto {
2253
+ /** Unique identifier for this PaymentIntent. Always prefixed with `pi_`. */
2254
+ id: string;
2255
+ /** String identifying the object type. Always `payment_intent` for this resource. */
2256
+ object: string;
2257
+ /**
2258
+ * ID of the CheckoutSession that created this PaymentIntent. `null` for PaymentIntents created directly via the API without a session.
2259
+ * @nullable
2260
+ */
2261
+ checkoutSessionId?: string | null;
2262
+ /** Amount the customer is being charged, in the smallest currency unit of `currency` (e.g. piasters for EGP — `10000` = 100 EGP). */
2263
+ amount: number;
2264
+ /** Amount that can still be captured for this PaymentIntent, in the smallest currency unit. Non-zero only when `captureMethod` is `manual` and the payment has been authorized but not yet captured. Drops to `0` once captured (fully or partially). */
2265
+ amountCapturable: number;
2266
+ /** Amount actually received from the customer so far, in the smallest currency unit. Equals `amount` after a successful capture; `0` for payments that haven't reached SUCCEEDED. */
2267
+ amountReceived: number;
2268
+ /** ISO 4217 currency code this payment is denominated in. */
2269
+ currency: NestedPaymentIntentResponseDtoCurrency;
2270
+ /** Lifecycle status. Combines the raw processor state with refund state, so values like `REFUNDED`, `PARTIALLY_REFUNDED`, `UNCAPTURED`, and `FAILED` may appear in addition to the base processor states. */
2271
+ status: NestedPaymentIntentResponseDtoStatus;
2272
+ /** Created timestamp (ISO 8601) */
2273
+ createdAt: string;
2274
+ /** Updated timestamp (ISO 8601) */
2275
+ updatedAt: string;
2276
+ /** Secret used by the SDK to confirm the payment from the customer's browser. Do NOT log this or share it with any party other than the customer. Each PaymentIntent has one client secret for its lifetime. */
2277
+ clientSecret: string;
2278
+ /** When to capture funds from the customer. `automatic` (default) captures immediately on successful confirmation. `manual` only authorizes — call the capture endpoint later (within 7 days) to actually move the money. */
2279
+ captureMethod: NestedPaymentIntentResponseDtoCaptureMethod;
2280
+ /** How the PaymentIntent moves out of `REQUIRES_CONFIRMATION`. `automatic` (default) confirms as soon as a payment method is attached. `manual` requires you to call confirm explicitly. */
2281
+ confirmationMethod: NestedPaymentIntentResponseDtoConfirmationMethod;
2282
+ /**
2283
+ * Arbitrary description you can attach when creating the PaymentIntent. Shown in the dashboard and useful for reconciling with your own systems. `null` if not provided.
2284
+ * @nullable
2285
+ */
2286
+ description?: string | null;
2287
+ /**
2288
+ * Email to send the receipt to once the payment succeeds. `null` if no receipt email was set.
2289
+ * @nullable
2290
+ */
2291
+ receiptEmail?: string | null;
2292
+ /**
2293
+ * ISO 8601 timestamp of when this PaymentIntent was canceled. `null` if it was never canceled.
2294
+ * @nullable
2295
+ */
2296
+ canceledAt?: string | null;
2297
+ /**
2298
+ * Shipping address and recipient details for this payment. `null` if no shipping was collected.
2299
+ * @nullable
2300
+ */
2301
+ shipping?: NestedPaymentIntentResponseDtoShipping;
2302
+ /**
2303
+ * Breakdown of `amount` into product amount, tax, platform fees, tip, and discount. `null` for legacy payments without itemized breakdown.
2304
+ * @nullable
2305
+ */
2306
+ amountDetails?: NestedPaymentIntentResponseDtoAmountDetails;
2307
+ /**
2308
+ * Mirror of `amount` / `currency` in the currency the customer actually saw at checkout, when different from the settlement currency. `null` when customer paid in the same currency.
2309
+ * @nullable
2310
+ */
2311
+ presentmentDetails?: NestedPaymentIntentResponseDtoPresentmentDetails;
2312
+ /**
2313
+ * The most recent Charge attempt for this PaymentIntent. `null` if no Charge has been attempted yet.
2314
+ * @nullable
2315
+ */
2316
+ latestCharge?: NestedPaymentIntentResponseDtoLatestCharge;
2317
+ /** All Charge attempts for this PaymentIntent, sorted by creation time ascending (oldest first). Each retry adds a new Charge. Empty array if no attempts have been made yet. */
2318
+ charges: ChargeResponseDto[];
2319
+ /**
2320
+ * Payment method attached to this PaymentIntent. `null` before a method is attached or after a failure clears it.
2321
+ * @nullable
2322
+ */
2323
+ paymentMethod?: NestedPaymentIntentResponseDtoPaymentMethod;
2324
+ /**
2325
+ * The Customer this payment belongs to. `null` if no Customer is associated.
2326
+ * @nullable
2327
+ */
2328
+ customer?: NestedPaymentIntentResponseDtoCustomer;
2329
+ /**
2330
+ * Action the customer must take to advance the payment (e.g. complete 3-D Secure). `null` when no further action is needed.
2331
+ * @nullable
2332
+ */
2333
+ nextAction?: NestedPaymentIntentResponseDtoNextAction;
2334
+ /** Custom key/value pairs you attached when creating or updating the PaymentIntent. Useful for reconciling with your own systems. Empty object if none. */
2335
+ metadata: NestedPaymentIntentResponseDtoMetadata;
2336
+ /**
2337
+ * Details of the most recent failed payment attempt for this PaymentIntent. `null` if no attempts have failed.
2338
+ * @nullable
2339
+ */
2340
+ lastPaymentError?: NestedPaymentIntentResponseDtoLastPaymentError;
2341
+ }
2342
+
2343
+ /**
2344
+ * Generated by orval v7.21.0 🍺
2345
+ * Do not edit manually.
2346
+ * XPay Checkout API
2347
+ * API for the XPay checkout flow — client endpoints and SSR
2348
+ * OpenAPI spec version: 1.0
2349
+ */
2350
+
2351
+ /**
2352
+ * The PaymentIntent for this session, or `null` if no payment has been started yet. The PaymentIntent's own `checkoutSession` field is not included here to keep the response self-contained.
2353
+ * @nullable
2354
+ */
2355
+ type CheckoutSessionResponseDtoPaymentIntent = NestedPaymentIntentResponseDto | null;
2356
+
2357
+ /**
2358
+ * Generated by orval v7.21.0 🍺
2359
+ * Do not edit manually.
2360
+ * XPay Checkout API
2361
+ * API for the XPay checkout flow — client endpoints and SSR
2362
+ * OpenAPI spec version: 1.0
2363
+ */
2364
+ /**
2365
+ * Currency
2366
+ */
2367
+ type PriceDtoCurrency = typeof PriceDtoCurrency[keyof typeof PriceDtoCurrency];
2368
+ declare const PriceDtoCurrency: {
2369
+ readonly EGP: "EGP";
2370
+ readonly USD: "USD";
2371
+ readonly EUR: "EUR";
2372
+ readonly GBP: "GBP";
2373
+ readonly SAR: "SAR";
2374
+ readonly AED: "AED";
2375
+ readonly QAR: "QAR";
2376
+ readonly KWD: "KWD";
2377
+ readonly JOD: "JOD";
2378
+ readonly OMR: "OMR";
2379
+ readonly BHD: "BHD";
2380
+ readonly LYD: "LYD";
2381
+ readonly AUD: "AUD";
2382
+ readonly CAD: "CAD";
2383
+ readonly CNY: "CNY";
2384
+ };
2385
+
2386
+ /**
2387
+ * Generated by orval v7.21.0 🍺
2388
+ * Do not edit manually.
2389
+ * XPay Checkout API
2390
+ * API for the XPay checkout flow — client endpoints and SSR
2391
+ * OpenAPI spec version: 1.0
2392
+ */
2393
+ /**
2394
+ * Price type
2395
+ */
2396
+ type PriceDtoType = typeof PriceDtoType[keyof typeof PriceDtoType];
2397
+ declare const PriceDtoType: {
2398
+ readonly ONE_TIME: "ONE_TIME";
2399
+ readonly RECURRING: "RECURRING";
2400
+ readonly CUSTOM: "CUSTOM";
2401
+ };
2402
+
2403
+ /**
2404
+ * Generated by orval v7.21.0 🍺
2405
+ * Do not edit manually.
2406
+ * XPay Checkout API
2407
+ * API for the XPay checkout flow — client endpoints and SSR
2408
+ * OpenAPI spec version: 1.0
2409
+ */
2410
+ /**
2411
+ * Billing interval
2412
+ */
2413
+ type RecurringDtoInterval = typeof RecurringDtoInterval[keyof typeof RecurringDtoInterval];
2414
+ declare const RecurringDtoInterval: {
2415
+ readonly DAY: "DAY";
2416
+ readonly WEEK: "WEEK";
2417
+ readonly MONTH: "MONTH";
2418
+ readonly YEAR: "YEAR";
2419
+ readonly CUSTOM: "CUSTOM";
2420
+ };
2421
+
2422
+ /**
2423
+ * Generated by orval v7.21.0 🍺
2424
+ * Do not edit manually.
2425
+ * XPay Checkout API
2426
+ * API for the XPay checkout flow — client endpoints and SSR
2427
+ * OpenAPI spec version: 1.0
2428
+ */
2429
+
2430
+ interface RecurringDto {
2431
+ /** Billing interval */
2432
+ interval?: RecurringDtoInterval;
2433
+ /** Number of intervals between billings */
2434
+ intervalCount?: number;
2435
+ }
2436
+
2437
+ /**
2438
+ * Generated by orval v7.21.0 🍺
2439
+ * Do not edit manually.
2440
+ * XPay Checkout API
2441
+ * API for the XPay checkout flow — client endpoints and SSR
2442
+ * OpenAPI spec version: 1.0
2443
+ */
2444
+ interface CustomUnitAmountDto {
2445
+ /** Minimum amount the customer may enter */
2446
+ minimum?: number;
2447
+ /** Maximum amount the customer may enter */
2448
+ maximum?: number;
2449
+ /** Suggested amount pre-filled at checkout */
2450
+ preset?: number;
2451
+ }
2452
+
2453
+ /**
2454
+ * Generated by orval v7.21.0 🍺
2455
+ * Do not edit manually.
2456
+ * XPay Checkout API
2457
+ * API for the XPay checkout flow — client endpoints and SSR
2458
+ * OpenAPI spec version: 1.0
2459
+ */
2460
+ interface ProductDto {
2461
+ /** Product ID */
2462
+ id: string;
2463
+ /** Product name */
2464
+ name: string;
2465
+ /** Product description */
2466
+ description?: string;
2467
+ /** Product image URL */
2468
+ image?: string;
2469
+ /** Whether the product is active. `false` means the merchant archived it — archiving a product cascades `active: false` to all of its catalog prices, so an archived product's prices will also surface `active: false`. Consumers should treat any line item with `price.product.active === false` as unavailable. */
2470
+ active: boolean;
2471
+ }
2472
+
2473
+ /**
2474
+ * Generated by orval v7.21.0 🍺
2475
+ * Do not edit manually.
2476
+ * XPay Checkout API
2477
+ * API for the XPay checkout flow — client endpoints and SSR
2478
+ * OpenAPI spec version: 1.0
2479
+ */
2480
+
2481
+ interface PriceDto {
2482
+ /** Price ID */
2483
+ id: string;
2484
+ /** Price amount in smallest currency unit */
2485
+ unitAmount?: number;
2486
+ /** Currency */
2487
+ currency: PriceDtoCurrency;
2488
+ /** Price type */
2489
+ type: PriceDtoType;
2490
+ /** Recurring configuration (for recurring prices) */
2491
+ recurring?: RecurringDto;
2492
+ /** Custom unit amount configuration — present for CUSTOM-type prices */
2493
+ customUnitAmount?: CustomUnitAmountDto;
2494
+ /** Creation timestamp (ISO 8601) */
2495
+ createdAt: string;
2496
+ /** Whether the price is active. `false` means the merchant archived it. */
2497
+ active: boolean;
2498
+ /**
2499
+ * Remaining stock. `null` means unlimited. Decremented on PaymentIntent success. May go negative under race conditions (oversold).
2500
+ * @nullable
2501
+ */
2502
+ stock?: number | null;
2503
+ /**
2504
+ * Start date (before which the price is not usable in checkout), ISO 8601
2505
+ * @nullable
2506
+ */
2507
+ startDate?: string | null;
2508
+ /**
2509
+ * Expiration date (at/after which the price is not usable in checkout), ISO 8601
2510
+ * @nullable
2511
+ */
2512
+ expirationDate?: string | null;
2513
+ /** Product associated with this price */
2514
+ product: ProductDto;
2515
+ }
2516
+
2517
+ /**
2518
+ * Generated by orval v7.21.0 🍺
2519
+ * Do not edit manually.
2520
+ * XPay Checkout API
2521
+ * API for the XPay checkout flow — client endpoints and SSR
2522
+ * OpenAPI spec version: 1.0
2523
+ */
2524
+ /**
2525
+ * Currency for the amounts (ISO 4217)
2526
+ */
2527
+ type LineItemDtoCurrency = typeof LineItemDtoCurrency[keyof typeof LineItemDtoCurrency];
2528
+ declare const LineItemDtoCurrency: {
2529
+ readonly EGP: "EGP";
2530
+ readonly USD: "USD";
2531
+ readonly EUR: "EUR";
2532
+ readonly GBP: "GBP";
2533
+ readonly SAR: "SAR";
2534
+ readonly AED: "AED";
2535
+ readonly QAR: "QAR";
2536
+ readonly KWD: "KWD";
2537
+ readonly JOD: "JOD";
2538
+ readonly OMR: "OMR";
2539
+ readonly BHD: "BHD";
2540
+ readonly LYD: "LYD";
2541
+ readonly AUD: "AUD";
2542
+ readonly CAD: "CAD";
2543
+ readonly CNY: "CNY";
2544
+ };
2545
+
2546
+ /**
2547
+ * Generated by orval v7.21.0 🍺
2548
+ * Do not edit manually.
2549
+ * XPay Checkout API
2550
+ * API for the XPay checkout flow — client endpoints and SSR
2551
+ * OpenAPI spec version: 1.0
2552
+ */
2553
+ /**
2554
+ * Presentment currency for this line — matches session.presentmentDetails.currency
2555
+ */
2556
+ type LineItemPresentmentDetailsDtoCurrency = typeof LineItemPresentmentDetailsDtoCurrency[keyof typeof LineItemPresentmentDetailsDtoCurrency];
2557
+ declare const LineItemPresentmentDetailsDtoCurrency: {
2558
+ readonly EGP: "EGP";
2559
+ readonly USD: "USD";
2560
+ readonly EUR: "EUR";
2561
+ readonly GBP: "GBP";
2562
+ readonly SAR: "SAR";
2563
+ readonly AED: "AED";
2564
+ readonly QAR: "QAR";
2565
+ readonly KWD: "KWD";
2566
+ readonly JOD: "JOD";
2567
+ readonly OMR: "OMR";
2568
+ readonly BHD: "BHD";
2569
+ readonly LYD: "LYD";
2570
+ readonly AUD: "AUD";
2571
+ readonly CAD: "CAD";
2572
+ readonly CNY: "CNY";
2573
+ };
2574
+
2575
+ /**
2576
+ * Generated by orval v7.21.0 🍺
2577
+ * Do not edit manually.
2578
+ * XPay Checkout API
2579
+ * API for the XPay checkout flow — client endpoints and SSR
2580
+ * OpenAPI spec version: 1.0
2581
+ */
2582
+
2583
+ interface LineItemPresentmentDetailsDto {
2584
+ /** Unit amount in presentment smallest unit */
2585
+ unitAmount: number;
2586
+ /** Line subtotal (unitAmount × quantity) in presentment smallest unit */
2587
+ amountSubtotal: number;
2588
+ /** Line discount allocated to this item, in presentment smallest unit */
2589
+ amountDiscount: number;
2590
+ /** Line total after discount + tax, in presentment smallest unit */
2591
+ amountTotal: number;
2592
+ /** Presentment currency for this line — matches session.presentmentDetails.currency */
2593
+ currency: LineItemPresentmentDetailsDtoCurrency;
2594
+ }
2595
+
2596
+ /**
2597
+ * Generated by orval v7.21.0 🍺
2598
+ * Do not edit manually.
2599
+ * XPay Checkout API
2600
+ * API for the XPay checkout flow — client endpoints and SSR
2601
+ * OpenAPI spec version: 1.0
2602
+ */
2603
+
2604
+ interface LineItemDto {
2605
+ /** Line item ID */
2606
+ id: string;
2607
+ /** Quantity */
2608
+ quantity: number;
2609
+ /** Price information */
2610
+ price: PriceDto;
2611
+ /** Adjustable quantity settings */
2612
+ adjustableQuantity?: AdjustableQuantityDto;
2613
+ /** Total before any discounts or taxes (unitAmount × quantity) */
2614
+ amountSubtotal?: number;
2615
+ /** Total after discounts and taxes */
2616
+ amountTotal?: number;
2617
+ /** Discount amount applied to this item */
2618
+ amountDiscount?: number;
2619
+ /** Tax amount applied to this item */
2620
+ amountTax?: number;
2621
+ /** Currency for the amounts (ISO 4217) */
2622
+ currency?: LineItemDtoCurrency;
2623
+ /** Description from price/product */
2624
+ description?: string;
2625
+ /** Customer-facing view of this line item. Populated on checkout-session snapshots when the merchant prices in a currency different from processing. Uses the session's locked exchange rate. */
2626
+ presentmentDetails?: LineItemPresentmentDetailsDto;
2627
+ }
2628
+
2629
+ /**
2630
+ * Generated by orval v7.21.0 🍺
2631
+ * Do not edit manually.
2632
+ * XPay Checkout API
2633
+ * API for the XPay checkout flow — client endpoints and SSR
2634
+ * OpenAPI spec version: 1.0
2635
+ */
2636
+ /**
2637
+ * Field type
2638
+ */
2639
+ type CustomFieldResponseDtoType = typeof CustomFieldResponseDtoType[keyof typeof CustomFieldResponseDtoType];
2640
+ declare const CustomFieldResponseDtoType: {
2641
+ readonly TEXT: "TEXT";
2642
+ readonly NUMBER: "NUMBER";
2643
+ readonly DROPDOWN: "DROPDOWN";
2644
+ readonly CHECKBOX: "CHECKBOX";
2645
+ };
2646
+
2647
+ /**
2648
+ * Generated by orval v7.21.0 🍺
2649
+ * Do not edit manually.
2650
+ * XPay Checkout API
2651
+ * API for the XPay checkout flow — client endpoints and SSR
2652
+ * OpenAPI spec version: 1.0
2653
+ */
2654
+ /**
2655
+ * Type of validation limit
2656
+ */
2657
+ type CustomFieldResponseDtoLimitType = typeof CustomFieldResponseDtoLimitType[keyof typeof CustomFieldResponseDtoLimitType];
2658
+ declare const CustomFieldResponseDtoLimitType: {
2659
+ readonly AT_MOST: "AT_MOST";
2660
+ readonly BETWEEN: "BETWEEN";
2661
+ readonly AT_LEAST: "AT_LEAST";
2662
+ readonly EXACTLY: "EXACTLY";
2663
+ };
2664
+
2665
+ /**
2666
+ * Generated by orval v7.21.0 🍺
2667
+ * Do not edit manually.
2668
+ * XPay Checkout API
2669
+ * API for the XPay checkout flow — client endpoints and SSR
2670
+ * OpenAPI spec version: 1.0
2671
+ */
2672
+ interface DropdownOptionResponseDto {
2673
+ /** Option label */
2674
+ label: string;
2675
+ }
2676
+
2677
+ /**
2678
+ * Generated by orval v7.21.0 🍺
2679
+ * Do not edit manually.
2680
+ * XPay Checkout API
2681
+ * API for the XPay checkout flow — client endpoints and SSR
2682
+ * OpenAPI spec version: 1.0
2683
+ */
2684
+ interface CustomFieldTextValueDto {
2685
+ /** Text value */
2686
+ value: string;
2687
+ }
2688
+
2689
+ /**
2690
+ * Generated by orval v7.21.0 🍺
2691
+ * Do not edit manually.
2692
+ * XPay Checkout API
2693
+ * API for the XPay checkout flow — client endpoints and SSR
2694
+ * OpenAPI spec version: 1.0
2695
+ */
2696
+ interface CustomFieldNumericValueDto {
2697
+ /** Numeric value */
2698
+ value: string;
2699
+ }
2700
+
2701
+ /**
2702
+ * Generated by orval v7.21.0 🍺
2703
+ * Do not edit manually.
2704
+ * XPay Checkout API
2705
+ * API for the XPay checkout flow — client endpoints and SSR
2706
+ * OpenAPI spec version: 1.0
2707
+ */
2708
+ interface CustomFieldDropdownValueDto {
2709
+ /** Selected dropdown value */
2710
+ value: string;
2711
+ }
2712
+
2713
+ /**
2714
+ * Generated by orval v7.21.0 🍺
2715
+ * Do not edit manually.
2716
+ * XPay Checkout API
2717
+ * API for the XPay checkout flow — client endpoints and SSR
2718
+ * OpenAPI spec version: 1.0
2719
+ */
2720
+
2721
+ interface CustomFieldResponseDto {
2722
+ /** Unique key for the field */
2723
+ key: string;
2724
+ /** Field label */
2725
+ label: string;
2726
+ /** Field type */
2727
+ type: CustomFieldResponseDtoType;
2728
+ /** Whether the field is optional */
2729
+ isOptional: boolean;
2730
+ /** Whether validation limits are enabled */
2731
+ hasLimits?: boolean;
2732
+ /** Type of validation limit */
2733
+ limitType?: CustomFieldResponseDtoLimitType;
2734
+ /** Minimum number of characters */
2735
+ minCharacters?: number;
2736
+ /** Maximum number of characters */
2737
+ maxCharacters?: number;
2738
+ /** Dropdown options */
2739
+ dropdownOptions?: DropdownOptionResponseDto[];
2740
+ /** Text value (populated after collection) */
2741
+ text?: CustomFieldTextValueDto;
2742
+ /** Numeric value (populated after collection) */
2743
+ numeric?: CustomFieldNumericValueDto;
2744
+ /** Dropdown value (populated after collection) */
2745
+ dropdown?: CustomFieldDropdownValueDto;
2746
+ }
2747
+
2748
+ /**
2749
+ * Generated by orval v7.21.0 🍺
2750
+ * Do not edit manually.
2751
+ * XPay Checkout API
2752
+ * API for the XPay checkout flow — client endpoints and SSR
2753
+ * OpenAPI spec version: 1.0
2754
+ */
2755
+ /**
2756
+ * Discount type
2757
+ */
2758
+ type CouponResponseDtoDiscountType = typeof CouponResponseDtoDiscountType[keyof typeof CouponResponseDtoDiscountType];
2759
+ declare const CouponResponseDtoDiscountType: {
2760
+ readonly percentage: "percentage";
2761
+ readonly fixed_amount: "fixed_amount";
2762
+ };
2763
+
2764
+ /**
2765
+ * Generated by orval v7.21.0 🍺
2766
+ * Do not edit manually.
2767
+ * XPay Checkout API
2768
+ * API for the XPay checkout flow — client endpoints and SSR
2769
+ * OpenAPI spec version: 1.0
2770
+ */
2771
+ /**
2772
+ * Currency for amountOff
2773
+ */
2774
+ type CouponResponseDtoCurrency = typeof CouponResponseDtoCurrency[keyof typeof CouponResponseDtoCurrency];
2775
+ declare const CouponResponseDtoCurrency: {
2776
+ readonly EGP: "EGP";
2777
+ readonly USD: "USD";
2778
+ readonly EUR: "EUR";
2779
+ readonly GBP: "GBP";
2780
+ readonly SAR: "SAR";
2781
+ readonly AED: "AED";
2782
+ readonly QAR: "QAR";
2783
+ readonly KWD: "KWD";
2784
+ readonly JOD: "JOD";
2785
+ readonly OMR: "OMR";
2786
+ readonly BHD: "BHD";
2787
+ readonly LYD: "LYD";
2788
+ readonly AUD: "AUD";
2789
+ readonly CAD: "CAD";
2790
+ readonly CNY: "CNY";
2791
+ };
2792
+
2793
+ /**
2794
+ * Generated by orval v7.21.0 🍺
2795
+ * Do not edit manually.
2796
+ * XPay Checkout API
2797
+ * API for the XPay checkout flow — client endpoints and SSR
2798
+ * OpenAPI spec version: 1.0
2799
+ */
2800
+ /**
2801
+ * Duration
2802
+ */
2803
+ type CouponResponseDtoDuration = typeof CouponResponseDtoDuration[keyof typeof CouponResponseDtoDuration];
2804
+ declare const CouponResponseDtoDuration: {
2805
+ readonly once: "once";
2806
+ readonly repeating: "repeating";
2807
+ readonly forever: "forever";
2808
+ };
2809
+
2810
+ /**
2811
+ * Generated by orval v7.21.0 🍺
2812
+ * Do not edit manually.
2813
+ * XPay Checkout API
2814
+ * API for the XPay checkout flow — client endpoints and SSR
2815
+ * OpenAPI spec version: 1.0
2816
+ */
2817
+ /**
2818
+ * Custom metadata
2819
+ */
2820
+ type CouponResponseDtoMetadata = {
2821
+ [key: string]: unknown;
2822
+ };
2823
+
2824
+ /**
2825
+ * Generated by orval v7.21.0 🍺
2826
+ * Do not edit manually.
2827
+ * XPay Checkout API
2828
+ * API for the XPay checkout flow — client endpoints and SSR
2829
+ * OpenAPI spec version: 1.0
2830
+ */
2831
+
2832
+ /**
2833
+ * A Coupon defines a reusable discount you can apply to Checkout Sessions and PaymentIntents. Coupons can grant either a percentage off (`percentOff`) or a fixed amount off (`amountOff`), and can apply once, forever, or repeating for a number of billing cycles. You can also cap how many times a Coupon may be redeemed and when it expires.
2834
+
2835
+ Coupons are the reusable template. Each concrete application of a Coupon to a customer's purchase is recorded as a Discount. To give customers a redeemable code (e.g. `SUMMER25`) instead of applying the Coupon directly, create one or more Promotion Codes that map to this Coupon — a single Coupon can have many Promotion Codes, each with its own per-code restrictions. You receive `coupon.*` and `promotion_code.*` webhook events for each as they are created or changed.
2836
+ */
2837
+ interface CouponResponseDto {
2838
+ /** Coupon ID */
2839
+ id: string;
2840
+ /** Object type */
2841
+ object: string;
2842
+ /** Created timestamp (ISO 8601) */
2843
+ createdAt: string;
2844
+ /** Discount type */
2845
+ discountType: CouponResponseDtoDiscountType;
2846
+ /** Percentage off (0.01-100) */
2847
+ percentOff?: number;
2848
+ /** Fixed amount off in smallest currency unit */
2849
+ amountOff?: number;
2850
+ /** Currency for amountOff */
2851
+ currency?: CouponResponseDtoCurrency;
2852
+ /** Duration */
2853
+ duration: CouponResponseDtoDuration;
2854
+ /** Number of months for repeating duration */
2855
+ durationInMonths?: number;
2856
+ /** Display name */
2857
+ name?: string;
2858
+ /** Maximum discount amount for percentage coupons (caps the discount) */
2859
+ maxDiscountAmount?: number;
2860
+ /** Minimum order subtotal required to use this coupon */
2861
+ minValue?: number;
2862
+ /** Maximum total redemptions */
2863
+ maxRedemptions?: number;
2864
+ /** Maximum times a single customer can redeem */
2865
+ customerMaxRedemptions?: number;
2866
+ /** Number of times redeemed */
2867
+ timesRedeemed: number;
2868
+ /** Redemption deadline (ISO 8601) */
2869
+ redeemBy?: string;
2870
+ /** Whether the coupon is currently valid (computed) */
2871
+ valid: boolean;
2872
+ /** Whether the coupon is active */
2873
+ active: boolean;
2874
+ /** Product IDs this coupon applies to */
2875
+ appliesToProductIds?: string[];
2876
+ /** Custom metadata */
2877
+ metadata?: CouponResponseDtoMetadata;
2878
+ /** Merchant ID */
2879
+ merchantId: string;
2880
+ /** Whether this is live mode */
2881
+ livemode: boolean;
2882
+ }
2883
+
2884
+ /**
2885
+ * Generated by orval v7.21.0 🍺
2886
+ * Do not edit manually.
2887
+ * XPay Checkout API
2888
+ * API for the XPay checkout flow — client endpoints and SSR
2889
+ * OpenAPI spec version: 1.0
2890
+ */
2891
+
2892
+ /**
2893
+ * A Discount records a single application of a Coupon to a specific Checkout Session, PaymentIntent, or Customer. Where a Coupon is the reusable template, a Discount captures the concrete redemption: which Coupon was applied, when it became active, when it expires, and (when applicable) which Promotion Code the customer entered to claim it.
2894
+ */
2895
+ interface DiscountResponseDto {
2896
+ /** Discount ID */
2897
+ id: string;
2898
+ /** Object type */
2899
+ object: string;
2900
+ /** The coupon that was applied */
2901
+ coupon: CouponResponseDto;
2902
+ /** Promotion code ID used (null if direct coupon application) */
2903
+ promotionCodeId?: string;
2904
+ /** Customer-facing promotion code string (e.g. SUMMER25) */
2905
+ promotionCodeCode?: string;
2906
+ /** Checkout session this discount was applied to */
2907
+ checkoutSessionId: string;
2908
+ /** Customer who received the discount */
2909
+ customerId?: string;
2910
+ /** When the discount became active (ISO 8601) */
2911
+ start: string;
2912
+ /** When the discount ends (ISO 8601) */
2913
+ end?: string;
2914
+ }
2915
+
2916
+ /**
2917
+ * Generated by orval v7.21.0 🍺
2918
+ * Do not edit manually.
2919
+ * XPay Checkout API
2920
+ * API for the XPay checkout flow — client endpoints and SSR
2921
+ * OpenAPI spec version: 1.0
2922
+ */
2923
+ /**
2924
+ * Where this config came from
2925
+ */
2926
+ type FeeConfigResponseDtoSource = typeof FeeConfigResponseDtoSource[keyof typeof FeeConfigResponseDtoSource];
2927
+ declare const FeeConfigResponseDtoSource: {
2928
+ readonly session: "session";
2929
+ readonly merchant: "merchant";
2930
+ readonly system: "system";
2931
+ };
2932
+
2933
+ /**
2934
+ * Generated by orval v7.21.0 🍺
2935
+ * Do not edit manually.
2936
+ * XPay Checkout API
2937
+ * API for the XPay checkout flow — client endpoints and SSR
2938
+ * OpenAPI spec version: 1.0
2939
+ */
2940
+
2941
+ interface FeeConfigResponseDto {
2942
+ /** Whether customer pays platform fee (false = merchant pays) */
2943
+ feesPassThrough: boolean;
2944
+ /** Whether to collect VAT from customer */
2945
+ vatCollectionEnabled: boolean;
2946
+ /** VAT collection rate in basis points (e.g., 1400 = 14%) */
2947
+ vatCollectionRate?: number;
2948
+ /** Where this config came from */
2949
+ source: FeeConfigResponseDtoSource;
2950
+ }
2951
+
2952
+ /**
2953
+ * Generated by orval v7.21.0 🍺
2954
+ * Do not edit manually.
2955
+ * XPay Checkout API
2956
+ * API for the XPay checkout flow — client endpoints and SSR
2957
+ * OpenAPI spec version: 1.0
2958
+ */
2959
+ /**
2960
+ * Language the checkout page is displayed in. Resolved from `session.locale`, falling back to your account's `defaultLocale`, then to `en`.
2961
+ */
2962
+ type CheckoutSessionResponseDtoLocale = typeof CheckoutSessionResponseDtoLocale[keyof typeof CheckoutSessionResponseDtoLocale];
2963
+ declare const CheckoutSessionResponseDtoLocale: {
2964
+ readonly en: "en";
2965
+ readonly ar: "ar";
2966
+ };
2967
+
2968
+ /**
2969
+ * Generated by orval v7.21.0 🍺
2970
+ * Do not edit manually.
2971
+ * XPay Checkout API
2972
+ * API for the XPay checkout flow — client endpoints and SSR
2973
+ * OpenAPI spec version: 1.0
2974
+ */
2975
+ interface PaymentMethodTypeResponseDto {
2976
+ /** Concrete payment method type (e.g., 'card', 'fawry', 'valu') */
2977
+ type: string;
2978
+ /** Display name for the payment method */
2979
+ displayName: string;
2980
+ /** UI grouping category (e.g., 'card', 'bnpl', 'kiosk') */
2981
+ category?: string;
2982
+ /**
2983
+ * Minimum transaction amount in piasters
2984
+ * @nullable
2985
+ */
2986
+ minTransactionAmount?: string | null;
2987
+ /**
2988
+ * Maximum transaction amount in piasters
2989
+ * @nullable
2990
+ */
2991
+ maxTransactionAmount?: string | null;
2992
+ /**
2993
+ * Required customer fields for this payment method
2994
+ * @nullable
2995
+ */
2996
+ requiredCustomerFields?: string[] | null;
2997
+ /** Whether this payment method supports refunds */
2998
+ supportsRefund?: boolean;
2999
+ /** Whether partial refunds are supported */
3000
+ supportsPartialRefund?: boolean;
3001
+ /** Whether partial capture is supported */
3002
+ supportsPartialCapture?: boolean;
3003
+ /** Whether payment resolves immediately or asynchronously */
3004
+ paymentConfirmation?: string;
3005
+ }
3006
+
3007
+ /**
3008
+ * Generated by orval v7.21.0 🍺
3009
+ * Do not edit manually.
3010
+ * XPay Checkout API
3011
+ * API for the XPay checkout flow — client endpoints and SSR
3012
+ * OpenAPI spec version: 1.0
3013
+ */
3014
+
3015
+ interface FeesResponseDto {
3016
+ /** Payment method type (e.g., card, fawry, valu) */
3017
+ paymentMethodType: string;
3018
+ /** Platform fee amount (only if feesPassThrough is true) */
3019
+ feeAmount: number;
3020
+ /** Fee percentage */
3021
+ feePercentage: number;
3022
+ /** VAT amount (only if vatCollectionEnabled is true) */
3023
+ vatAmount?: number;
3024
+ /** Total amount customer will pay */
3025
+ totalAmount: number;
3026
+ /** Card info (only for card payments with BIN) */
3027
+ cardInfo?: CardInfoResponseDto;
3028
+ }
3029
+
3030
+ /**
3031
+ * Generated by orval v7.21.0 🍺
3032
+ * Do not edit manually.
3033
+ * XPay Checkout API
3034
+ * API for the XPay checkout flow — client endpoints and SSR
3035
+ * OpenAPI spec version: 1.0
3036
+ */
3037
+ /**
3038
+ * Whether to save address to customer.address
3039
+ */
3040
+ type CustomerUpdateResponseDtoAddress = typeof CustomerUpdateResponseDtoAddress[keyof typeof CustomerUpdateResponseDtoAddress];
3041
+ declare const CustomerUpdateResponseDtoAddress: {
3042
+ readonly auto: "auto";
3043
+ readonly never: "never";
3044
+ };
3045
+
3046
+ /**
3047
+ * Generated by orval v7.21.0 🍺
3048
+ * Do not edit manually.
3049
+ * XPay Checkout API
3050
+ * API for the XPay checkout flow — client endpoints and SSR
3051
+ * OpenAPI spec version: 1.0
3052
+ */
3053
+ /**
3054
+ * Whether to save name to customer.name
3055
+ */
3056
+ type CustomerUpdateResponseDtoName = typeof CustomerUpdateResponseDtoName[keyof typeof CustomerUpdateResponseDtoName];
3057
+ declare const CustomerUpdateResponseDtoName: {
3058
+ readonly auto: "auto";
3059
+ readonly never: "never";
3060
+ };
3061
+
3062
+ /**
3063
+ * Generated by orval v7.21.0 🍺
3064
+ * Do not edit manually.
3065
+ * XPay Checkout API
3066
+ * API for the XPay checkout flow — client endpoints and SSR
3067
+ * OpenAPI spec version: 1.0
3068
+ */
3069
+ /**
3070
+ * Whether to save shipping to customer.shipping
3071
+ */
3072
+ type CustomerUpdateResponseDtoShipping = typeof CustomerUpdateResponseDtoShipping[keyof typeof CustomerUpdateResponseDtoShipping];
3073
+ declare const CustomerUpdateResponseDtoShipping: {
3074
+ readonly auto: "auto";
3075
+ readonly never: "never";
3076
+ };
3077
+
3078
+ /**
3079
+ * Generated by orval v7.21.0 🍺
3080
+ * Do not edit manually.
3081
+ * XPay Checkout API
3082
+ * API for the XPay checkout flow — client endpoints and SSR
3083
+ * OpenAPI spec version: 1.0
3084
+ */
3085
+
3086
+ interface CustomerUpdateResponseDto {
3087
+ /** Whether to save address to customer.address */
3088
+ address?: CustomerUpdateResponseDtoAddress;
3089
+ /** Whether to save name to customer.name */
3090
+ name?: CustomerUpdateResponseDtoName;
3091
+ /** Whether to save shipping to customer.shipping */
3092
+ shipping?: CustomerUpdateResponseDtoShipping;
3093
+ }
3094
+
3095
+ /**
3096
+ * Generated by orval v7.21.0 🍺
3097
+ * Do not edit manually.
3098
+ * XPay Checkout API
3099
+ * API for the XPay checkout flow — client endpoints and SSR
3100
+ * OpenAPI spec version: 1.0
3101
+ */
3102
+ /**
3103
+ * Custom metadata
3104
+ */
3105
+ type CheckoutSessionResponseDtoMetadata = {
3106
+ [key: string]: unknown;
3107
+ };
3108
+
3109
+ /**
3110
+ * Generated by orval v7.21.0 🍺
3111
+ * Do not edit manually.
3112
+ * XPay Checkout API
3113
+ * API for the XPay checkout flow — client endpoints and SSR
3114
+ * OpenAPI spec version: 1.0
3115
+ */
3116
+
3117
+ /**
3118
+ * A Checkout Session represents your customer's session as they pay on an xpay-hosted checkout page. Create a new Session each time a customer begins a checkout: attach line items, customer details, or a PaymentIntent, then redirect the customer to the Session's `url` to begin payment. As the customer progresses, the Session's `status` and `paymentStatus` update; once payment succeeds, the Session contains references to the resulting Customer and PaymentIntent. Sessions expire 24 hours after creation if not completed.
3119
+ */
3120
+ interface CheckoutSessionResponseDto {
3121
+ /** Checkout session ID. Absent on the SSR hosted-view payload derived from a payment link (before the first mutation materializes the session). */
3122
+ id?: string;
3123
+ /** Object type */
3124
+ object: string;
3125
+ /** Created timestamp (ISO 8601) */
3126
+ createdAt: string;
3127
+ /** Updated timestamp (ISO 8601) */
3128
+ updatedAt?: string;
3129
+ /** Session mode */
3130
+ mode: CheckoutSessionResponseDtoMode;
3131
+ /** UI mode */
3132
+ uiMode: CheckoutSessionResponseDtoUiMode;
3133
+ /** Submit type */
3134
+ submitType: CheckoutSessionResponseDtoSubmitType;
3135
+ /** Customer creation mode */
3136
+ customerCreation: CheckoutSessionResponseDtoCustomerCreation;
3137
+ /** Session status */
3138
+ status: CheckoutSessionResponseDtoStatus;
3139
+ /** Payment status */
3140
+ paymentStatus: CheckoutSessionResponseDtoPaymentStatus;
3141
+ /** Currency code (ISO 4217) */
3142
+ currency?: CheckoutSessionResponseDtoCurrency;
3143
+ /** Subtotal before discounts/taxes */
3144
+ amountSubtotal?: number;
3145
+ /** Total amount due */
3146
+ amountTotal?: number;
3147
+ /** Amount breakdown */
3148
+ totalDetails?: TotalDetailsResponseDto;
3149
+ /** Customer-facing view of the session — full mirror of subtotal/total/discount/VAT/fees in the presentment currency. Populated only when the merchant prices in a currency different from processing. Uses a rate locked at session creation. */
3150
+ presentmentDetails?: SessionPresentmentDetailsDto;
3151
+ /** What happens after payment: redirect to merchant URL or show hosted confirmation page */
3152
+ afterCompletion: CheckoutSessionResponseDtoAfterCompletion;
3153
+ /** Cancel redirect URL (back button during checkout) */
3154
+ cancelUrl?: string;
3155
+ /** Checkout page URL (hosted mode) */
3156
+ url?: string;
3157
+ /** Client secret for frontend access */
3158
+ clientSecret?: string;
3159
+ /** Expiration timestamp (ISO 8601) */
3160
+ expiresAt?: string;
3161
+ /** Customer ID (when existing customer linked) */
3162
+ customerId?: string;
3163
+ /** Customer object (when customerId is provided). Contains existing customer data for prefill. */
3164
+ customer?: CheckoutSessionCustomerDto;
3165
+ /** CustomerDetails - unified prefill/collection object. Contains name, email, phone, address (billing), shipping. */
3166
+ customerDetails?: CustomerDetailsResponseDto;
3167
+ /** Payment Intent ID */
3168
+ paymentIntentId?: string;
3169
+ /**
3170
+ * The PaymentIntent for this session, or `null` if no payment has been started yet. The PaymentIntent's own `checkoutSession` field is not included here to keep the response self-contained.
3171
+ * @nullable
3172
+ */
3173
+ paymentIntent: CheckoutSessionResponseDtoPaymentIntent;
3174
+ /** Line items with full price and product details */
3175
+ lineItems?: LineItemDto[];
3176
+ /** Custom fields with configuration and collected values (Stripe-aligned). Values are populated after customer submits. */
3177
+ customFields?: CustomFieldResponseDto[];
3178
+ /** Applied discounts on this session */
3179
+ discounts?: DiscountResponseDto[];
3180
+ /** Allow promotion codes */
3181
+ allowPromotionCodes: boolean;
3182
+ /** Collect customer name */
3183
+ nameCollection: boolean;
3184
+ /** Collect billing address */
3185
+ billingAddressCollection: boolean;
3186
+ /** Collect shipping address */
3187
+ shippingAddressCollection: boolean;
3188
+ /** Collect phone number */
3189
+ phoneNumberCollection: boolean;
3190
+ /** Fee configuration (tells checkout whether to track BIN and display fees) */
3191
+ feeConfig?: FeeConfigResponseDto;
3192
+ /** UI customization settings for checkout (colors, spacing, borders, etc.). Fully resolved: merchant defaults merged with session-level overrides. Callers can apply this object directly — no client-side merging required. */
3193
+ brandingSettings?: BrandingSettingsResponseDto;
3194
+ /** Language the checkout page is displayed in. Resolved from `session.locale`, falling back to your account's `defaultLocale`, then to `en`. */
3195
+ locale?: CheckoutSessionResponseDtoLocale;
3196
+ /** Available payment method types with fee estimates */
3197
+ paymentMethodTypes?: PaymentMethodTypeResponseDto[];
3198
+ /** ID of the PaymentMethodConfiguration used for this session */
3199
+ paymentMethodConfigurationId?: string;
3200
+ /** Fee breakdown (only populated when feesPassThrough or vatCollectionEnabled, and after /update with BIN for cards) */
3201
+ fees?: FeesResponseDto;
3202
+ /** Controls which customer fields to update when customerId is provided */
3203
+ customerUpdate?: CustomerUpdateResponseDto;
3204
+ /** Custom metadata */
3205
+ metadata?: CheckoutSessionResponseDtoMetadata;
3206
+ /** Merchant ID */
3207
+ merchantId: string;
3208
+ /** Merchant display name */
3209
+ merchantName?: string;
3210
+ /** Merchant logo URL */
3211
+ merchantLogo?: string;
3212
+ /** Payment Link ID (if created from link) */
3213
+ paymentLinkId?: string;
3214
+ /** Whether this is a live mode session */
3215
+ livemode: boolean;
3216
+ }
3217
+
3218
+ /**
3219
+ * XPay SDK Public API Types
3220
+ *
3221
+ * SDK-specific interfaces (XPayInstance, Elements, etc.) are defined here.
3222
+ * Data types (session fields, payment methods, etc.) are derived from
3223
+ * the Orval-generated @xpay/checkout-api package — the source of truth.
3224
+ * If the API changes a field, TypeScript catches it at compile time.
3225
+ */
3226
+
3227
+ /**
3228
+ * Information about an available payment method.
3229
+ *
3230
+ * @example
3231
+ * ```ts
3232
+ * checkout.paymentMethods.forEach(pm => {
3233
+ * console.log(pm.type); // "card", "valu", "fawry"
3234
+ * console.log(pm.displayName); // "Card", "ValU", "Fawry"
3235
+ * console.log(pm.category); // "card", "bnpl", "kiosk", "wallet"
3236
+ * });
3237
+ * ```
3238
+ */
3239
+ type PaymentMethodInfo = Required<Pick<PaymentMethodTypeResponseDto, "type" | "displayName">> & {
3240
+ /** Payment method category for grouping in UI */
3241
+ category: "card" | "bnpl" | "kiosk" | "wallet";
3242
+ /** Icon URL for the payment method */
3243
+ icon?: string;
3244
+ /** Description of the next step (e.g., "You will be redirected to complete payment") */
3245
+ nextActionText?: string;
3246
+ };
3247
+ /**
3248
+ * Appearance overrides for the checkout UI.
3249
+ * Merged with the session's server-side `brandingSettings`.
3250
+ *
3251
+ * @example
3252
+ * ```ts
3253
+ * const elements = xpay.elements({
3254
+ * clientSecret,
3255
+ * appearance: {
3256
+ * colorMode: "dark",
3257
+ * borderStyle: "rounded",
3258
+ * inputStyle: "outlined",
3259
+ * },
3260
+ * });
3261
+ * ```
3262
+ */
3263
+ type Appearance = Pick<BrandingSettingsResponseDto, "colorMode" | "borderStyle" | "spacing" | "inputSize" | "inputStyle" | "formLayout" | "colors" | "fontFamily">;
3264
+ /**
3265
+ * Structured session status — tagged union for exhaustive checking.
3266
+ *
3267
+ * @example
3268
+ * ```ts
3269
+ * switch (checkout.status.type) {
3270
+ * case "open": // ready for payment
3271
+ * case "expired": // session timed out
3272
+ * case "complete": // payment completed — check paymentStatus
3273
+ * }
3274
+ * ```
3275
+ */
3276
+ type SessionStatus = {
3277
+ type: "open";
3278
+ } | {
3279
+ type: "expired";
3280
+ } | {
3281
+ type: "complete";
3282
+ paymentStatus: CheckoutSessionResponseDtoPaymentStatus;
3283
+ };
3284
+ /**
3285
+ * Checkout session data exposed to merchants.
3286
+ *
3287
+ * Contains everything needed to render a checkout UI: amounts, currency,
3288
+ * available payment methods, line items, fees, and discounts.
3289
+ *
3290
+ * @example
3291
+ * ```ts
3292
+ * const state = useCheckout();
3293
+ * if (state.type === "success") {
3294
+ * const { checkout } = state;
3295
+ * console.log(checkout.amountTotal); // "10000" (in minor units)
3296
+ * console.log(checkout.currency); // "EGP"
3297
+ * console.log(checkout.status.type); // "open"
3298
+ * console.log(checkout.paymentMethods); // [{type: "card", ...}, ...]
3299
+ * }
3300
+ * ```
3301
+ */
3302
+ type CheckoutSession = Pick<CheckoutSessionResponseDto, "id" | "amountSubtotal" | "amountTotal" | "currency" | "merchantName" | "livemode" | "expiresAt"> & {
3303
+ /** Structured session status */
3304
+ status: SessionStatus;
3305
+ /** Whether the session is ready for confirmation */
3306
+ canConfirm: boolean;
3307
+ /** Available payment methods */
3308
+ paymentMethods: PaymentMethodInfo[];
3309
+ /** Line items in the session */
3310
+ lineItems?: CheckoutSessionResponseDto["lineItems"];
3311
+ /** Totals breakdown (subtotal, tax, shipping, etc.) */
3312
+ totalDetails?: CheckoutSessionResponseDto["totalDetails"];
3313
+ /** Fee breakdown (when feesPassThrough is enabled) */
3314
+ fees?: CheckoutSessionResponseDto["fees"];
3315
+ /** Applied discounts / promotion codes */
3316
+ discounts?: CheckoutSessionResponseDto["discounts"];
3317
+ };
3318
+
3319
+ /**
3320
+ * Result of an action (confirm, promo, quantity update, etc.).
3321
+ * Tagged union — check `result.type` to determine success or failure.
3322
+ *
3323
+ * @example
3324
+ * ```ts
3325
+ * const result = await checkout.applyPromotionCode("SAVE10");
3326
+ * if (result.type === "success") {
3327
+ * console.log(result.session.amountTotal); // updated amount
3328
+ * } else {
3329
+ * console.log(result.error.message); // "Invalid promotion code"
3330
+ * }
3331
+ * ```
3332
+ */
3333
+ type ActionResult<E = XPayError> = {
3334
+ type: "success";
3335
+ session: CheckoutSession;
3336
+ } | {
3337
+ type: "error";
3338
+ error: E;
3339
+ };
3340
+ /**
3341
+ * Unified error type for ALL SDK operations (Stripe-style).
3342
+ *
3343
+ * Same type for `confirm()`, `applyPromotionCode()`, `updateLineItemQuantity()`, etc.
3344
+ * Payment-specific fields (`declineCode`, `adviceCode`, `chargeId`, `paymentMethod`) are
3345
+ * `null` for non-payment errors.
3346
+ *
3347
+ * @example Payment decline:
3348
+ * ```ts
3349
+ * const result = await checkout.confirm({ customerDetails: { email } });
3350
+ * if (result.type === "error") {
3351
+ * console.log(result.error.type); // "card_error"
3352
+ * console.log(result.error.code); // "card_declined"
3353
+ * console.log(result.error.declineCode); // "insufficient_funds"
3354
+ * console.log(result.error.adviceCode); // "try_again_later"
3355
+ * console.log(result.error.message); // "Your card has insufficient funds."
3356
+ * }
3357
+ * ```
3358
+ *
3359
+ * @example API error (promo code, quantity, session):
3360
+ * ```ts
3361
+ * const result = await checkout.applyPromotionCode("INVALID");
3362
+ * if (result.type === "error") {
3363
+ * console.log(result.error.type); // "invalid_request_error"
3364
+ * console.log(result.error.code); // "promotion_code_not_found"
3365
+ * console.log(result.error.param); // "promotionCode"
3366
+ * console.log(result.error.docUrl); // "https://docs.xpay.app/api/errors#promotion_code_not_found"
3367
+ * console.log(result.error.message); // "No promotion code found for 'INVALID'"
3368
+ * }
3369
+ * ```
3370
+ */
3371
+ interface XPayError {
3372
+ /** Error category: "card_error" | "payment_method_error" | "invalid_request_error" | "api_error" | ... */
3373
+ type: string;
3374
+ /** Machine-readable error code: "card_declined" | "checkout_session_expired" | "promotion_code_not_found" | ... */
3375
+ code: string | null;
3376
+ /** Human-readable error message */
3377
+ message: string;
3378
+ /** Parameter that caused the error (e.g., "promotionCode", "quantity") — null for payment errors */
3379
+ param?: string | null;
3380
+ /** Documentation URL for this error code */
3381
+ docUrl?: string | null;
3382
+ /** Decline code — WHY it failed specifically ("insufficient_funds", "generic_decline") — null for non-payment errors */
3383
+ declineCode?: string | null;
3384
+ /** Retry advice ("try_again_later" | "do_not_try_again" | "confirm_card_data") — null for non-payment errors */
3385
+ adviceCode?: string | null;
3386
+ /** Failed charge ID — null for non-payment errors */
3387
+ chargeId?: string | null;
3388
+ /** Failed payment method ID — null for non-payment errors */
3389
+ paymentMethodId?: string | null;
3390
+ /** Payment method type ("card" | "valu" | "fawry") — null for non-payment errors */
3391
+ paymentMethodType?: string | null;
3392
+ /** Payment method snapshot at time of failure — null for non-payment errors */
3393
+ paymentMethod?: Record<string, unknown> | null;
3394
+ }
3395
+ /**
3396
+ * The XPay SDK instance returned by `loadXPay()`.
3397
+ *
3398
+ * @example
3399
+ * ```ts
3400
+ * import { loadXPay } from "@xpayeg/sdk";
3401
+ *
3402
+ * const xpay = await loadXPay("pk_test_xxx");
3403
+ * const elements = xpay.elements({ clientSecret: "cs_test_abc_secret_xyz" });
3404
+ * ```
3405
+ */
3406
+ interface XPayInstance {
3407
+ /**
3408
+ * Create an Elements instance for custom checkout UI.
3409
+ * Use with `PaymentElement` or `CardElement` to render payment forms.
3410
+ *
3411
+ * @param options - Must include `clientSecret` from a checkout session
3412
+ * @returns An Elements instance for creating and managing payment elements
3413
+ */
3414
+ elements(options: ElementsOptions): Elements;
3415
+ /**
3416
+ * Create a drop-in checkout modal or inline embed.
3417
+ *
3418
+ * @param options - Configuration including `clientSecret` and event handlers
3419
+ * @returns A checkout instance with `open()`, `close()`, and `destroy()` methods
3420
+ */
3421
+ checkout(options: CheckoutOptions): CheckoutInstance;
3422
+ /**
3423
+ * Confirm a payment using the data collected by Elements.
3424
+ *
3425
+ * @param options - Must include `elements` and optionally `customerDetails`
3426
+ * @returns Action result with the updated session on success, or an error
3427
+ */
3428
+ confirmPayment(options: ConfirmPaymentOptions): Promise<ActionResult>;
3429
+ /**
3430
+ * Initialize a checkout session — combines `elements()` with session data.
3431
+ * Returns session data + action methods in a single call.
3432
+ *
3433
+ * @param options - Must include `clientSecret`
3434
+ * @returns Session data merged with checkout action methods
3435
+ */
3436
+ initCheckout(options: InitCheckoutOptions): Promise<InitCheckoutResult>;
3437
+ }
3438
+ /**
3439
+ * Options for creating an Elements instance.
3440
+ *
3441
+ * @example
3442
+ * ```ts
3443
+ * const elements = xpay.elements({
3444
+ * clientSecret: "cs_test_abc_secret_xyz",
3445
+ * appearance: { colorMode: "dark" },
3446
+ * locale: "ar",
3447
+ * });
3448
+ * ```
3449
+ */
3450
+ interface ElementsOptions {
3451
+ /** The client secret from a checkout session. Can be a string or a Promise. */
3452
+ clientSecret: string | Promise<string>;
3453
+ /** Appearance overrides for the checkout UI */
3454
+ appearance?: Appearance;
3455
+ /** Locale for the payment form — `"en"` (default) or `"ar"` */
3456
+ locale?: "en" | "ar";
3457
+ }
3458
+ /**
3459
+ * Manages the lifecycle of payment elements (PaymentElement, CardElement).
3460
+ *
3461
+ * A single Elements instance manages one embed iframe shared by all elements.
3462
+ * Provides session management methods (promo codes, quantities, etc.) and
3463
+ * element creation.
3464
+ */
3465
+ interface Elements {
3466
+ /** Create a PaymentElement (full payment method selector + card form) */
3467
+ create(type: "payment", options?: PaymentElementOptions): PaymentElement;
3468
+ /** Create a CardElement (card form only — merchant handles method selection) */
3469
+ create(type: "card", options?: CardElementOptions): CardElement;
3470
+ /** Get an existing element by type, or null if not created */
3471
+ getElement(type: "payment"): PaymentElement | null;
3472
+ /** Get an existing element by type, or null if not created */
3473
+ getElement(type: "card"): CardElement | null;
3474
+ /** Fetch available payment methods for this session */
3475
+ fetchPaymentMethods(): Promise<PaymentMethodInfo[]>;
3476
+ /**
3477
+ * Listen for the `ready` event — fires when the session is loaded and elements can render.
3478
+ * If the session is already loaded, the handler fires immediately.
3479
+ */
3480
+ on(event: "ready", handler: (data: ElementsReadyEvent) => void): void;
3481
+ /** Listen for session data changes (payment method selection, promo codes, fee updates, etc.) */
3482
+ on(event: "change", handler: (session: CheckoutSession) => void): void;
3483
+ /** Listen for session load failures (network errors, invalid client secret, API errors) */
3484
+ on(event: "loaderror", handler: (data: ElementsLoadErrorEvent) => void): void;
3485
+ /** Listen for unsolicited errors not triggered by a merchant action (e.g. session expired during fee recalculation, BIN detection failure) */
3486
+ on(event: "error", handler: (error: XPayError) => void): void;
3487
+ /** Listen for a custom event */
3488
+ on(event: string, handler: (...args: unknown[]) => void): void;
3489
+ /** Remove an event handler */
3490
+ off(event: string, handler: (...args: unknown[]) => void): void;
3491
+ /** Apply a promotion code to the session */
3492
+ applyPromotionCode(code: string): Promise<ActionResult>;
3493
+ /** Remove the applied promotion code */
3494
+ removePromotionCode(): Promise<ActionResult>;
3495
+ /** Update a line item's quantity */
3496
+ updateLineItemQuantity(args: {
3497
+ lineItem: string;
3498
+ quantity: number;
3499
+ }): Promise<ActionResult>;
3500
+ /** Validate all element fields before confirming — returns the selected payment method on success */
3501
+ submit(): Promise<{
3502
+ error?: XPayError;
3503
+ selectedPaymentMethod?: string;
3504
+ }>;
3505
+ /** Re-fetch the session from the server to get the latest data */
3506
+ fetchUpdates(): Promise<ActionResult>;
3507
+ /** Update the appearance at runtime without recreating elements */
3508
+ changeAppearance(appearance: Appearance): void;
3509
+ /** Destroy the Elements instance and clean up all resources */
3510
+ destroy(): void;
3511
+ }
3512
+ /** Fired when the session is loaded and elements are ready to render */
3513
+ interface ElementsReadyEvent {
3514
+ /** The loaded checkout session data */
3515
+ session: CheckoutSession;
3516
+ }
3517
+ /** Fired when the session fails to load */
3518
+ interface ElementsLoadErrorEvent {
3519
+ /** Error category */
3520
+ type: "invalid_request_error" | "api_error" | "network_error";
3521
+ /** Human-readable error message */
3522
+ message: string;
3523
+ /** Machine-readable error code */
3524
+ code?: string;
3525
+ /** The parameter that caused the error */
3526
+ param?: string;
3527
+ /** Link to documentation about this error */
3528
+ docUrl?: string;
3529
+ }
3530
+ /** Options for creating a PaymentElement */
3531
+ interface PaymentElementOptions {
3532
+ /** Layout style for the payment method selector — `"accordion"` (default) or `"tabs"` */
3533
+ layout?: "accordion" | "tabs";
3534
+ /** Pre-select a specific payment method by type */
3535
+ defaultPaymentMethod?: string;
3536
+ /** Custom ordering of payment methods by type */
3537
+ paymentMethodOrder?: string[];
3538
+ }
3539
+ /** Options for creating a CardElement */
3540
+ interface CardElementOptions {
3541
+ /** Whether to show the cardholder name input */
3542
+ showCardholderName?: boolean;
3543
+ }
3544
+ /**
3545
+ * Change event from a PaymentElement.
3546
+ * Fires on payment method selection, card field changes, and session updates.
3547
+ *
3548
+ * @example
3549
+ * ```tsx
3550
+ * <PaymentElement
3551
+ * onChange={(event) => {
3552
+ * setPaymentReady(event.complete);
3553
+ * console.log("Selected method:", event.value.type);
3554
+ * }}
3555
+ * />
3556
+ * ```
3557
+ */
3558
+ interface PaymentElementChangeEvent {
3559
+ elementType: "payment";
3560
+ /** Whether all card fields are empty (no user input yet) */
3561
+ empty: boolean;
3562
+ /** Whether the form is complete and ready for submission */
3563
+ complete: boolean;
3564
+ /** Whether the payment method selector is collapsed (no method selected) */
3565
+ collapsed: boolean;
3566
+ /** The currently selected payment method */
3567
+ value: {
3568
+ type: string;
3569
+ };
3570
+ /** Full session data including updated amounts, fees, and discounts */
3571
+ session: CheckoutSession;
3572
+ }
3573
+ /**
3574
+ * Change event from a CardElement.
3575
+ * Fires when card fields change (input, validation, completion).
3576
+ */
3577
+ interface CardElementChangeEvent {
3578
+ elementType: "card";
3579
+ /** Whether all card fields are empty */
3580
+ empty: boolean;
3581
+ /** Whether all card fields are filled and valid */
3582
+ complete: boolean;
3583
+ /** Detected card details (available as user types) */
3584
+ value: {
3585
+ /** Card brand (e.g., "visa", "mastercard") — null until detected */
3586
+ brand: string | null;
3587
+ };
3588
+ }
3589
+ /** Base interface shared by all element types */
3590
+ interface BaseElement {
3591
+ /** Mount the element into a DOM container (CSS selector or HTMLElement) */
3592
+ mount(container: string | HTMLElement): void;
3593
+ /** Unmount the element from the DOM (can be re-mounted later) */
3594
+ unmount(): void;
3595
+ /** Destroy the element and release all resources */
3596
+ destroy(): void;
3597
+ /** Programmatically focus the element's iframe */
3598
+ focus(): void;
3599
+ /** Programmatically blur the element's iframe */
3600
+ blur(): void;
3601
+ /** Fired when the element is mounted and the iframe content is ready */
3602
+ on(event: "ready", handler: () => void): void;
3603
+ /** Fired when the element's iframe starts loading */
3604
+ on(event: "loaderstart", handler: () => void): void;
3605
+ /** Fired when the element fails to load */
3606
+ on(event: "loaderror", handler: (event: ElementsLoadErrorEvent) => void): void;
3607
+ on(event: string, handler: (...args: unknown[]) => void): void;
3608
+ off(event: string, handler: (...args: unknown[]) => void): void;
3609
+ }
3610
+ /** PaymentElement — full payment method selector with card form */
3611
+ interface PaymentElement extends BaseElement {
3612
+ /** Collapse the payment method selector (deselect all methods) */
3613
+ collapse(): void;
3614
+ /** Update element options at runtime */
3615
+ update(options: Partial<PaymentElementOptions>): void;
3616
+ }
3617
+ /** CardElement — card-only form (merchant handles payment method selection) */
3618
+ interface CardElement extends BaseElement {
3619
+ /** Update element options at runtime */
3620
+ update(options: Partial<CardElementOptions>): void;
3621
+ }
3622
+ /**
3623
+ * Options for `confirmPayment()` or `checkout.confirm()`.
3624
+ *
3625
+ * The `redirect` option controls what happens after a successful payment:
3626
+ * - `"if_required"` (default) — returns the result to your code
3627
+ * - `"always"` — always redirects to `returnUrl` after payment
3628
+ *
3629
+ * @example
3630
+ * ```ts
3631
+ * // Default: get the result back in code
3632
+ * const result = await checkout.confirm({
3633
+ * customerDetails: { email: "user@example.com" },
3634
+ * });
3635
+ *
3636
+ * // Always redirect after payment
3637
+ * await checkout.confirm({
3638
+ * redirect: "always",
3639
+ * returnUrl: "https://merchant.com/success",
3640
+ * });
3641
+ * ```
3642
+ */
3643
+ interface ConfirmPaymentOptions {
3644
+ /** The Elements instance managing the payment form */
3645
+ elements: Elements;
3646
+ /** Customer details collected by the merchant's form */
3647
+ customerDetails?: CustomerDetails;
3648
+ /** Custom field values for the session */
3649
+ customFields?: Record<string, string | number | boolean>;
3650
+ /** Device fingerprint for fraud detection */
3651
+ deviceFingerprint?: {
3652
+ visitorId: string;
3653
+ confidence?: number;
3654
+ };
3655
+ /** Override the selected payment method type */
3656
+ paymentMethod?: string;
3657
+ /**
3658
+ * Redirect behavior after payment.
3659
+ * - `"if_required"` (default) — returns the result to your code; only redirects if the payment method requires it
3660
+ * - `"always"` — always redirects to `returnUrl` after payment. The page navigates away and the function never returns on success.
3661
+ */
3662
+ redirect?: "if_required" | "always";
3663
+ /** URL to redirect to after payment. Overrides the session's `afterCompletion.redirect.url`. Only needed if you want a different URL than the one set server-side. */
3664
+ returnUrl?: string;
3665
+ }
3666
+ /**
3667
+ * Options for creating a drop-in checkout instance.
3668
+ *
3669
+ * @example
3670
+ * ```ts
3671
+ * const checkout = xpay.checkout({
3672
+ * clientSecret: "cs_test_abc_secret_xyz",
3673
+ * mode: "modal",
3674
+ * onComplete: (result) => console.log("Paid!", result.paymentIntentId),
3675
+ * });
3676
+ * checkout.open();
3677
+ * ```
3678
+ */
3679
+ interface CheckoutOptions {
3680
+ /** Client secret from a checkout session */
3681
+ clientSecret: string;
3682
+ /** Display mode — `"modal"` (overlay) or `"inline"` (embedded in page) */
3683
+ mode?: "modal" | "inline";
3684
+ /** Container for inline mode (CSS selector or HTMLElement) */
3685
+ container?: string | HTMLElement;
3686
+ /** Called when the payment completes successfully */
3687
+ onComplete?: (result: CheckoutCompleteResult) => void;
3688
+ /** Called when the checkout UI is closed */
3689
+ onClose?: () => void;
3690
+ /** Called when the session is loaded and the checkout is ready */
3691
+ onReady?: (session: CheckoutSession) => void;
3692
+ /** Called when the payment is confirmed (before final result) */
3693
+ onConfirmed?: () => void;
3694
+ /** Called when an error occurs */
3695
+ onError?: (error: CheckoutError) => void;
3696
+ /** Appearance overrides */
3697
+ appearance?: Appearance;
3698
+ /** Locale for the checkout UI */
3699
+ locale?: "en" | "ar";
3700
+ }
3701
+ /** Drop-in checkout instance with lifecycle control */
3702
+ interface CheckoutInstance {
3703
+ /** Open the checkout modal (only for `mode: "modal"`) */
3704
+ open(): void;
3705
+ /** Close the checkout UI */
3706
+ close(): void;
3707
+ /** Destroy the checkout instance and clean up resources */
3708
+ destroy(): void;
3709
+ on(event: "complete", handler: (result: CheckoutCompleteResult) => void): void;
3710
+ on(event: "close", handler: () => void): void;
3711
+ on(event: "ready", handler: (session: CheckoutSession) => void): void;
3712
+ on(event: "confirmed", handler: () => void): void;
3713
+ on(event: "error", handler: (error: CheckoutError) => void): void;
3714
+ off(event: string, handler: (...args: unknown[]) => void): void;
3715
+ }
3716
+ /** Result of a successful payment via drop-in checkout */
3717
+ interface CheckoutCompleteResult {
3718
+ status: "succeeded";
3719
+ /** The payment intent ID for server-side verification */
3720
+ paymentIntentId: string;
3721
+ /** The charge ID (if available) */
3722
+ chargeId?: string;
3723
+ /** Redirect URL from the session's afterCompletion settings */
3724
+ redirectUrl?: string;
3725
+ }
3726
+ /** Error from the drop-in checkout */
3727
+ interface CheckoutError {
3728
+ /** Human-readable error message */
3729
+ message: string;
3730
+ /** Machine-readable error code */
3731
+ code?: string;
3732
+ }
3733
+ /**
3734
+ * Options for `initCheckout()` — the modern single-call API.
3735
+ *
3736
+ * @example
3737
+ * ```ts
3738
+ * const checkout = await xpay.initCheckout({
3739
+ * clientSecret: "cs_test_abc_secret_xyz",
3740
+ * });
3741
+ * console.log(checkout.amountTotal);
3742
+ * await checkout.confirm({ customerDetails: { email: "..." } });
3743
+ * ```
3744
+ */
3745
+ interface InitCheckoutOptions {
3746
+ /** Client secret from a checkout session (string or Promise) */
3747
+ clientSecret: string | Promise<string>;
3748
+ /** Appearance overrides */
3749
+ appearance?: Appearance;
3750
+ /** Locale for the payment form */
3751
+ locale?: "en" | "ar";
3752
+ }
3753
+ /** Result of `initCheckout()` — session data merged with action methods */
3754
+ type InitCheckoutResult = CheckoutSession & CheckoutActions;
3755
+ /**
3756
+ * Action methods available on the checkout object.
3757
+ * These are merged with `CheckoutSession` to form the `Checkout` type.
3758
+ */
3759
+ interface CheckoutActions {
3760
+ /**
3761
+ * Confirm the payment.
3762
+ *
3763
+ * @param options - Customer details and redirect behavior
3764
+ * @returns Action result with updated session on success, or an `XPayError`.
3765
+ * With `redirect: "always"`, the page navigates away on success (never returns).
3766
+ *
3767
+ * @example
3768
+ * ```ts
3769
+ * const result = await checkout.confirm({
3770
+ * customerDetails: { email: "user@example.com" },
3771
+ * });
3772
+ * if (result.type === "error") {
3773
+ * console.error(result.error.message);
3774
+ * }
3775
+ * ```
3776
+ */
3777
+ confirm(options?: Omit<ConfirmPaymentOptions, "elements">): Promise<ActionResult>;
3778
+ /** Apply a promotion code to the session */
3779
+ applyPromotionCode(code: string): Promise<ActionResult>;
3780
+ /** Remove the applied promotion code */
3781
+ removePromotionCode(): Promise<ActionResult>;
3782
+ /** Update a line item's quantity */
3783
+ updateLineItemQuantity(args: {
3784
+ lineItem: string;
3785
+ quantity: number;
3786
+ }): Promise<ActionResult>;
3787
+ /** Validate all fields before confirming — returns the selected payment method on success */
3788
+ submit(): Promise<{
3789
+ error?: XPayError;
3790
+ selectedPaymentMethod?: string;
3791
+ }>;
3792
+ /** Re-fetch the session from the server */
3793
+ fetchUpdates(): Promise<ActionResult>;
3794
+ /** Update the appearance at runtime */
3795
+ changeAppearance(appearance: Appearance): void;
3796
+ /** Listen for session data changes */
3797
+ on(event: "change", handler: (session: CheckoutSession) => void): void;
3798
+ /** Listen for unsolicited errors (e.g. session expired during internal updates) */
3799
+ on(event: "error", handler: (error: XPayError) => void): void;
3800
+ /** Listen for a custom event */
3801
+ on(event: string, handler: (...args: unknown[]) => void): void;
3802
+ /** Access the underlying Elements instance for element creation */
3803
+ getElements(): Elements;
3804
+ }
3805
+ /** Customer details collected by the merchant's form */
3806
+ interface CustomerDetails {
3807
+ /** Customer email address */
3808
+ email?: string;
3809
+ /** Customer full name */
3810
+ name?: string;
3811
+ /** Customer phone number */
3812
+ phone?: string;
3813
+ /** Billing details for the payment */
3814
+ billingDetails?: {
3815
+ name?: string;
3816
+ email?: string;
3817
+ phone?: string;
3818
+ address?: Address;
3819
+ };
3820
+ /** Shipping details */
3821
+ shipping?: {
3822
+ name?: string;
3823
+ phone?: string;
3824
+ address?: Address;
3825
+ };
3826
+ }
3827
+ /** Physical address */
3828
+ interface Address {
3829
+ line1?: string;
3830
+ line2?: string;
3831
+ city?: string;
3832
+ state?: string;
3833
+ postalCode?: string;
3834
+ country?: string;
3835
+ }
3836
+
3837
+ /**
3838
+ * @xpayeg/sdk — XPay JavaScript SDK Loader
3839
+ *
3840
+ * Loads the XPay SDK runtime from CDN and provides TypeScript types.
3841
+ *
3842
+ * Usage:
3843
+ * import { loadXPay } from '@xpayeg/sdk';
3844
+ *
3845
+ * const xpay = await loadXPay('pk_test_xxx');
3846
+ * const elements = xpay.elements({ clientSecret: '...' });
3847
+ */
3848
+
3849
+ type XPayFactory = (publishableKey: string) => XPayInstance;
3850
+ declare global {
3851
+ interface Window {
3852
+ XPay?: XPayFactory;
3853
+ }
3854
+ }
3855
+ /**
3856
+ * Load the XPay SDK from CDN.
3857
+ *
3858
+ * Returns a promise that resolves to an XPayInstance with full TypeScript support.
3859
+ * The SDK script is loaded once and cached — subsequent calls return the same instance.
3860
+ *
3861
+ * @param publishableKey - Your publishable API key (pk_test_... or pk_live_...)
3862
+ *
3863
+ * @example
3864
+ * ```typescript
3865
+ * import { loadXPay } from '@xpayeg/sdk';
3866
+ *
3867
+ * const xpay = await loadXPay('pk_test_xxx');
3868
+ * const elements = xpay.elements({ clientSecret: 'cs_test_abc_secret_xyz' });
3869
+ * ```
3870
+ */
3871
+ declare function loadXPay(publishableKey: string): Promise<XPayInstance | null>;
3872
+
3873
+ export { loadXPay };
3874
+ export type { ActionResult, Address, Appearance, BaseElement, CardElement, CardElementChangeEvent, CardElementOptions, CheckoutActions, CheckoutCompleteResult, DiscountResponseDto as CheckoutDiscount, CheckoutError, FeesResponseDto as CheckoutFees, CheckoutInstance, LineItemDto as CheckoutLineItem, CheckoutOptions, CheckoutSession, TotalDetailsResponseDto as CheckoutTotalDetails, ConfirmPaymentOptions, CustomerDetails, Elements, ElementsLoadErrorEvent, ElementsOptions, ElementsReadyEvent, InitCheckoutOptions, InitCheckoutResult, PaymentElement, PaymentElementChangeEvent, PaymentElementOptions, PaymentMethodInfo, SessionStatus, XPayError, XPayInstance };