@xpayeg/sdk 2.4.0 → 3.1.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.
package/dist/index.d.mts DELETED
@@ -1,4108 +0,0 @@
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
- /**
753
- * Payment rails the transaction rode (e.g. mastercard for a Meeza card). Null until the charge is processed by the gateway.
754
- * @nullable
755
- */
756
- network: string | null;
757
- /** Card fingerprint for identifying the same card across customers */
758
- fingerprint: string;
759
- threeDSecure: ThreeDSecureDto;
760
- wallet: WalletDto;
761
- }
762
-
763
- /**
764
- * Generated by orval v7.21.0 🍺
765
- * Do not edit manually.
766
- * XPay Checkout API
767
- * API for the XPay checkout flow — client endpoints and SSR
768
- * OpenAPI spec version: 1.0
769
- */
770
- interface ChargeConfigDto {
771
- vatCollectionEnabled: boolean;
772
- vatCollectionRate: number;
773
- collectedVatAmount: number;
774
- platformFeePassThrough: boolean;
775
- merchantFeeDeduction: number;
776
- }
777
-
778
- /**
779
- * Generated by orval v7.21.0 🍺
780
- * Do not edit manually.
781
- * XPay Checkout API
782
- * API for the XPay checkout flow — client endpoints and SSR
783
- * OpenAPI spec version: 1.0
784
- */
785
- interface ChargeGeocodingLocationDto {
786
- /** ISO 3166-1 alpha-2 country code */
787
- countryCode?: string;
788
- /** English country name */
789
- countryName?: string;
790
- /** ISO 3166-2 region code */
791
- regionCode?: string;
792
- /** English region/state name */
793
- regionName?: string;
794
- /** English city name */
795
- cityName?: string;
796
- }
797
-
798
- /**
799
- * Generated by orval v7.21.0 🍺
800
- * Do not edit manually.
801
- * XPay Checkout API
802
- * API for the XPay checkout flow — client endpoints and SSR
803
- * OpenAPI spec version: 1.0
804
- */
805
-
806
- interface ChargeGeocodingDto {
807
- /** The IP address that was resolved */
808
- ipAddress: string;
809
- location?: ChargeGeocodingLocationDto;
810
- }
811
-
812
- /**
813
- * Generated by orval v7.21.0 🍺
814
- * Do not edit manually.
815
- * XPay Checkout API
816
- * API for the XPay checkout flow — client endpoints and SSR
817
- * OpenAPI spec version: 1.0
818
- */
819
- type ChargeResponseDtoCurrency = typeof ChargeResponseDtoCurrency[keyof typeof ChargeResponseDtoCurrency];
820
- declare const ChargeResponseDtoCurrency: {
821
- readonly EGP: "EGP";
822
- readonly USD: "USD";
823
- readonly EUR: "EUR";
824
- readonly GBP: "GBP";
825
- readonly SAR: "SAR";
826
- readonly AED: "AED";
827
- readonly QAR: "QAR";
828
- readonly KWD: "KWD";
829
- readonly JOD: "JOD";
830
- readonly OMR: "OMR";
831
- readonly BHD: "BHD";
832
- readonly LYD: "LYD";
833
- readonly AUD: "AUD";
834
- readonly CAD: "CAD";
835
- readonly CNY: "CNY";
836
- };
837
-
838
- /**
839
- * Generated by orval v7.21.0 🍺
840
- * Do not edit manually.
841
- * XPay Checkout API
842
- * API for the XPay checkout flow — client endpoints and SSR
843
- * OpenAPI spec version: 1.0
844
- */
845
-
846
- /**
847
- * @nullable
848
- */
849
- type PaymentMethodDetailsDtoCard = ChargeCardDetailsDto | null;
850
-
851
- /**
852
- * Generated by orval v7.21.0 🍺
853
- * Do not edit manually.
854
- * XPay Checkout API
855
- * API for the XPay checkout flow — client endpoints and SSR
856
- * OpenAPI spec version: 1.0
857
- */
858
- interface ValuDetailsDto {
859
- /**
860
- * Loan number from the provider
861
- * @nullable
862
- */
863
- loanNumber?: string | null;
864
- /**
865
- * Loan tenure in months
866
- * @nullable
867
- */
868
- tenure?: number | null;
869
- /**
870
- * Monthly installment amount
871
- * @nullable
872
- */
873
- emi?: string | null;
874
- /**
875
- * Down payment amount
876
- * @nullable
877
- */
878
- downPayment?: string | null;
879
- /**
880
- * Total financed amount
881
- * @nullable
882
- */
883
- financedAmount?: string | null;
884
- /**
885
- * First EMI due date
886
- * @nullable
887
- */
888
- firstEmiDueDate?: string | null;
889
- /**
890
- * Last installment date
891
- * @nullable
892
- */
893
- lastInstallmentDate?: string | null;
894
- }
895
-
896
- /**
897
- * Generated by orval v7.21.0 🍺
898
- * Do not edit manually.
899
- * XPay Checkout API
900
- * API for the XPay checkout flow — client endpoints and SSR
901
- * OpenAPI spec version: 1.0
902
- */
903
-
904
- /**
905
- * ValU details (if type is 'valu')
906
- * @nullable
907
- */
908
- type PaymentMethodDetailsDtoValu = ValuDetailsDto | null;
909
-
910
- /**
911
- * Generated by orval v7.21.0 🍺
912
- * Do not edit manually.
913
- * XPay Checkout API
914
- * API for the XPay checkout flow — client endpoints and SSR
915
- * OpenAPI spec version: 1.0
916
- */
917
- interface FawryDetailsDto {
918
- /**
919
- * Fawry-generated reference number the customer paid with
920
- * @nullable
921
- */
922
- fawryRefNumber?: string | null;
923
- /**
924
- * Kiosk receipt/confirmation number (paymentRefrenceNumber in Fawry API)
925
- * @nullable
926
- */
927
- paymentReferenceNumber?: string | null;
928
- /**
929
- * Payment channel used (e.g. PAYATFAWRY)
930
- * @nullable
931
- */
932
- paymentMethod?: string | null;
933
- /**
934
- * Epoch millis when the customer paid at the kiosk
935
- * @nullable
936
- */
937
- paymentTime?: number | null;
938
- /**
939
- * When the reference stops being payable.
940
- * @nullable
941
- */
942
- expiresAt?: string | null;
943
- }
944
-
945
- /**
946
- * Generated by orval v7.21.0 🍺
947
- * Do not edit manually.
948
- * XPay Checkout API
949
- * API for the XPay checkout flow — client endpoints and SSR
950
- * OpenAPI spec version: 1.0
951
- */
952
-
953
- /**
954
- * Fawry details (if type is 'fawry')
955
- * @nullable
956
- */
957
- type PaymentMethodDetailsDtoFawry = FawryDetailsDto | null;
958
-
959
- /**
960
- * Generated by orval v7.21.0 🍺
961
- * Do not edit manually.
962
- * XPay Checkout API
963
- * API for the XPay checkout flow — client endpoints and SSR
964
- * OpenAPI spec version: 1.0
965
- */
966
-
967
- interface PaymentMethodDetailsDto {
968
- /** Concrete PaymentMethodType value: 'card', 'valu', etc. */
969
- type: string;
970
- /** @nullable */
971
- card?: PaymentMethodDetailsDtoCard;
972
- /**
973
- * ValU details (if type is 'valu')
974
- * @nullable
975
- */
976
- valu?: PaymentMethodDetailsDtoValu;
977
- /**
978
- * Fawry details (if type is 'fawry')
979
- * @nullable
980
- */
981
- fawry?: PaymentMethodDetailsDtoFawry;
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
- interface OutcomeDto {
992
- networkStatus: string;
993
- reason: string;
994
- riskLevel: string;
995
- riskScore: number;
996
- sellerMessage: string;
997
- type: string;
998
- }
999
-
1000
- /**
1001
- * Generated by orval v7.21.0 🍺
1002
- * Do not edit manually.
1003
- * XPay Checkout API
1004
- * API for the XPay checkout flow — client endpoints and SSR
1005
- * OpenAPI spec version: 1.0
1006
- */
1007
-
1008
- /**
1009
- * @nullable
1010
- */
1011
- type ChargeResponseDtoBalanceTransaction = BalanceTransactionResponseDto | null;
1012
-
1013
- /**
1014
- * Generated by orval v7.21.0 🍺
1015
- * Do not edit manually.
1016
- * XPay Checkout API
1017
- * API for the XPay checkout flow — client endpoints and SSR
1018
- * OpenAPI spec version: 1.0
1019
- */
1020
- /**
1021
- * Customer's currency code (ISO 4217)
1022
- */
1023
- type PresentmentDetailsDtoCurrency = typeof PresentmentDetailsDtoCurrency[keyof typeof PresentmentDetailsDtoCurrency];
1024
- declare const PresentmentDetailsDtoCurrency: {
1025
- readonly EGP: "EGP";
1026
- readonly USD: "USD";
1027
- readonly EUR: "EUR";
1028
- readonly GBP: "GBP";
1029
- readonly SAR: "SAR";
1030
- readonly AED: "AED";
1031
- readonly QAR: "QAR";
1032
- readonly KWD: "KWD";
1033
- readonly JOD: "JOD";
1034
- readonly OMR: "OMR";
1035
- readonly BHD: "BHD";
1036
- readonly LYD: "LYD";
1037
- readonly AUD: "AUD";
1038
- readonly CAD: "CAD";
1039
- readonly CNY: "CNY";
1040
- };
1041
-
1042
- /**
1043
- * Generated by orval v7.21.0 🍺
1044
- * Do not edit manually.
1045
- * XPay Checkout API
1046
- * API for the XPay checkout flow — client endpoints and SSR
1047
- * OpenAPI spec version: 1.0
1048
- */
1049
-
1050
- interface PresentmentDetailsDto {
1051
- /** Amount in the customer's currency (smallest unit — e.g. fils for KWD, cents for USD) */
1052
- amount: number;
1053
- /** Customer's currency code (ISO 4217) */
1054
- currency: PresentmentDetailsDtoCurrency;
1055
- /** 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. */
1056
- exchangeRate: number;
1057
- /** Reference to the immutable ExchangeRate record used — audit trail for FX reconciliation */
1058
- exchangeRateId: string;
1059
- }
1060
-
1061
- /**
1062
- * Generated by orval v7.21.0 🍺
1063
- * Do not edit manually.
1064
- * XPay Checkout API
1065
- * API for the XPay checkout flow — client endpoints and SSR
1066
- * OpenAPI spec version: 1.0
1067
- */
1068
- /**
1069
- * Three-letter ISO currency code
1070
- */
1071
- type RefundResponseDtoCurrency = typeof RefundResponseDtoCurrency[keyof typeof RefundResponseDtoCurrency];
1072
- declare const RefundResponseDtoCurrency: {
1073
- readonly EGP: "EGP";
1074
- readonly USD: "USD";
1075
- readonly EUR: "EUR";
1076
- readonly GBP: "GBP";
1077
- readonly SAR: "SAR";
1078
- readonly AED: "AED";
1079
- readonly QAR: "QAR";
1080
- readonly KWD: "KWD";
1081
- readonly JOD: "JOD";
1082
- readonly OMR: "OMR";
1083
- readonly BHD: "BHD";
1084
- readonly LYD: "LYD";
1085
- readonly AUD: "AUD";
1086
- readonly CAD: "CAD";
1087
- readonly CNY: "CNY";
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
- * Status of the refund (pending, requires_action, succeeded, failed, canceled)
1099
- */
1100
- type RefundResponseDtoStatus = typeof RefundResponseDtoStatus[keyof typeof RefundResponseDtoStatus];
1101
- declare const RefundResponseDtoStatus: {
1102
- readonly PENDING: "PENDING";
1103
- readonly REQUIRES_ACTION: "REQUIRES_ACTION";
1104
- readonly SUCCEEDED: "SUCCEEDED";
1105
- readonly FAILED: "FAILED";
1106
- readonly CANCELED: "CANCELED";
1107
- };
1108
-
1109
- /**
1110
- * Generated by orval v7.21.0 🍺
1111
- * Do not edit manually.
1112
- * XPay Checkout API
1113
- * API for the XPay checkout flow — client endpoints and SSR
1114
- * OpenAPI spec version: 1.0
1115
- */
1116
- /**
1117
- * Reason for the refund
1118
- */
1119
- type RefundResponseDtoReason = typeof RefundResponseDtoReason[keyof typeof RefundResponseDtoReason];
1120
- declare const RefundResponseDtoReason: {
1121
- readonly DUPLICATE: "DUPLICATE";
1122
- readonly FRAUDULENT: "FRAUDULENT";
1123
- readonly REQUESTED_BY_CUSTOMER: "REQUESTED_BY_CUSTOMER";
1124
- readonly RISK_HOLD_CAPTURE: "RISK_HOLD_CAPTURE";
1125
- };
1126
-
1127
- /**
1128
- * Generated by orval v7.21.0 🍺
1129
- * Do not edit manually.
1130
- * XPay Checkout API
1131
- * API for the XPay checkout flow — client endpoints and SSR
1132
- * OpenAPI spec version: 1.0
1133
- */
1134
- /**
1135
- * Reason for refund failure
1136
- */
1137
- type RefundResponseDtoFailureReason = typeof RefundResponseDtoFailureReason[keyof typeof RefundResponseDtoFailureReason];
1138
- declare const RefundResponseDtoFailureReason: {
1139
- readonly lost_or_stolen_card: "lost_or_stolen_card";
1140
- readonly expired_or_canceled_card: "expired_or_canceled_card";
1141
- readonly charge_for_pending_refund_disputed: "charge_for_pending_refund_disputed";
1142
- readonly insufficient_funds: "insufficient_funds";
1143
- readonly declined: "declined";
1144
- readonly merchant_request: "merchant_request";
1145
- readonly unknown: "unknown";
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
- * Reason for pending status
1157
- */
1158
- type RefundResponseDtoPendingReason = typeof RefundResponseDtoPendingReason[keyof typeof RefundResponseDtoPendingReason];
1159
- declare const RefundResponseDtoPendingReason: {
1160
- readonly processing: "processing";
1161
- readonly insufficient_funds: "insufficient_funds";
1162
- readonly charge_pending: "charge_pending";
1163
- };
1164
-
1165
- /**
1166
- * Generated by orval v7.21.0 🍺
1167
- * Do not edit manually.
1168
- * XPay Checkout API
1169
- * API for the XPay checkout flow — client endpoints and SSR
1170
- * OpenAPI spec version: 1.0
1171
- */
1172
- type RefundDestinationDetailsDtoType = typeof RefundDestinationDetailsDtoType[keyof typeof RefundDestinationDetailsDtoType];
1173
- declare const RefundDestinationDetailsDtoType: {
1174
- readonly card: "card";
1175
- readonly wallet: "wallet";
1176
- readonly bank_transfer: "bank_transfer";
1177
- readonly kiosk: "kiosk";
1178
- };
1179
-
1180
- /**
1181
- * Generated by orval v7.21.0 🍺
1182
- * Do not edit manually.
1183
- * XPay Checkout API
1184
- * API for the XPay checkout flow — client endpoints and SSR
1185
- * OpenAPI spec version: 1.0
1186
- */
1187
- interface WalletDestinationDetailsDto {
1188
- /** Wallet transaction reference */
1189
- reference?: string;
1190
- /** Wallet provider (e.g., vodafone_cash, fawry) */
1191
- provider?: string;
1192
- }
1193
-
1194
- /**
1195
- * Generated by orval v7.21.0 🍺
1196
- * Do not edit manually.
1197
- * XPay Checkout API
1198
- * API for the XPay checkout flow — client endpoints and SSR
1199
- * OpenAPI spec version: 1.0
1200
- */
1201
- interface KioskDestinationDetailsDto {
1202
- reference?: string;
1203
- provider?: string;
1204
- }
1205
-
1206
- /**
1207
- * Generated by orval v7.21.0 🍺
1208
- * Do not edit manually.
1209
- * XPay Checkout API
1210
- * API for the XPay checkout flow — client endpoints and SSR
1211
- * OpenAPI spec version: 1.0
1212
- */
1213
-
1214
- interface RefundDestinationDetailsDto {
1215
- type: RefundDestinationDetailsDtoType;
1216
- card?: CardDestinationDetailsDto;
1217
- wallet?: WalletDestinationDetailsDto;
1218
- bankTransfer?: BankTransferDestinationDetailsDto;
1219
- kiosk?: KioskDestinationDetailsDto;
1220
- }
1221
-
1222
- /**
1223
- * Generated by orval v7.21.0 🍺
1224
- * Do not edit manually.
1225
- * XPay Checkout API
1226
- * API for the XPay checkout flow — client endpoints and SSR
1227
- * OpenAPI spec version: 1.0
1228
- */
1229
- interface RefundNextActionDisplayDetailsDto {
1230
- /** Email sent timestamp (ISO 8601) */
1231
- emailSentAt?: string;
1232
- emailSentTo?: string;
1233
- /** Expiration timestamp (ISO 8601) */
1234
- expiresAt?: string;
1235
- }
1236
-
1237
- /**
1238
- * Generated by orval v7.21.0 🍺
1239
- * Do not edit manually.
1240
- * XPay Checkout API
1241
- * API for the XPay checkout flow — client endpoints and SSR
1242
- * OpenAPI spec version: 1.0
1243
- */
1244
-
1245
- interface RefundNextActionDto {
1246
- type: string;
1247
- displayDetails?: RefundNextActionDisplayDetailsDto;
1248
- }
1249
-
1250
- /**
1251
- * Generated by orval v7.21.0 🍺
1252
- * Do not edit manually.
1253
- * XPay Checkout API
1254
- * API for the XPay checkout flow — client endpoints and SSR
1255
- * OpenAPI spec version: 1.0
1256
- */
1257
-
1258
- /**
1259
- * 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.
1260
- */
1261
- interface RefundResponseDto {
1262
- /** Unique identifier for the refund */
1263
- id: string;
1264
- /** Object type */
1265
- object: string;
1266
- /** Refund amount in smallest currency unit */
1267
- amount: number;
1268
- /** ID of the charge being refunded */
1269
- chargeId: string;
1270
- /** ID of the PaymentIntent being refunded */
1271
- paymentIntentId: string;
1272
- /**
1273
- * ID of the balance transaction for the refund, null until settled
1274
- * @nullable
1275
- */
1276
- balanceTransactionId: string | null;
1277
- /**
1278
- * Balance transaction for failed refund reversal, null unless the refund failed
1279
- * @nullable
1280
- */
1281
- failureBalanceTransactionId: string | null;
1282
- /**
1283
- * Processor-side refund id, null when not yet reconciled
1284
- * @nullable
1285
- */
1286
- externalRefundId: string | null;
1287
- /** Time at which the refund was created (ISO 8601) */
1288
- createdAt: string;
1289
- /** Three-letter ISO currency code */
1290
- currency: RefundResponseDtoCurrency;
1291
- /** 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. */
1292
- presentmentDetails?: PresentmentDetailsDto;
1293
- /** Status of the refund (pending, requires_action, succeeded, failed, canceled) */
1294
- status: RefundResponseDtoStatus;
1295
- /** Reason for the refund */
1296
- reason?: RefundResponseDtoReason;
1297
- /** Reason for refund failure */
1298
- failureReason?: RefundResponseDtoFailureReason;
1299
- /** Error code describing why the refund failed. Same code vocabulary as payment failures. */
1300
- failureCode?: string;
1301
- /** Human-readable message for the refund failure */
1302
- failureMessage?: string;
1303
- /** Reason for pending status */
1304
- pendingReason?: RefundResponseDtoPendingReason;
1305
- /** Description for non-card refunds */
1306
- description?: string;
1307
- /** Payment method-specific refund details */
1308
- destinationDetails?: RefundDestinationDetailsDto;
1309
- /** Next action if requires_action */
1310
- nextAction?: RefundNextActionDto;
1311
- /** Email for refund instructions */
1312
- instructionsEmail?: string;
1313
- /** Receipt number for email receipts */
1314
- receiptNumber?: string;
1315
- /** Original platform fee (NOT refunded - kept by platform) */
1316
- feeAmount?: number;
1317
- }
1318
-
1319
- /**
1320
- * Generated by orval v7.21.0 🍺
1321
- * Do not edit manually.
1322
- * XPay Checkout API
1323
- * API for the XPay checkout flow — client endpoints and SSR
1324
- * OpenAPI spec version: 1.0
1325
- */
1326
- interface ChargeSessionDto {
1327
- browser?: string;
1328
- browserVersion?: string;
1329
- platform?: string;
1330
- device?: string;
1331
- deviceVendor?: string;
1332
- deviceModel?: string;
1333
- }
1334
-
1335
- /**
1336
- * Generated by orval v7.21.0 🍺
1337
- * Do not edit manually.
1338
- * XPay Checkout API
1339
- * API for the XPay checkout flow — client endpoints and SSR
1340
- * OpenAPI spec version: 1.0
1341
- */
1342
- interface ProcessorCapabilitiesDto {
1343
- /** Whether this processor supports refunds */
1344
- supportsRefund: boolean;
1345
- /** Whether partial refunds are supported */
1346
- supportsPartialRefund: boolean;
1347
- }
1348
-
1349
- /**
1350
- * Generated by orval v7.21.0 🍺
1351
- * Do not edit manually.
1352
- * XPay Checkout API
1353
- * API for the XPay checkout flow — client endpoints and SSR
1354
- * OpenAPI spec version: 1.0
1355
- */
1356
- /**
1357
- * Settlement model snapshotted at charge time
1358
- */
1359
- type ChargeResponseDtoSettlementModel = typeof ChargeResponseDtoSettlementModel[keyof typeof ChargeResponseDtoSettlementModel];
1360
- declare const ChargeResponseDtoSettlementModel: {
1361
- readonly aggregated: "aggregated";
1362
- readonly direct: "direct";
1363
- };
1364
-
1365
- /**
1366
- * Generated by orval v7.21.0 🍺
1367
- * Do not edit manually.
1368
- * XPay Checkout API
1369
- * API for the XPay checkout flow — client endpoints and SSR
1370
- * OpenAPI spec version: 1.0
1371
- */
1372
-
1373
- /**
1374
- * 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.
1375
- */
1376
- interface ChargeResponseDto {
1377
- id: string;
1378
- object: string;
1379
- amount: number;
1380
- amountCaptured: number;
1381
- amountRefunded: number;
1382
- currency: ChargeResponseDtoCurrency;
1383
- /** Created timestamp (ISO 8601) */
1384
- createdAt: string;
1385
- status: string;
1386
- paid: boolean;
1387
- refunded: boolean;
1388
- captured: boolean;
1389
- /** Captured timestamp (ISO 8601) */
1390
- capturedAt: string;
1391
- failureCode: string;
1392
- failureMessage: string;
1393
- receiptUrl: string;
1394
- receiptEmail: string;
1395
- billingDetails: BillingDetailsDto;
1396
- paymentMethodDetails: PaymentMethodDetailsDto;
1397
- outcome: OutcomeDto;
1398
- /** @nullable */
1399
- balanceTransaction: ChargeResponseDtoBalanceTransaction;
1400
- /** Present when customer paid in a different currency than settlement (EGP) */
1401
- presentmentDetails?: PresentmentDetailsDto;
1402
- /** Refunds issued against this charge, ordered newest-first. */
1403
- refunds: RefundResponseDto[];
1404
- paymentIntentId: string;
1405
- paymentMethodId: string;
1406
- calculatedStatementDescriptor: string;
1407
- disputed: boolean;
1408
- externalChargeId: string;
1409
- config: ChargeConfigDto;
1410
- geocoding?: ChargeGeocodingDto;
1411
- session?: ChargeSessionDto;
1412
- /**
1413
- * Origin of the page where this checkout ran — the merchant's site for embedded integrations (SDK Elements / drop-in), or our hosted checkout domain for hosted checkout and payment links. Null for merchant-initiated charges (recurring / MOTO).
1414
- * @nullable
1415
- */
1416
- merchantOrigin?: string | null;
1417
- /**
1418
- * Registrable domain (eTLD+1) derived from merchantOrigin.
1419
- * @nullable
1420
- */
1421
- merchantDomain?: string | null;
1422
- processorCapabilities?: ProcessorCapabilitiesDto;
1423
- /**
1424
- * ID of the currently-active risk hold on this charge, if any
1425
- * @nullable
1426
- */
1427
- activeHoldId?: string | null;
1428
- /** Settlement model snapshotted at charge time */
1429
- settlementModel: ChargeResponseDtoSettlementModel;
1430
- }
1431
-
1432
- /**
1433
- * Generated by orval v7.21.0 🍺
1434
- * Do not edit manually.
1435
- * XPay Checkout API
1436
- * API for the XPay checkout flow — client endpoints and SSR
1437
- * OpenAPI spec version: 1.0
1438
- */
1439
- /**
1440
- * Customer type. `registered` is a permanent merchant-managed record; `guest` is a session-scope dedup unit created automatically when `customerCreation` is `if_required`.
1441
- */
1442
- type CheckoutSessionCustomerDtoType = typeof CheckoutSessionCustomerDtoType[keyof typeof CheckoutSessionCustomerDtoType];
1443
- declare const CheckoutSessionCustomerDtoType: {
1444
- readonly guest: "guest";
1445
- readonly registered: "registered";
1446
- };
1447
-
1448
- /**
1449
- * Generated by orval v7.21.0 🍺
1450
- * Do not edit manually.
1451
- * XPay Checkout API
1452
- * API for the XPay checkout flow — client endpoints and SSR
1453
- * OpenAPI spec version: 1.0
1454
- */
1455
-
1456
- interface ShippingResponseDto {
1457
- /** Recipient name */
1458
- name?: string;
1459
- /** Recipient phone */
1460
- phone?: string;
1461
- /** Shipping address */
1462
- address?: AddressResponseDto;
1463
- }
1464
-
1465
- /**
1466
- * Generated by orval v7.21.0 🍺
1467
- * Do not edit manually.
1468
- * XPay Checkout API
1469
- * API for the XPay checkout flow — client endpoints and SSR
1470
- * OpenAPI spec version: 1.0
1471
- */
1472
- /**
1473
- * Customer metadata
1474
- */
1475
- type CheckoutSessionCustomerDtoMetadata = {
1476
- [key: string]: unknown;
1477
- };
1478
-
1479
- /**
1480
- * Generated by orval v7.21.0 🍺
1481
- * Do not edit manually.
1482
- * XPay Checkout API
1483
- * API for the XPay checkout flow — client endpoints and SSR
1484
- * OpenAPI spec version: 1.0
1485
- */
1486
-
1487
- interface CheckoutSessionCustomerDto {
1488
- /** Customer ID */
1489
- id: string;
1490
- /** Customer type. `registered` is a permanent merchant-managed record; `guest` is a session-scope dedup unit created automatically when `customerCreation` is `if_required`. */
1491
- type: CheckoutSessionCustomerDtoType;
1492
- /** Customer name */
1493
- name?: string;
1494
- /** Customer email */
1495
- email?: string;
1496
- /** Customer phone */
1497
- phone?: string;
1498
- /** Customer address */
1499
- address?: AddressResponseDto;
1500
- /** Customer shipping details */
1501
- shipping?: ShippingResponseDto;
1502
- /** Customer metadata */
1503
- metadata?: CheckoutSessionCustomerDtoMetadata;
1504
- }
1505
-
1506
- /**
1507
- * Generated by orval v7.21.0 🍺
1508
- * Do not edit manually.
1509
- * XPay Checkout API
1510
- * API for the XPay checkout flow — client endpoints and SSR
1511
- * OpenAPI spec version: 1.0
1512
- */
1513
- /**
1514
- * Session mode
1515
- */
1516
- type CheckoutSessionResponseDtoMode = typeof CheckoutSessionResponseDtoMode[keyof typeof CheckoutSessionResponseDtoMode];
1517
- declare const CheckoutSessionResponseDtoMode: {
1518
- readonly payment: "payment";
1519
- readonly setup: "setup";
1520
- readonly subscription: "subscription";
1521
- };
1522
-
1523
- /**
1524
- * Generated by orval v7.21.0 🍺
1525
- * Do not edit manually.
1526
- * XPay Checkout API
1527
- * API for the XPay checkout flow — client endpoints and SSR
1528
- * OpenAPI spec version: 1.0
1529
- */
1530
- /**
1531
- * UI mode
1532
- */
1533
- type CheckoutSessionResponseDtoUiMode = typeof CheckoutSessionResponseDtoUiMode[keyof typeof CheckoutSessionResponseDtoUiMode];
1534
- declare const CheckoutSessionResponseDtoUiMode: {
1535
- readonly hosted: "hosted";
1536
- readonly embedded: "embedded";
1537
- readonly custom: "custom";
1538
- };
1539
-
1540
- /**
1541
- * Generated by orval v7.21.0 🍺
1542
- * Do not edit manually.
1543
- * XPay Checkout API
1544
- * API for the XPay checkout flow — client endpoints and SSR
1545
- * OpenAPI spec version: 1.0
1546
- */
1547
- /**
1548
- * Submit type
1549
- */
1550
- type CheckoutSessionResponseDtoSubmitType = typeof CheckoutSessionResponseDtoSubmitType[keyof typeof CheckoutSessionResponseDtoSubmitType];
1551
- declare const CheckoutSessionResponseDtoSubmitType: {
1552
- readonly PAY: "PAY";
1553
- readonly SUBSCRIBE: "SUBSCRIBE";
1554
- readonly BOOK: "BOOK";
1555
- readonly DONATE: "DONATE";
1556
- };
1557
-
1558
- /**
1559
- * Generated by orval v7.21.0 🍺
1560
- * Do not edit manually.
1561
- * XPay Checkout API
1562
- * API for the XPay checkout flow — client endpoints and SSR
1563
- * OpenAPI spec version: 1.0
1564
- */
1565
- /**
1566
- * Customer creation mode
1567
- */
1568
- type CheckoutSessionResponseDtoCustomerCreation = typeof CheckoutSessionResponseDtoCustomerCreation[keyof typeof CheckoutSessionResponseDtoCustomerCreation];
1569
- declare const CheckoutSessionResponseDtoCustomerCreation: {
1570
- readonly always: "always";
1571
- readonly if_required: "if_required";
1572
- };
1573
-
1574
- /**
1575
- * Generated by orval v7.21.0 🍺
1576
- * Do not edit manually.
1577
- * XPay Checkout API
1578
- * API for the XPay checkout flow — client endpoints and SSR
1579
- * OpenAPI spec version: 1.0
1580
- */
1581
- /**
1582
- * Whether the customer is done with checkout. `open` while they are still on the page; `complete` once they have paid or, for methods paid later such as a Fawry reference, once they hold the reference; `expired` if the session timed out while still open. `complete` does not mean paid: read `paymentStatus` for that.
1583
- */
1584
- type CheckoutSessionResponseDtoStatus = typeof CheckoutSessionResponseDtoStatus[keyof typeof CheckoutSessionResponseDtoStatus];
1585
- declare const CheckoutSessionResponseDtoStatus: {
1586
- readonly open: "open";
1587
- readonly complete: "complete";
1588
- readonly expired: "expired";
1589
- };
1590
-
1591
- /**
1592
- * Generated by orval v7.21.0 🍺
1593
- * Do not edit manually.
1594
- * XPay Checkout API
1595
- * API for the XPay checkout flow — client endpoints and SSR
1596
- * OpenAPI spec version: 1.0
1597
- */
1598
- /**
1599
- * Whether the money has arrived. `paid` means fulfil; `unpaid` on a `complete` session means the customer still has to pay a reference. Never fulfil on `status` alone.
1600
- */
1601
- type CheckoutSessionResponseDtoPaymentStatus = typeof CheckoutSessionResponseDtoPaymentStatus[keyof typeof CheckoutSessionResponseDtoPaymentStatus];
1602
- declare const CheckoutSessionResponseDtoPaymentStatus: {
1603
- readonly paid: "paid";
1604
- readonly unpaid: "unpaid";
1605
- readonly no_payment_required: "no_payment_required";
1606
- };
1607
-
1608
- /**
1609
- * Generated by orval v7.21.0 🍺
1610
- * Do not edit manually.
1611
- * XPay Checkout API
1612
- * API for the XPay checkout flow — client endpoints and SSR
1613
- * OpenAPI spec version: 1.0
1614
- */
1615
- /**
1616
- * Currency code (ISO 4217)
1617
- */
1618
- type CheckoutSessionResponseDtoCurrency = typeof CheckoutSessionResponseDtoCurrency[keyof typeof CheckoutSessionResponseDtoCurrency];
1619
- declare const CheckoutSessionResponseDtoCurrency: {
1620
- readonly EGP: "EGP";
1621
- readonly USD: "USD";
1622
- readonly EUR: "EUR";
1623
- readonly GBP: "GBP";
1624
- readonly SAR: "SAR";
1625
- readonly AED: "AED";
1626
- readonly QAR: "QAR";
1627
- readonly KWD: "KWD";
1628
- readonly JOD: "JOD";
1629
- readonly OMR: "OMR";
1630
- readonly BHD: "BHD";
1631
- readonly LYD: "LYD";
1632
- readonly AUD: "AUD";
1633
- readonly CAD: "CAD";
1634
- readonly CNY: "CNY";
1635
- };
1636
-
1637
- /**
1638
- * Generated by orval v7.21.0 🍺
1639
- * Do not edit manually.
1640
- * XPay Checkout API
1641
- * API for the XPay checkout flow — client endpoints and SSR
1642
- * OpenAPI spec version: 1.0
1643
- */
1644
- interface TotalDetailsResponseDto {
1645
- /** Discount amount */
1646
- amountDiscount: number;
1647
- /** Shipping amount */
1648
- amountShipping?: number;
1649
- /** Tax amount */
1650
- amountTax: number;
1651
- /** Platform fee amount (only when feesPassThrough is enabled) */
1652
- amountPlatformFee?: number;
1653
- /** Collected VAT amount (only when vatCollectionEnabled is enabled) */
1654
- amountCollectedVat?: number;
1655
- }
1656
-
1657
- /**
1658
- * Generated by orval v7.21.0 🍺
1659
- * Do not edit manually.
1660
- * XPay Checkout API
1661
- * API for the XPay checkout flow — client endpoints and SSR
1662
- * OpenAPI spec version: 1.0
1663
- */
1664
- /**
1665
- * Customer's currency code (ISO 4217)
1666
- */
1667
- type SessionPresentmentDetailsDtoCurrency = typeof SessionPresentmentDetailsDtoCurrency[keyof typeof SessionPresentmentDetailsDtoCurrency];
1668
- declare const SessionPresentmentDetailsDtoCurrency: {
1669
- readonly EGP: "EGP";
1670
- readonly USD: "USD";
1671
- readonly EUR: "EUR";
1672
- readonly GBP: "GBP";
1673
- readonly SAR: "SAR";
1674
- readonly AED: "AED";
1675
- readonly QAR: "QAR";
1676
- readonly KWD: "KWD";
1677
- readonly JOD: "JOD";
1678
- readonly OMR: "OMR";
1679
- readonly BHD: "BHD";
1680
- readonly LYD: "LYD";
1681
- readonly AUD: "AUD";
1682
- readonly CAD: "CAD";
1683
- readonly CNY: "CNY";
1684
- };
1685
-
1686
- /**
1687
- * Generated by orval v7.21.0 🍺
1688
- * Do not edit manually.
1689
- * XPay Checkout API
1690
- * API for the XPay checkout flow — client endpoints and SSR
1691
- * OpenAPI spec version: 1.0
1692
- */
1693
-
1694
- interface SessionPresentmentDetailsDto {
1695
- /** Amount in the customer's currency (smallest unit — e.g. fils for KWD, cents for USD) */
1696
- amount: number;
1697
- /** Customer's currency code (ISO 4217) */
1698
- currency: SessionPresentmentDetailsDtoCurrency;
1699
- /** 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. */
1700
- exchangeRate: number;
1701
- /** Reference to the immutable ExchangeRate record used — audit trail for FX reconciliation */
1702
- exchangeRateId: string;
1703
- /** Subtotal before discounts/fees, in presentment smallest unit */
1704
- amountSubtotal: number;
1705
- /** Final total the customer sees, in presentment smallest unit */
1706
- amountTotal: number;
1707
- /** Discount applied, in presentment smallest unit (0 when no discount) */
1708
- amountDiscount: number;
1709
- /** Collected VAT in presentment smallest unit (only when VAT collection is enabled) */
1710
- amountCollectedVat?: number;
1711
- /** Platform fee in presentment smallest unit (only when feesPassThrough is enabled) */
1712
- amountPlatformFee?: number;
1713
- /** Tax in presentment smallest unit (only when tax is charged) */
1714
- amountTax?: number;
1715
- }
1716
-
1717
- /**
1718
- * Generated by orval v7.21.0 🍺
1719
- * Do not edit manually.
1720
- * XPay Checkout API
1721
- * API for the XPay checkout flow — client endpoints and SSR
1722
- * OpenAPI spec version: 1.0
1723
- */
1724
- /**
1725
- * What happens after payment: redirect to merchant URL or show hosted confirmation page
1726
- */
1727
- type CheckoutSessionResponseDtoAfterCompletion = {
1728
- [key: string]: unknown;
1729
- };
1730
-
1731
- /**
1732
- * Generated by orval v7.21.0 🍺
1733
- * Do not edit manually.
1734
- * XPay Checkout API
1735
- * API for the XPay checkout flow — client endpoints and SSR
1736
- * OpenAPI spec version: 1.0
1737
- */
1738
-
1739
- interface CustomerDetailsResponseDto {
1740
- /** Customer name */
1741
- name?: string;
1742
- /** Customer email */
1743
- email?: string;
1744
- /** Customer phone */
1745
- phone?: string;
1746
- /** Billing details including cardholder name and address */
1747
- billingDetails?: BillingDetailsResponseDto;
1748
- /** Shipping details */
1749
- shipping?: ShippingResponseDto;
1750
- }
1751
-
1752
- /**
1753
- * Generated by orval v7.21.0 🍺
1754
- * Do not edit manually.
1755
- * XPay Checkout API
1756
- * API for the XPay checkout flow — client endpoints and SSR
1757
- * OpenAPI spec version: 1.0
1758
- */
1759
- /**
1760
- * ISO 4217 currency code this payment is denominated in.
1761
- */
1762
- type NestedPaymentIntentResponseDtoCurrency = typeof NestedPaymentIntentResponseDtoCurrency[keyof typeof NestedPaymentIntentResponseDtoCurrency];
1763
- declare const NestedPaymentIntentResponseDtoCurrency: {
1764
- readonly EGP: "EGP";
1765
- readonly USD: "USD";
1766
- readonly EUR: "EUR";
1767
- readonly GBP: "GBP";
1768
- readonly SAR: "SAR";
1769
- readonly AED: "AED";
1770
- readonly QAR: "QAR";
1771
- readonly KWD: "KWD";
1772
- readonly JOD: "JOD";
1773
- readonly OMR: "OMR";
1774
- readonly BHD: "BHD";
1775
- readonly LYD: "LYD";
1776
- readonly AUD: "AUD";
1777
- readonly CAD: "CAD";
1778
- readonly CNY: "CNY";
1779
- };
1780
-
1781
- /**
1782
- * Generated by orval v7.21.0 🍺
1783
- * Do not edit manually.
1784
- * XPay Checkout API
1785
- * API for the XPay checkout flow — client endpoints and SSR
1786
- * OpenAPI spec version: 1.0
1787
- */
1788
- /**
1789
- * 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.
1790
- */
1791
- type NestedPaymentIntentResponseDtoStatus = typeof NestedPaymentIntentResponseDtoStatus[keyof typeof NestedPaymentIntentResponseDtoStatus];
1792
- declare const NestedPaymentIntentResponseDtoStatus: {
1793
- readonly REQUIRES_PAYMENT_METHOD: "REQUIRES_PAYMENT_METHOD";
1794
- readonly REQUIRES_CONFIRMATION: "REQUIRES_CONFIRMATION";
1795
- readonly REQUIRES_ACTION: "REQUIRES_ACTION";
1796
- readonly PROCESSING: "PROCESSING";
1797
- readonly UNCAPTURED: "UNCAPTURED";
1798
- readonly CANCELED: "CANCELED";
1799
- readonly SUCCEEDED: "SUCCEEDED";
1800
- readonly FAILED: "FAILED";
1801
- readonly REFUNDED: "REFUNDED";
1802
- readonly PARTIALLY_REFUNDED: "PARTIALLY_REFUNDED";
1803
- readonly AMOUNT_CAPTURABLE_UPDATED: "AMOUNT_CAPTURABLE_UPDATED";
1804
- };
1805
-
1806
- /**
1807
- * Generated by orval v7.21.0 🍺
1808
- * Do not edit manually.
1809
- * XPay Checkout API
1810
- * API for the XPay checkout flow — client endpoints and SSR
1811
- * OpenAPI spec version: 1.0
1812
- */
1813
- /**
1814
- * 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.
1815
- */
1816
- type NestedPaymentIntentResponseDtoCaptureMethod = typeof NestedPaymentIntentResponseDtoCaptureMethod[keyof typeof NestedPaymentIntentResponseDtoCaptureMethod];
1817
- declare const NestedPaymentIntentResponseDtoCaptureMethod: {
1818
- readonly automatic: "automatic";
1819
- readonly manual: "manual";
1820
- };
1821
-
1822
- /**
1823
- * Generated by orval v7.21.0 🍺
1824
- * Do not edit manually.
1825
- * XPay Checkout API
1826
- * API for the XPay checkout flow — client endpoints and SSR
1827
- * OpenAPI spec version: 1.0
1828
- */
1829
- /**
1830
- * 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.
1831
- */
1832
- type NestedPaymentIntentResponseDtoConfirmationMethod = typeof NestedPaymentIntentResponseDtoConfirmationMethod[keyof typeof NestedPaymentIntentResponseDtoConfirmationMethod];
1833
- declare const NestedPaymentIntentResponseDtoConfirmationMethod: {
1834
- readonly automatic: "automatic";
1835
- readonly manual: "manual";
1836
- };
1837
-
1838
- /**
1839
- * Generated by orval v7.21.0 🍺
1840
- * Do not edit manually.
1841
- * XPay Checkout API
1842
- * API for the XPay checkout flow — client endpoints and SSR
1843
- * OpenAPI spec version: 1.0
1844
- */
1845
-
1846
- interface ShippingDto {
1847
- /** Shipping address. */
1848
- address: AddressDto;
1849
- /**
1850
- * Recipient name as provided by the customer.
1851
- * @nullable
1852
- */
1853
- name?: string | null;
1854
- /**
1855
- * Recipient phone number as provided by the customer.
1856
- * @nullable
1857
- */
1858
- phone?: string | null;
1859
- }
1860
-
1861
- /**
1862
- * Generated by orval v7.21.0 🍺
1863
- * Do not edit manually.
1864
- * XPay Checkout API
1865
- * API for the XPay checkout flow — client endpoints and SSR
1866
- * OpenAPI spec version: 1.0
1867
- */
1868
-
1869
- /**
1870
- * Shipping address and recipient details for this payment. `null` if no shipping was collected.
1871
- * @nullable
1872
- */
1873
- type NestedPaymentIntentResponseDtoShipping = ShippingDto | null;
1874
-
1875
- /**
1876
- * Generated by orval v7.21.0 🍺
1877
- * Do not edit manually.
1878
- * XPay Checkout API
1879
- * API for the XPay checkout flow — client endpoints and SSR
1880
- * OpenAPI spec version: 1.0
1881
- */
1882
-
1883
- /**
1884
- * Breakdown of `amount` into product amount, tax, platform fees, tip, and discount. `null` for legacy payments without itemized breakdown.
1885
- * @nullable
1886
- */
1887
- type NestedPaymentIntentResponseDtoAmountDetails = AmountDetailsDto | null;
1888
-
1889
- /**
1890
- * Generated by orval v7.21.0 🍺
1891
- * Do not edit manually.
1892
- * XPay Checkout API
1893
- * API for the XPay checkout flow — client endpoints and SSR
1894
- * OpenAPI spec version: 1.0
1895
- */
1896
-
1897
- /**
1898
- * 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.
1899
- * @nullable
1900
- */
1901
- type NestedPaymentIntentResponseDtoPresentmentDetails = PresentmentDetailsDto | 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
- * The most recent Charge attempt for this PaymentIntent. `null` if no Charge has been attempted yet.
1913
- * @nullable
1914
- */
1915
- type NestedPaymentIntentResponseDtoLatestCharge = ChargeResponseDto | 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 PaymentMethodCardDtoNetworks = {
1925
- [key: string]: unknown;
1926
- };
1927
-
1928
- /**
1929
- * Generated by orval v7.21.0 🍺
1930
- * Do not edit manually.
1931
- * XPay Checkout API
1932
- * API for the XPay checkout flow — client endpoints and SSR
1933
- * OpenAPI spec version: 1.0
1934
- */
1935
- interface ThreeDSecureUsageDto {
1936
- supported: boolean;
1937
- }
1938
-
1939
- /**
1940
- * Generated by orval v7.21.0 🍺
1941
- * Do not edit manually.
1942
- * XPay Checkout API
1943
- * API for the XPay checkout flow — client endpoints and SSR
1944
- * OpenAPI spec version: 1.0
1945
- */
1946
-
1947
- interface PaymentMethodCardDto {
1948
- brand: string;
1949
- country: string;
1950
- displayBrand: string;
1951
- expMonth: number;
1952
- expYear: number;
1953
- fingerprint: string;
1954
- funding: string;
1955
- last4: string;
1956
- networks: PaymentMethodCardDtoNetworks;
1957
- regulatedStatus: string;
1958
- threeDSecureUsage: ThreeDSecureUsageDto;
1959
- wallet: WalletDto;
1960
- }
1961
-
1962
- /**
1963
- * Generated by orval v7.21.0 🍺
1964
- * Do not edit manually.
1965
- * XPay Checkout API
1966
- * API for the XPay checkout flow — client endpoints and SSR
1967
- * OpenAPI spec version: 1.0
1968
- */
1969
-
1970
- /**
1971
- * @nullable
1972
- */
1973
- type PaymentMethodObjectDtoCard = PaymentMethodCardDto | null;
1974
-
1975
- /**
1976
- * Generated by orval v7.21.0 🍺
1977
- * Do not edit manually.
1978
- * XPay Checkout API
1979
- * API for the XPay checkout flow — client endpoints and SSR
1980
- * OpenAPI spec version: 1.0
1981
- */
1982
-
1983
- /**
1984
- * ValU details (if type is 'valu')
1985
- * @nullable
1986
- */
1987
- type PaymentMethodObjectDtoValu = ValuDetailsDto | null;
1988
-
1989
- /**
1990
- * Generated by orval v7.21.0 🍺
1991
- * Do not edit manually.
1992
- * XPay Checkout API
1993
- * API for the XPay checkout flow — client endpoints and SSR
1994
- * OpenAPI spec version: 1.0
1995
- */
1996
-
1997
- /**
1998
- * Fawry details (if type is 'fawry')
1999
- * @nullable
2000
- */
2001
- type PaymentMethodObjectDtoFawry = FawryDetailsDto | null;
2002
-
2003
- /**
2004
- * Generated by orval v7.21.0 🍺
2005
- * Do not edit manually.
2006
- * XPay Checkout API
2007
- * API for the XPay checkout flow — client endpoints and SSR
2008
- * OpenAPI spec version: 1.0
2009
- */
2010
- type PaymentMethodObjectDtoType = typeof PaymentMethodObjectDtoType[keyof typeof PaymentMethodObjectDtoType];
2011
- declare const PaymentMethodObjectDtoType: {
2012
- readonly card: "card";
2013
- readonly fawry: "fawry";
2014
- readonly aman: "aman";
2015
- readonly valu: "valu";
2016
- readonly sympl: "sympl";
2017
- readonly tabby: "tabby";
2018
- readonly tamara: "tamara";
2019
- readonly vodafone_cash: "vodafone_cash";
2020
- readonly etisalat_cash: "etisalat_cash";
2021
- readonly orange_cash: "orange_cash";
2022
- readonly we_pay: "we_pay";
2023
- readonly apple_pay: "apple_pay";
2024
- readonly google_pay: "google_pay";
2025
- readonly samsung_pay: "samsung_pay";
2026
- readonly instapay: "instapay";
2027
- readonly bank_transfer: "bank_transfer";
2028
- readonly cash_on_delivery: "cash_on_delivery";
2029
- };
2030
-
2031
- /**
2032
- * Generated by orval v7.21.0 🍺
2033
- * Do not edit manually.
2034
- * XPay Checkout API
2035
- * API for the XPay checkout flow — client endpoints and SSR
2036
- * OpenAPI spec version: 1.0
2037
- */
2038
-
2039
- interface PaymentMethodObjectDto {
2040
- id: string;
2041
- object: string;
2042
- /** @nullable */
2043
- card: PaymentMethodObjectDtoCard;
2044
- /**
2045
- * ValU details (if type is 'valu')
2046
- * @nullable
2047
- */
2048
- valu?: PaymentMethodObjectDtoValu;
2049
- /**
2050
- * Fawry details (if type is 'fawry')
2051
- * @nullable
2052
- */
2053
- fawry?: PaymentMethodObjectDtoFawry;
2054
- billingDetails: BillingDetailsDto;
2055
- type: PaymentMethodObjectDtoType;
2056
- /** Created timestamp (ISO 8601) */
2057
- createdAt: string;
2058
- }
2059
-
2060
- /**
2061
- * Generated by orval v7.21.0 🍺
2062
- * Do not edit manually.
2063
- * XPay Checkout API
2064
- * API for the XPay checkout flow — client endpoints and SSR
2065
- * OpenAPI spec version: 1.0
2066
- */
2067
-
2068
- /**
2069
- * Payment method attached to this PaymentIntent. `null` before a method is attached or after a failure clears it.
2070
- * @nullable
2071
- */
2072
- type NestedPaymentIntentResponseDtoPaymentMethod = PaymentMethodObjectDto | null;
2073
-
2074
- /**
2075
- * Generated by orval v7.21.0 🍺
2076
- * Do not edit manually.
2077
- * XPay Checkout API
2078
- * API for the XPay checkout flow — client endpoints and SSR
2079
- * OpenAPI spec version: 1.0
2080
- */
2081
- interface CustomerDto {
2082
- /** ID of the Customer associated with this payment. */
2083
- id: string;
2084
- /**
2085
- * 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.
2086
- * @nullable
2087
- */
2088
- name?: string | null;
2089
- /**
2090
- * Customer's email captured for this payment. Falls back to the Customer entity's email if no billing-details email was provided.
2091
- * @nullable
2092
- */
2093
- email?: string | null;
2094
- /**
2095
- * Customer's phone captured for this payment, in E.164 format when available.
2096
- * @nullable
2097
- */
2098
- phone?: string | null;
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
- /**
2110
- * The Customer this payment belongs to. `null` if no Customer is associated.
2111
- * @nullable
2112
- */
2113
- type NestedPaymentIntentResponseDtoCustomer = CustomerDto | null;
2114
-
2115
- /**
2116
- * Generated by orval v7.21.0 🍺
2117
- * Do not edit manually.
2118
- * XPay Checkout API
2119
- * API for the XPay checkout flow — client endpoints and SSR
2120
- * OpenAPI spec version: 1.0
2121
- */
2122
- interface NextActionRedirectDto {
2123
- /** URL to redirect the customer to in order to complete the next step (typically 3-D Secure). */
2124
- url: string;
2125
- /**
2126
- * URL the customer is sent back to after completing the redirect step. `null` if no return URL was configured.
2127
- * @nullable
2128
- */
2129
- returnUrl?: string | null;
2130
- }
2131
-
2132
- /**
2133
- * Generated by orval v7.21.0 🍺
2134
- * Do not edit manually.
2135
- * XPay Checkout API
2136
- * API for the XPay checkout flow — client endpoints and SSR
2137
- * OpenAPI spec version: 1.0
2138
- */
2139
-
2140
- /**
2141
- * Redirect details when `type` is `redirect_to_url`. `null` for any other action type.
2142
- * @nullable
2143
- */
2144
- type NextActionDetailDtoRedirectToUrl = NextActionRedirectDto | null;
2145
-
2146
- /**
2147
- * Generated by orval v7.21.0 🍺
2148
- * Do not edit manually.
2149
- * XPay Checkout API
2150
- * API for the XPay checkout flow — client endpoints and SSR
2151
- * OpenAPI spec version: 1.0
2152
- */
2153
- interface NextActionVoucherDto {
2154
- /** Payment method the reference is paid through, as its payment method type (e.g. `fawry`). */
2155
- provider: string;
2156
- /** Reference number the customer pays with at the kiosk or in the provider's app. */
2157
- reference: string;
2158
- /**
2159
- * When the reference stops being payable. `null` if the provider set no expiry.
2160
- * @nullable
2161
- */
2162
- expiresAt?: string | null;
2163
- /**
2164
- * Human-readable payment instructions for the customer. `null` if none.
2165
- * @nullable
2166
- */
2167
- instructions?: string | null;
2168
- /**
2169
- * URL of a hosted voucher page, when the provider offers one. `null` otherwise.
2170
- * @nullable
2171
- */
2172
- hostedVoucherUrl?: string | null;
2173
- }
2174
-
2175
- /**
2176
- * Generated by orval v7.21.0 🍺
2177
- * Do not edit manually.
2178
- * XPay Checkout API
2179
- * API for the XPay checkout flow — client endpoints and SSR
2180
- * OpenAPI spec version: 1.0
2181
- */
2182
-
2183
- /**
2184
- * Voucher details when `type` is `display_voucher_details`. `null` for any other action type.
2185
- * @nullable
2186
- */
2187
- type NextActionDetailDtoDisplayVoucherDetails = NextActionVoucherDto | null;
2188
-
2189
- /**
2190
- * Generated by orval v7.21.0 🍺
2191
- * Do not edit manually.
2192
- * XPay Checkout API
2193
- * API for the XPay checkout flow — client endpoints and SSR
2194
- * OpenAPI spec version: 1.0
2195
- */
2196
-
2197
- interface NextActionDetailDto {
2198
- /** Kind of action the customer must take next: `redirect_to_url` (3-D Secure, hosted payment pages) or `display_voucher_details` (a reference paid out-of-band, e.g. Fawry). */
2199
- type: string;
2200
- /**
2201
- * Redirect details when `type` is `redirect_to_url`. `null` for any other action type.
2202
- * @nullable
2203
- */
2204
- redirectToUrl?: NextActionDetailDtoRedirectToUrl;
2205
- /**
2206
- * Voucher details when `type` is `display_voucher_details`. `null` for any other action type.
2207
- * @nullable
2208
- */
2209
- displayVoucherDetails?: NextActionDetailDtoDisplayVoucherDetails;
2210
- }
2211
-
2212
- /**
2213
- * Generated by orval v7.21.0 🍺
2214
- * Do not edit manually.
2215
- * XPay Checkout API
2216
- * API for the XPay checkout flow — client endpoints and SSR
2217
- * OpenAPI spec version: 1.0
2218
- */
2219
-
2220
- /**
2221
- * Action the customer must take to advance the payment (e.g. complete 3-D Secure). `null` when no further action is needed.
2222
- * @nullable
2223
- */
2224
- type NestedPaymentIntentResponseDtoNextAction = NextActionDetailDto | null;
2225
-
2226
- /**
2227
- * Generated by orval v7.21.0 🍺
2228
- * Do not edit manually.
2229
- * XPay Checkout API
2230
- * API for the XPay checkout flow — client endpoints and SSR
2231
- * OpenAPI spec version: 1.0
2232
- */
2233
- /**
2234
- * Custom key/value pairs you attached when creating or updating the PaymentIntent. Useful for reconciling with your own systems. Empty object if none.
2235
- */
2236
- type NestedPaymentIntentResponseDtoMetadata = {
2237
- [key: string]: unknown;
2238
- };
2239
-
2240
- /**
2241
- * Generated by orval v7.21.0 🍺
2242
- * Do not edit manually.
2243
- * XPay Checkout API
2244
- * API for the XPay checkout flow — client endpoints and SSR
2245
- * OpenAPI spec version: 1.0
2246
- */
2247
- /**
2248
- * 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.
2249
- * @nullable
2250
- */
2251
- type LastPaymentErrorDetailDtoAdviceCode = typeof LastPaymentErrorDetailDtoAdviceCode[keyof typeof LastPaymentErrorDetailDtoAdviceCode] | null;
2252
- declare const LastPaymentErrorDetailDtoAdviceCode: {
2253
- readonly confirm_card_data: "confirm_card_data";
2254
- readonly do_not_try_again: "do_not_try_again";
2255
- readonly try_again_later: "try_again_later";
2256
- };
2257
-
2258
- /**
2259
- * Generated by orval v7.21.0 🍺
2260
- * Do not edit manually.
2261
- * XPay Checkout API
2262
- * API for the XPay checkout flow — client endpoints and SSR
2263
- * OpenAPI spec version: 1.0
2264
- */
2265
- /**
2266
- * 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.
2267
- * @nullable
2268
- */
2269
- type LastPaymentErrorDetailDtoPaymentMethod = {
2270
- [key: string]: unknown;
2271
- } | null;
2272
-
2273
- /**
2274
- * Generated by orval v7.21.0 🍺
2275
- * Do not edit manually.
2276
- * XPay Checkout API
2277
- * API for the XPay checkout flow — client endpoints and SSR
2278
- * OpenAPI spec version: 1.0
2279
- */
2280
- /**
2281
- * Error category. One of `card_error`, `payment_method_error`, `api_error`, `invalid_request_error`. Use this for high-level branching in your error handling.
2282
- */
2283
- type LastPaymentErrorDetailDtoType = typeof LastPaymentErrorDetailDtoType[keyof typeof LastPaymentErrorDetailDtoType];
2284
- declare const LastPaymentErrorDetailDtoType: {
2285
- readonly card_error: "card_error";
2286
- readonly payment_method_error: "payment_method_error";
2287
- readonly api_error: "api_error";
2288
- readonly invalid_request_error: "invalid_request_error";
2289
- };
2290
-
2291
- /**
2292
- * Generated by orval v7.21.0 🍺
2293
- * Do not edit manually.
2294
- * XPay Checkout API
2295
- * API for the XPay checkout flow — client endpoints and SSR
2296
- * OpenAPI spec version: 1.0
2297
- */
2298
-
2299
- interface LastPaymentErrorDetailDto {
2300
- /**
2301
- * Short machine-readable error code describing what failed (e.g. `card_declined`, `expired_card`, `incorrect_cvc`). `null` if no code applies.
2302
- * @nullable
2303
- */
2304
- code?: string | null;
2305
- /**
2306
- * More specific reason for a decline (e.g. `insufficient_funds`, `generic_decline`). Present when `code` is `card_declined`; otherwise `null`.
2307
- * @nullable
2308
- */
2309
- declineCode?: string | null;
2310
- /**
2311
- * Decline code returned by the card network itself, when different from `declineCode`. `null` if the network did not provide one.
2312
- * @nullable
2313
- */
2314
- networkDeclineCode?: string | null;
2315
- /**
2316
- * Link to documentation explaining this error and how to recover from it.
2317
- * @nullable
2318
- */
2319
- docUrl?: string | null;
2320
- /** Customer-safe message describing what went wrong. Safe to display in your UI. */
2321
- message: string;
2322
- /**
2323
- * Internal message for the merchant with more detail than `message`. Do NOT show this to customers. `null` if no merchant-only context is available.
2324
- * @nullable
2325
- */
2326
- merchantMessage?: string | null;
2327
- /**
2328
- * 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.
2329
- * @nullable
2330
- */
2331
- adviceCode?: LastPaymentErrorDetailDtoAdviceCode;
2332
- /**
2333
- * 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.
2334
- * @nullable
2335
- */
2336
- param?: string | null;
2337
- /**
2338
- * ID of the failed Charge that triggered this error. `null` if no charge was created.
2339
- * @nullable
2340
- */
2341
- chargeId?: string | null;
2342
- /**
2343
- * 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.
2344
- * @nullable
2345
- */
2346
- paymentMethod?: LastPaymentErrorDetailDtoPaymentMethod;
2347
- /**
2348
- * Type of the payment method that failed (e.g. `card`, `valu`, `fawry`). `null` if unknown.
2349
- * @nullable
2350
- */
2351
- paymentMethodType?: string | null;
2352
- /** Error category. One of `card_error`, `payment_method_error`, `api_error`, `invalid_request_error`. Use this for high-level branching in your error handling. */
2353
- type: LastPaymentErrorDetailDtoType;
2354
- /**
2355
- * 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.
2356
- * @nullable
2357
- */
2358
- processorCode?: string | null;
2359
- /**
2360
- * Raw error message returned by the upstream processor, unmapped. Useful for support tickets and processor-specific debugging. Most applications should rely on `message` instead.
2361
- * @nullable
2362
- */
2363
- processorMessage?: string | null;
2364
- }
2365
-
2366
- /**
2367
- * Generated by orval v7.21.0 🍺
2368
- * Do not edit manually.
2369
- * XPay Checkout API
2370
- * API for the XPay checkout flow — client endpoints and SSR
2371
- * OpenAPI spec version: 1.0
2372
- */
2373
-
2374
- /**
2375
- * Details of the most recent failed payment attempt for this PaymentIntent. `null` if no attempts have failed.
2376
- * @nullable
2377
- */
2378
- type NestedPaymentIntentResponseDtoLastPaymentError = LastPaymentErrorDetailDto | null;
2379
-
2380
- /**
2381
- * Generated by orval v7.21.0 🍺
2382
- * Do not edit manually.
2383
- * XPay Checkout API
2384
- * API for the XPay checkout flow — client endpoints and SSR
2385
- * OpenAPI spec version: 1.0
2386
- */
2387
-
2388
- /**
2389
- * 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).
2390
- */
2391
- interface NestedPaymentIntentResponseDto {
2392
- /** Unique identifier for this PaymentIntent. Always prefixed with `pi_`. */
2393
- id: string;
2394
- /** String identifying the object type. Always `payment_intent` for this resource. */
2395
- object: string;
2396
- /**
2397
- * ID of the CheckoutSession that created this PaymentIntent. `null` for PaymentIntents created directly via the API without a session.
2398
- * @nullable
2399
- */
2400
- checkoutSessionId?: string | null;
2401
- /** Amount the customer is being charged, in the smallest currency unit of `currency` (e.g. piasters for EGP — `10000` = 100 EGP). */
2402
- amount: number;
2403
- /** 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). */
2404
- amountCapturable: number;
2405
- /** 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. */
2406
- amountReceived: number;
2407
- /** ISO 4217 currency code this payment is denominated in. */
2408
- currency: NestedPaymentIntentResponseDtoCurrency;
2409
- /** 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. */
2410
- status: NestedPaymentIntentResponseDtoStatus;
2411
- /** Created timestamp (ISO 8601) */
2412
- createdAt: string;
2413
- /** Updated timestamp (ISO 8601) */
2414
- updatedAt: string;
2415
- /** 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. */
2416
- clientSecret: string;
2417
- /** 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. */
2418
- captureMethod: NestedPaymentIntentResponseDtoCaptureMethod;
2419
- /** 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. */
2420
- confirmationMethod: NestedPaymentIntentResponseDtoConfirmationMethod;
2421
- /**
2422
- * 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.
2423
- * @nullable
2424
- */
2425
- description?: string | null;
2426
- /**
2427
- * Email to send the receipt to once the payment succeeds. `null` if no receipt email was set.
2428
- * @nullable
2429
- */
2430
- receiptEmail?: string | null;
2431
- /**
2432
- * ISO 8601 timestamp of when this PaymentIntent was canceled. `null` if it was never canceled.
2433
- * @nullable
2434
- */
2435
- canceledAt?: string | null;
2436
- /**
2437
- * Shipping address and recipient details for this payment. `null` if no shipping was collected.
2438
- * @nullable
2439
- */
2440
- shipping?: NestedPaymentIntentResponseDtoShipping;
2441
- /**
2442
- * Breakdown of `amount` into product amount, tax, platform fees, tip, and discount. `null` for legacy payments without itemized breakdown.
2443
- * @nullable
2444
- */
2445
- amountDetails?: NestedPaymentIntentResponseDtoAmountDetails;
2446
- /**
2447
- * 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.
2448
- * @nullable
2449
- */
2450
- presentmentDetails?: NestedPaymentIntentResponseDtoPresentmentDetails;
2451
- /**
2452
- * The most recent Charge attempt for this PaymentIntent. `null` if no Charge has been attempted yet.
2453
- * @nullable
2454
- */
2455
- latestCharge?: NestedPaymentIntentResponseDtoLatestCharge;
2456
- /** 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. */
2457
- charges: ChargeResponseDto[];
2458
- /**
2459
- * Payment method attached to this PaymentIntent. `null` before a method is attached or after a failure clears it.
2460
- * @nullable
2461
- */
2462
- paymentMethod?: NestedPaymentIntentResponseDtoPaymentMethod;
2463
- /**
2464
- * The Customer this payment belongs to. `null` if no Customer is associated.
2465
- * @nullable
2466
- */
2467
- customer?: NestedPaymentIntentResponseDtoCustomer;
2468
- /**
2469
- * Action the customer must take to advance the payment (e.g. complete 3-D Secure). `null` when no further action is needed.
2470
- * @nullable
2471
- */
2472
- nextAction?: NestedPaymentIntentResponseDtoNextAction;
2473
- /** Custom key/value pairs you attached when creating or updating the PaymentIntent. Useful for reconciling with your own systems. Empty object if none. */
2474
- metadata: NestedPaymentIntentResponseDtoMetadata;
2475
- /**
2476
- * Details of the most recent failed payment attempt for this PaymentIntent. `null` if no attempts have failed.
2477
- * @nullable
2478
- */
2479
- lastPaymentError?: NestedPaymentIntentResponseDtoLastPaymentError;
2480
- }
2481
-
2482
- /**
2483
- * Generated by orval v7.21.0 🍺
2484
- * Do not edit manually.
2485
- * XPay Checkout API
2486
- * API for the XPay checkout flow — client endpoints and SSR
2487
- * OpenAPI spec version: 1.0
2488
- */
2489
-
2490
- /**
2491
- * 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.
2492
- * @nullable
2493
- */
2494
- type CheckoutSessionResponseDtoPaymentIntent = NestedPaymentIntentResponseDto | null;
2495
-
2496
- /**
2497
- * Generated by orval v7.21.0 🍺
2498
- * Do not edit manually.
2499
- * XPay Checkout API
2500
- * API for the XPay checkout flow — client endpoints and SSR
2501
- * OpenAPI spec version: 1.0
2502
- */
2503
- /**
2504
- * Currency
2505
- */
2506
- type PriceDtoCurrency = typeof PriceDtoCurrency[keyof typeof PriceDtoCurrency];
2507
- declare const PriceDtoCurrency: {
2508
- readonly EGP: "EGP";
2509
- readonly USD: "USD";
2510
- readonly EUR: "EUR";
2511
- readonly GBP: "GBP";
2512
- readonly SAR: "SAR";
2513
- readonly AED: "AED";
2514
- readonly QAR: "QAR";
2515
- readonly KWD: "KWD";
2516
- readonly JOD: "JOD";
2517
- readonly OMR: "OMR";
2518
- readonly BHD: "BHD";
2519
- readonly LYD: "LYD";
2520
- readonly AUD: "AUD";
2521
- readonly CAD: "CAD";
2522
- readonly CNY: "CNY";
2523
- };
2524
-
2525
- /**
2526
- * Generated by orval v7.21.0 🍺
2527
- * Do not edit manually.
2528
- * XPay Checkout API
2529
- * API for the XPay checkout flow — client endpoints and SSR
2530
- * OpenAPI spec version: 1.0
2531
- */
2532
- /**
2533
- * Price type
2534
- */
2535
- type PriceDtoType = typeof PriceDtoType[keyof typeof PriceDtoType];
2536
- declare const PriceDtoType: {
2537
- readonly ONE_TIME: "ONE_TIME";
2538
- readonly RECURRING: "RECURRING";
2539
- readonly CUSTOM: "CUSTOM";
2540
- };
2541
-
2542
- /**
2543
- * Generated by orval v7.21.0 🍺
2544
- * Do not edit manually.
2545
- * XPay Checkout API
2546
- * API for the XPay checkout flow — client endpoints and SSR
2547
- * OpenAPI spec version: 1.0
2548
- */
2549
- /**
2550
- * Billing interval
2551
- */
2552
- type RecurringDtoInterval = typeof RecurringDtoInterval[keyof typeof RecurringDtoInterval];
2553
- declare const RecurringDtoInterval: {
2554
- readonly DAY: "DAY";
2555
- readonly WEEK: "WEEK";
2556
- readonly MONTH: "MONTH";
2557
- readonly YEAR: "YEAR";
2558
- readonly CUSTOM: "CUSTOM";
2559
- };
2560
-
2561
- /**
2562
- * Generated by orval v7.21.0 🍺
2563
- * Do not edit manually.
2564
- * XPay Checkout API
2565
- * API for the XPay checkout flow — client endpoints and SSR
2566
- * OpenAPI spec version: 1.0
2567
- */
2568
-
2569
- interface RecurringDto {
2570
- /** Billing interval */
2571
- interval?: RecurringDtoInterval;
2572
- /** Number of intervals between billings */
2573
- intervalCount?: number;
2574
- }
2575
-
2576
- /**
2577
- * Generated by orval v7.21.0 🍺
2578
- * Do not edit manually.
2579
- * XPay Checkout API
2580
- * API for the XPay checkout flow — client endpoints and SSR
2581
- * OpenAPI spec version: 1.0
2582
- */
2583
- interface CustomUnitAmountDto {
2584
- /** Minimum amount the customer may enter */
2585
- minimum?: number;
2586
- /** Maximum amount the customer may enter */
2587
- maximum?: number;
2588
- /** Suggested amount pre-filled at checkout */
2589
- preset?: number;
2590
- }
2591
-
2592
- /**
2593
- * Generated by orval v7.21.0 🍺
2594
- * Do not edit manually.
2595
- * XPay Checkout API
2596
- * API for the XPay checkout flow — client endpoints and SSR
2597
- * OpenAPI spec version: 1.0
2598
- */
2599
- interface ProductDto {
2600
- /** Product ID */
2601
- id: string;
2602
- /** Product name */
2603
- name: string;
2604
- /** Product description */
2605
- description?: string;
2606
- /** Product image URL */
2607
- image?: string;
2608
- /** 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. */
2609
- active: boolean;
2610
- }
2611
-
2612
- /**
2613
- * Generated by orval v7.21.0 🍺
2614
- * Do not edit manually.
2615
- * XPay Checkout API
2616
- * API for the XPay checkout flow — client endpoints and SSR
2617
- * OpenAPI spec version: 1.0
2618
- */
2619
-
2620
- interface PriceDto {
2621
- /** Price ID */
2622
- id: string;
2623
- /** Price amount in smallest currency unit */
2624
- unitAmount?: number;
2625
- /** Currency */
2626
- currency: PriceDtoCurrency;
2627
- /** Price type */
2628
- type: PriceDtoType;
2629
- /** Recurring configuration (for recurring prices) */
2630
- recurring?: RecurringDto;
2631
- /** Custom unit amount configuration — present for CUSTOM-type prices */
2632
- customUnitAmount?: CustomUnitAmountDto;
2633
- /** Creation timestamp (ISO 8601) */
2634
- createdAt: string;
2635
- /** Whether the price is active. `false` means the merchant archived it. */
2636
- active: boolean;
2637
- /**
2638
- * Remaining stock. `null` means unlimited. Decremented on PaymentIntent success. May go negative under race conditions (oversold).
2639
- * @nullable
2640
- */
2641
- stock?: number | null;
2642
- /**
2643
- * Start date (before which the price is not usable in checkout), ISO 8601
2644
- * @nullable
2645
- */
2646
- startDate?: string | null;
2647
- /**
2648
- * Expiration date (at/after which the price is not usable in checkout), ISO 8601
2649
- * @nullable
2650
- */
2651
- expirationDate?: string | null;
2652
- /** Product associated with this price */
2653
- product: ProductDto;
2654
- }
2655
-
2656
- /**
2657
- * Generated by orval v7.21.0 🍺
2658
- * Do not edit manually.
2659
- * XPay Checkout API
2660
- * API for the XPay checkout flow — client endpoints and SSR
2661
- * OpenAPI spec version: 1.0
2662
- */
2663
- /**
2664
- * Currency for the amounts (ISO 4217)
2665
- */
2666
- type LineItemDtoCurrency = typeof LineItemDtoCurrency[keyof typeof LineItemDtoCurrency];
2667
- declare const LineItemDtoCurrency: {
2668
- readonly EGP: "EGP";
2669
- readonly USD: "USD";
2670
- readonly EUR: "EUR";
2671
- readonly GBP: "GBP";
2672
- readonly SAR: "SAR";
2673
- readonly AED: "AED";
2674
- readonly QAR: "QAR";
2675
- readonly KWD: "KWD";
2676
- readonly JOD: "JOD";
2677
- readonly OMR: "OMR";
2678
- readonly BHD: "BHD";
2679
- readonly LYD: "LYD";
2680
- readonly AUD: "AUD";
2681
- readonly CAD: "CAD";
2682
- readonly CNY: "CNY";
2683
- };
2684
-
2685
- /**
2686
- * Generated by orval v7.21.0 🍺
2687
- * Do not edit manually.
2688
- * XPay Checkout API
2689
- * API for the XPay checkout flow — client endpoints and SSR
2690
- * OpenAPI spec version: 1.0
2691
- */
2692
- /**
2693
- * Presentment currency for this line — matches session.presentmentDetails.currency
2694
- */
2695
- type LineItemPresentmentDetailsDtoCurrency = typeof LineItemPresentmentDetailsDtoCurrency[keyof typeof LineItemPresentmentDetailsDtoCurrency];
2696
- declare const LineItemPresentmentDetailsDtoCurrency: {
2697
- readonly EGP: "EGP";
2698
- readonly USD: "USD";
2699
- readonly EUR: "EUR";
2700
- readonly GBP: "GBP";
2701
- readonly SAR: "SAR";
2702
- readonly AED: "AED";
2703
- readonly QAR: "QAR";
2704
- readonly KWD: "KWD";
2705
- readonly JOD: "JOD";
2706
- readonly OMR: "OMR";
2707
- readonly BHD: "BHD";
2708
- readonly LYD: "LYD";
2709
- readonly AUD: "AUD";
2710
- readonly CAD: "CAD";
2711
- readonly CNY: "CNY";
2712
- };
2713
-
2714
- /**
2715
- * Generated by orval v7.21.0 🍺
2716
- * Do not edit manually.
2717
- * XPay Checkout API
2718
- * API for the XPay checkout flow — client endpoints and SSR
2719
- * OpenAPI spec version: 1.0
2720
- */
2721
-
2722
- interface LineItemPresentmentDetailsDto {
2723
- /** Unit amount in presentment smallest unit */
2724
- unitAmount: number;
2725
- /** Line subtotal (unitAmount × quantity) in presentment smallest unit */
2726
- amountSubtotal: number;
2727
- /** Line discount allocated to this item, in presentment smallest unit */
2728
- amountDiscount: number;
2729
- /** Line total after discount + tax, in presentment smallest unit */
2730
- amountTotal: number;
2731
- /** Presentment currency for this line — matches session.presentmentDetails.currency */
2732
- currency: LineItemPresentmentDetailsDtoCurrency;
2733
- }
2734
-
2735
- /**
2736
- * Generated by orval v7.21.0 🍺
2737
- * Do not edit manually.
2738
- * XPay Checkout API
2739
- * API for the XPay checkout flow — client endpoints and SSR
2740
- * OpenAPI spec version: 1.0
2741
- */
2742
-
2743
- interface LineItemDto {
2744
- /** Line item ID */
2745
- id: string;
2746
- /** Quantity */
2747
- quantity: number;
2748
- /** Price information */
2749
- price: PriceDto;
2750
- /** Adjustable quantity settings */
2751
- adjustableQuantity?: AdjustableQuantityDto;
2752
- /** Total before any discounts or taxes (unitAmount × quantity) */
2753
- amountSubtotal?: number;
2754
- /** Total after discounts and taxes */
2755
- amountTotal?: number;
2756
- /** Discount amount applied to this item */
2757
- amountDiscount?: number;
2758
- /** Tax amount applied to this item */
2759
- amountTax?: number;
2760
- /** Currency for the amounts (ISO 4217) */
2761
- currency?: LineItemDtoCurrency;
2762
- /** Description from price/product */
2763
- description?: string;
2764
- /** 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. */
2765
- presentmentDetails?: LineItemPresentmentDetailsDto;
2766
- }
2767
-
2768
- /**
2769
- * Generated by orval v7.21.0 🍺
2770
- * Do not edit manually.
2771
- * XPay Checkout API
2772
- * API for the XPay checkout flow — client endpoints and SSR
2773
- * OpenAPI spec version: 1.0
2774
- */
2775
- /**
2776
- * Field type
2777
- */
2778
- type CustomFieldResponseDtoType = typeof CustomFieldResponseDtoType[keyof typeof CustomFieldResponseDtoType];
2779
- declare const CustomFieldResponseDtoType: {
2780
- readonly TEXT: "TEXT";
2781
- readonly NUMBER: "NUMBER";
2782
- readonly DROPDOWN: "DROPDOWN";
2783
- readonly CHECKBOX: "CHECKBOX";
2784
- };
2785
-
2786
- /**
2787
- * Generated by orval v7.21.0 🍺
2788
- * Do not edit manually.
2789
- * XPay Checkout API
2790
- * API for the XPay checkout flow — client endpoints and SSR
2791
- * OpenAPI spec version: 1.0
2792
- */
2793
- /**
2794
- * Type of validation limit
2795
- */
2796
- type CustomFieldResponseDtoLimitType = typeof CustomFieldResponseDtoLimitType[keyof typeof CustomFieldResponseDtoLimitType];
2797
- declare const CustomFieldResponseDtoLimitType: {
2798
- readonly AT_MOST: "AT_MOST";
2799
- readonly BETWEEN: "BETWEEN";
2800
- readonly AT_LEAST: "AT_LEAST";
2801
- readonly EXACTLY: "EXACTLY";
2802
- };
2803
-
2804
- /**
2805
- * Generated by orval v7.21.0 🍺
2806
- * Do not edit manually.
2807
- * XPay Checkout API
2808
- * API for the XPay checkout flow — client endpoints and SSR
2809
- * OpenAPI spec version: 1.0
2810
- */
2811
- interface DropdownOptionResponseDto {
2812
- /** Option label */
2813
- label: string;
2814
- }
2815
-
2816
- /**
2817
- * Generated by orval v7.21.0 🍺
2818
- * Do not edit manually.
2819
- * XPay Checkout API
2820
- * API for the XPay checkout flow — client endpoints and SSR
2821
- * OpenAPI spec version: 1.0
2822
- */
2823
- interface CustomFieldTextValueDto {
2824
- /** Text value */
2825
- value: string;
2826
- }
2827
-
2828
- /**
2829
- * Generated by orval v7.21.0 🍺
2830
- * Do not edit manually.
2831
- * XPay Checkout API
2832
- * API for the XPay checkout flow — client endpoints and SSR
2833
- * OpenAPI spec version: 1.0
2834
- */
2835
- interface CustomFieldNumericValueDto {
2836
- /** Numeric value */
2837
- value: string;
2838
- }
2839
-
2840
- /**
2841
- * Generated by orval v7.21.0 🍺
2842
- * Do not edit manually.
2843
- * XPay Checkout API
2844
- * API for the XPay checkout flow — client endpoints and SSR
2845
- * OpenAPI spec version: 1.0
2846
- */
2847
- interface CustomFieldDropdownValueDto {
2848
- /** Selected dropdown value */
2849
- value: string;
2850
- }
2851
-
2852
- /**
2853
- * Generated by orval v7.21.0 🍺
2854
- * Do not edit manually.
2855
- * XPay Checkout API
2856
- * API for the XPay checkout flow — client endpoints and SSR
2857
- * OpenAPI spec version: 1.0
2858
- */
2859
-
2860
- interface CustomFieldResponseDto {
2861
- /** Unique key for the field */
2862
- key: string;
2863
- /** Field label */
2864
- label: string;
2865
- /** Field type */
2866
- type: CustomFieldResponseDtoType;
2867
- /** Whether the field is optional */
2868
- isOptional: boolean;
2869
- /** Whether validation limits are enabled */
2870
- hasLimits?: boolean;
2871
- /** Type of validation limit */
2872
- limitType?: CustomFieldResponseDtoLimitType;
2873
- /** Minimum number of characters */
2874
- minCharacters?: number;
2875
- /** Maximum number of characters */
2876
- maxCharacters?: number;
2877
- /** Dropdown options */
2878
- dropdownOptions?: DropdownOptionResponseDto[];
2879
- /** Text value (populated after collection) */
2880
- text?: CustomFieldTextValueDto;
2881
- /** Numeric value (populated after collection) */
2882
- numeric?: CustomFieldNumericValueDto;
2883
- /** Dropdown value (populated after collection) */
2884
- dropdown?: CustomFieldDropdownValueDto;
2885
- }
2886
-
2887
- /**
2888
- * Generated by orval v7.21.0 🍺
2889
- * Do not edit manually.
2890
- * XPay Checkout API
2891
- * API for the XPay checkout flow — client endpoints and SSR
2892
- * OpenAPI spec version: 1.0
2893
- */
2894
- /**
2895
- * Discount type
2896
- */
2897
- type CouponResponseDtoDiscountType = typeof CouponResponseDtoDiscountType[keyof typeof CouponResponseDtoDiscountType];
2898
- declare const CouponResponseDtoDiscountType: {
2899
- readonly percentage: "percentage";
2900
- readonly fixed_amount: "fixed_amount";
2901
- };
2902
-
2903
- /**
2904
- * Generated by orval v7.21.0 🍺
2905
- * Do not edit manually.
2906
- * XPay Checkout API
2907
- * API for the XPay checkout flow — client endpoints and SSR
2908
- * OpenAPI spec version: 1.0
2909
- */
2910
- /**
2911
- * Currency for amountOff
2912
- */
2913
- type CouponResponseDtoCurrency = typeof CouponResponseDtoCurrency[keyof typeof CouponResponseDtoCurrency];
2914
- declare const CouponResponseDtoCurrency: {
2915
- readonly EGP: "EGP";
2916
- readonly USD: "USD";
2917
- readonly EUR: "EUR";
2918
- readonly GBP: "GBP";
2919
- readonly SAR: "SAR";
2920
- readonly AED: "AED";
2921
- readonly QAR: "QAR";
2922
- readonly KWD: "KWD";
2923
- readonly JOD: "JOD";
2924
- readonly OMR: "OMR";
2925
- readonly BHD: "BHD";
2926
- readonly LYD: "LYD";
2927
- readonly AUD: "AUD";
2928
- readonly CAD: "CAD";
2929
- readonly CNY: "CNY";
2930
- };
2931
-
2932
- /**
2933
- * Generated by orval v7.21.0 🍺
2934
- * Do not edit manually.
2935
- * XPay Checkout API
2936
- * API for the XPay checkout flow — client endpoints and SSR
2937
- * OpenAPI spec version: 1.0
2938
- */
2939
- /**
2940
- * Duration
2941
- */
2942
- type CouponResponseDtoDuration = typeof CouponResponseDtoDuration[keyof typeof CouponResponseDtoDuration];
2943
- declare const CouponResponseDtoDuration: {
2944
- readonly once: "once";
2945
- readonly repeating: "repeating";
2946
- readonly forever: "forever";
2947
- };
2948
-
2949
- /**
2950
- * Generated by orval v7.21.0 🍺
2951
- * Do not edit manually.
2952
- * XPay Checkout API
2953
- * API for the XPay checkout flow — client endpoints and SSR
2954
- * OpenAPI spec version: 1.0
2955
- */
2956
- /**
2957
- * Custom metadata
2958
- */
2959
- type CouponResponseDtoMetadata = {
2960
- [key: string]: unknown;
2961
- };
2962
-
2963
- /**
2964
- * Generated by orval v7.21.0 🍺
2965
- * Do not edit manually.
2966
- * XPay Checkout API
2967
- * API for the XPay checkout flow — client endpoints and SSR
2968
- * OpenAPI spec version: 1.0
2969
- */
2970
-
2971
- /**
2972
- * 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.
2973
-
2974
- 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.
2975
- */
2976
- interface CouponResponseDto {
2977
- /** Coupon ID */
2978
- id: string;
2979
- /** Object type */
2980
- object: string;
2981
- /** Created timestamp (ISO 8601) */
2982
- createdAt: string;
2983
- /** Discount type */
2984
- discountType: CouponResponseDtoDiscountType;
2985
- /** Percentage off (0.01-100) */
2986
- percentOff?: number;
2987
- /** Fixed amount off in smallest currency unit */
2988
- amountOff?: number;
2989
- /** Currency for amountOff */
2990
- currency?: CouponResponseDtoCurrency;
2991
- /** Duration */
2992
- duration: CouponResponseDtoDuration;
2993
- /** Number of months for repeating duration */
2994
- durationInMonths?: number;
2995
- /** Display name */
2996
- name?: string;
2997
- /** Maximum discount amount for percentage coupons (caps the discount) */
2998
- maxDiscountAmount?: number;
2999
- /** Minimum order subtotal required to use this coupon */
3000
- minValue?: number;
3001
- /** Maximum total redemptions */
3002
- maxRedemptions?: number;
3003
- /** Maximum times a single customer can redeem */
3004
- customerMaxRedemptions?: number;
3005
- /** Number of times redeemed */
3006
- timesRedeemed: number;
3007
- /** Redemption deadline (ISO 8601) */
3008
- redeemBy?: string;
3009
- /** Whether the coupon is currently valid (computed) */
3010
- valid: boolean;
3011
- /** Whether the coupon is active */
3012
- active: boolean;
3013
- /** Product IDs this coupon applies to */
3014
- appliesToProductIds?: string[];
3015
- /** Custom metadata */
3016
- metadata?: CouponResponseDtoMetadata;
3017
- /** Merchant ID */
3018
- merchantId: string;
3019
- /** Whether this is live mode */
3020
- livemode: boolean;
3021
- }
3022
-
3023
- /**
3024
- * Generated by orval v7.21.0 🍺
3025
- * Do not edit manually.
3026
- * XPay Checkout API
3027
- * API for the XPay checkout flow — client endpoints and SSR
3028
- * OpenAPI spec version: 1.0
3029
- */
3030
-
3031
- /**
3032
- * 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.
3033
- */
3034
- interface DiscountResponseDto {
3035
- /** Discount ID */
3036
- id: string;
3037
- /** Object type */
3038
- object: string;
3039
- /** The coupon that was applied */
3040
- coupon: CouponResponseDto;
3041
- /** Promotion code ID used (null if direct coupon application) */
3042
- promotionCodeId?: string;
3043
- /** Customer-facing promotion code string (e.g. SUMMER25) */
3044
- promotionCodeCode?: string;
3045
- /** Checkout session this discount was applied to */
3046
- checkoutSessionId: string;
3047
- /** Customer who received the discount */
3048
- customerId?: string;
3049
- /** When the discount became active (ISO 8601) */
3050
- start: string;
3051
- /** When the discount ends (ISO 8601) */
3052
- end?: string;
3053
- }
3054
-
3055
- /**
3056
- * Generated by orval v7.21.0 🍺
3057
- * Do not edit manually.
3058
- * XPay Checkout API
3059
- * API for the XPay checkout flow — client endpoints and SSR
3060
- * OpenAPI spec version: 1.0
3061
- */
3062
- /**
3063
- * Where this config came from
3064
- */
3065
- type FeeConfigResponseDtoSource = typeof FeeConfigResponseDtoSource[keyof typeof FeeConfigResponseDtoSource];
3066
- declare const FeeConfigResponseDtoSource: {
3067
- readonly session: "session";
3068
- readonly merchant: "merchant";
3069
- readonly system: "system";
3070
- };
3071
-
3072
- /**
3073
- * Generated by orval v7.21.0 🍺
3074
- * Do not edit manually.
3075
- * XPay Checkout API
3076
- * API for the XPay checkout flow — client endpoints and SSR
3077
- * OpenAPI spec version: 1.0
3078
- */
3079
-
3080
- interface FeeConfigResponseDto {
3081
- /** Whether customer pays platform fee (false = merchant pays) */
3082
- feesPassThrough: boolean;
3083
- /** Whether to collect VAT from customer */
3084
- vatCollectionEnabled: boolean;
3085
- /** VAT collection rate in basis points (e.g., 1400 = 14%) */
3086
- vatCollectionRate?: number;
3087
- /** Where this config came from */
3088
- source: FeeConfigResponseDtoSource;
3089
- }
3090
-
3091
- /**
3092
- * Generated by orval v7.21.0 🍺
3093
- * Do not edit manually.
3094
- * XPay Checkout API
3095
- * API for the XPay checkout flow — client endpoints and SSR
3096
- * OpenAPI spec version: 1.0
3097
- */
3098
- /**
3099
- * Language the checkout page is displayed in. Resolved from `session.locale`, falling back to your account's `defaultLocale`, then to `en`.
3100
- */
3101
- type CheckoutSessionResponseDtoLocale = typeof CheckoutSessionResponseDtoLocale[keyof typeof CheckoutSessionResponseDtoLocale];
3102
- declare const CheckoutSessionResponseDtoLocale: {
3103
- readonly en: "en";
3104
- readonly ar: "ar";
3105
- };
3106
-
3107
- /**
3108
- * Generated by orval v7.21.0 🍺
3109
- * Do not edit manually.
3110
- * XPay Checkout API
3111
- * API for the XPay checkout flow — client endpoints and SSR
3112
- * OpenAPI spec version: 1.0
3113
- */
3114
- interface PaymentMethodTypeResponseDto {
3115
- /** Concrete payment method type (e.g., 'card', 'fawry', 'valu') */
3116
- type: string;
3117
- /** Display name for the payment method */
3118
- displayName: string;
3119
- /** UI grouping category (e.g., 'card', 'bnpl', 'kiosk') */
3120
- category?: string;
3121
- /**
3122
- * Minimum transaction amount in piasters
3123
- * @nullable
3124
- */
3125
- minTransactionAmount?: string | null;
3126
- /**
3127
- * Maximum transaction amount in piasters
3128
- * @nullable
3129
- */
3130
- maxTransactionAmount?: string | null;
3131
- /**
3132
- * Required customer fields for this payment method
3133
- * @nullable
3134
- */
3135
- requiredCustomerFields?: string[] | null;
3136
- /** Whether this payment method supports refunds */
3137
- supportsRefund?: boolean;
3138
- /** Whether partial refunds are supported */
3139
- supportsPartialRefund?: boolean;
3140
- /** Whether partial capture is supported */
3141
- supportsPartialCapture?: boolean;
3142
- /** Whether payment resolves immediately or asynchronously */
3143
- paymentConfirmation?: string;
3144
- }
3145
-
3146
- /**
3147
- * Generated by orval v7.21.0 🍺
3148
- * Do not edit manually.
3149
- * XPay Checkout API
3150
- * API for the XPay checkout flow — client endpoints and SSR
3151
- * OpenAPI spec version: 1.0
3152
- */
3153
-
3154
- interface FeesResponseDto {
3155
- /** Payment method type (e.g., card, fawry, valu) */
3156
- paymentMethodType: string;
3157
- /** Platform fee amount (only if feesPassThrough is true) */
3158
- feeAmount: number;
3159
- /** Fee percentage */
3160
- feePercentage: number;
3161
- /** VAT amount (only if vatCollectionEnabled is true) */
3162
- vatAmount?: number;
3163
- /** Total amount customer will pay */
3164
- totalAmount: number;
3165
- /** Card info (only for card payments with BIN) */
3166
- cardInfo?: CardInfoResponseDto;
3167
- }
3168
-
3169
- /**
3170
- * Generated by orval v7.21.0 🍺
3171
- * Do not edit manually.
3172
- * XPay Checkout API
3173
- * API for the XPay checkout flow — client endpoints and SSR
3174
- * OpenAPI spec version: 1.0
3175
- */
3176
- /**
3177
- * Whether to save address to customer.address
3178
- */
3179
- type CustomerUpdateResponseDtoAddress = typeof CustomerUpdateResponseDtoAddress[keyof typeof CustomerUpdateResponseDtoAddress];
3180
- declare const CustomerUpdateResponseDtoAddress: {
3181
- readonly auto: "auto";
3182
- readonly never: "never";
3183
- };
3184
-
3185
- /**
3186
- * Generated by orval v7.21.0 🍺
3187
- * Do not edit manually.
3188
- * XPay Checkout API
3189
- * API for the XPay checkout flow — client endpoints and SSR
3190
- * OpenAPI spec version: 1.0
3191
- */
3192
- /**
3193
- * Whether to save name to customer.name
3194
- */
3195
- type CustomerUpdateResponseDtoName = typeof CustomerUpdateResponseDtoName[keyof typeof CustomerUpdateResponseDtoName];
3196
- declare const CustomerUpdateResponseDtoName: {
3197
- readonly auto: "auto";
3198
- readonly never: "never";
3199
- };
3200
-
3201
- /**
3202
- * Generated by orval v7.21.0 🍺
3203
- * Do not edit manually.
3204
- * XPay Checkout API
3205
- * API for the XPay checkout flow — client endpoints and SSR
3206
- * OpenAPI spec version: 1.0
3207
- */
3208
- /**
3209
- * Whether to save shipping to customer.shipping
3210
- */
3211
- type CustomerUpdateResponseDtoShipping = typeof CustomerUpdateResponseDtoShipping[keyof typeof CustomerUpdateResponseDtoShipping];
3212
- declare const CustomerUpdateResponseDtoShipping: {
3213
- readonly auto: "auto";
3214
- readonly never: "never";
3215
- };
3216
-
3217
- /**
3218
- * Generated by orval v7.21.0 🍺
3219
- * Do not edit manually.
3220
- * XPay Checkout API
3221
- * API for the XPay checkout flow — client endpoints and SSR
3222
- * OpenAPI spec version: 1.0
3223
- */
3224
-
3225
- interface CustomerUpdateResponseDto {
3226
- /** Whether to save address to customer.address */
3227
- address?: CustomerUpdateResponseDtoAddress;
3228
- /** Whether to save name to customer.name */
3229
- name?: CustomerUpdateResponseDtoName;
3230
- /** Whether to save shipping to customer.shipping */
3231
- shipping?: CustomerUpdateResponseDtoShipping;
3232
- }
3233
-
3234
- /**
3235
- * Generated by orval v7.21.0 🍺
3236
- * Do not edit manually.
3237
- * XPay Checkout API
3238
- * API for the XPay checkout flow — client endpoints and SSR
3239
- * OpenAPI spec version: 1.0
3240
- */
3241
- /**
3242
- * Custom metadata
3243
- */
3244
- type CheckoutSessionResponseDtoMetadata = {
3245
- [key: string]: unknown;
3246
- };
3247
-
3248
- /**
3249
- * Generated by orval v7.21.0 🍺
3250
- * Do not edit manually.
3251
- * XPay Checkout API
3252
- * API for the XPay checkout flow — client endpoints and SSR
3253
- * OpenAPI spec version: 1.0
3254
- */
3255
-
3256
- /**
3257
- * 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.
3258
- */
3259
- interface CheckoutSessionResponseDto {
3260
- /** Checkout session ID. Absent on the SSR hosted-view payload derived from a payment link (before the first mutation materializes the session). */
3261
- id?: string;
3262
- /** Object type */
3263
- object: string;
3264
- /** Created timestamp (ISO 8601) */
3265
- createdAt: string;
3266
- /** Updated timestamp (ISO 8601) */
3267
- updatedAt?: string;
3268
- /** Session mode */
3269
- mode: CheckoutSessionResponseDtoMode;
3270
- /** UI mode */
3271
- uiMode: CheckoutSessionResponseDtoUiMode;
3272
- /** Submit type */
3273
- submitType: CheckoutSessionResponseDtoSubmitType;
3274
- /** Customer creation mode */
3275
- customerCreation: CheckoutSessionResponseDtoCustomerCreation;
3276
- /** Whether the customer is done with checkout. `open` while they are still on the page; `complete` once they have paid or, for methods paid later such as a Fawry reference, once they hold the reference; `expired` if the session timed out while still open. `complete` does not mean paid: read `paymentStatus` for that. */
3277
- status: CheckoutSessionResponseDtoStatus;
3278
- /** Whether the money has arrived. `paid` means fulfil; `unpaid` on a `complete` session means the customer still has to pay a reference. Never fulfil on `status` alone. */
3279
- paymentStatus: CheckoutSessionResponseDtoPaymentStatus;
3280
- /** Currency code (ISO 4217) */
3281
- currency?: CheckoutSessionResponseDtoCurrency;
3282
- /** Subtotal before discounts/taxes */
3283
- amountSubtotal?: number;
3284
- /** Total amount due */
3285
- amountTotal?: number;
3286
- /** Amount breakdown */
3287
- totalDetails?: TotalDetailsResponseDto;
3288
- /** 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. */
3289
- presentmentDetails?: SessionPresentmentDetailsDto;
3290
- /** What happens after payment: redirect to merchant URL or show hosted confirmation page */
3291
- afterCompletion: CheckoutSessionResponseDtoAfterCompletion;
3292
- /** Cancel redirect URL (back button during checkout) */
3293
- cancelUrl?: string;
3294
- /** Checkout page URL (hosted mode) */
3295
- url?: string;
3296
- /** Client secret for frontend access */
3297
- clientSecret?: string;
3298
- /** Expiration timestamp (ISO 8601) */
3299
- expiresAt?: string;
3300
- /** Whether this session can no longer be paid because it has expired (either swept/expired by status, or past `expiresAt`). Clients MUST render from this flag and MUST NOT re-derive expiry by comparing `expiresAt` against the local clock — a customer device running fast reads a live session as dead. */
3301
- isExpired: boolean;
3302
- /** Customer ID (when existing customer linked) */
3303
- customerId?: string;
3304
- /** Customer object (when customerId is provided). Contains existing customer data for prefill. */
3305
- customer?: CheckoutSessionCustomerDto;
3306
- /** CustomerDetails - unified prefill/collection object. Contains name, email, phone, address (billing), shipping. */
3307
- customerDetails?: CustomerDetailsResponseDto;
3308
- /** Payment Intent ID */
3309
- paymentIntentId?: string;
3310
- /**
3311
- * 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.
3312
- * @nullable
3313
- */
3314
- paymentIntent: CheckoutSessionResponseDtoPaymentIntent;
3315
- /** Line items with full price and product details */
3316
- lineItems?: LineItemDto[];
3317
- /** Custom fields with configuration and collected values (Stripe-aligned). Values are populated after customer submits. */
3318
- customFields?: CustomFieldResponseDto[];
3319
- /** Applied discounts on this session */
3320
- discounts?: DiscountResponseDto[];
3321
- /** Allow promotion codes */
3322
- allowPromotionCodes: boolean;
3323
- /** Collect customer name */
3324
- nameCollection: boolean;
3325
- /** Collect billing address */
3326
- billingAddressCollection: boolean;
3327
- /** Collect shipping address */
3328
- shippingAddressCollection: boolean;
3329
- /** Collect phone number */
3330
- phoneNumberCollection: boolean;
3331
- /** Fee configuration (tells checkout whether to track BIN and display fees) */
3332
- feeConfig?: FeeConfigResponseDto;
3333
- /** 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. */
3334
- brandingSettings?: BrandingSettingsResponseDto;
3335
- /** Language the checkout page is displayed in. Resolved from `session.locale`, falling back to your account's `defaultLocale`, then to `en`. */
3336
- locale?: CheckoutSessionResponseDtoLocale;
3337
- /** Available payment method types with fee estimates */
3338
- paymentMethodTypes?: PaymentMethodTypeResponseDto[];
3339
- /** ID of the PaymentMethodConfiguration used for this session */
3340
- paymentMethodConfigurationId?: string;
3341
- /** Fee breakdown (only populated when feesPassThrough or vatCollectionEnabled, and after /update with BIN for cards) */
3342
- fees?: FeesResponseDto;
3343
- /** Controls which customer fields to update when customerId is provided */
3344
- customerUpdate?: CustomerUpdateResponseDto;
3345
- /** Custom metadata */
3346
- metadata?: CheckoutSessionResponseDtoMetadata;
3347
- /** Merchant ID */
3348
- merchantId: string;
3349
- /** Merchant display name */
3350
- merchantName?: string;
3351
- /** Merchant logo URL */
3352
- merchantLogo?: string;
3353
- /** Payment Link ID (if created from link) */
3354
- paymentLinkId?: string;
3355
- /** Whether this is a live mode session */
3356
- livemode: boolean;
3357
- }
3358
-
3359
- /**
3360
- * XPay SDK Public API Types
3361
- *
3362
- * SDK-specific interfaces (XPayInstance, Elements, etc.) are defined here.
3363
- * Data types (session fields, payment methods, etc.) are derived from
3364
- * the Orval-generated @xpay/checkout-api package — the source of truth.
3365
- * If the API changes a field, TypeScript catches it at compile time.
3366
- */
3367
-
3368
- /**
3369
- * Information about an available payment method.
3370
- *
3371
- * @example
3372
- * ```ts
3373
- * checkout.paymentMethods.forEach(pm => {
3374
- * console.log(pm.type); // "card", "valu", "fawry"
3375
- * console.log(pm.displayName); // "Card", "ValU", "Fawry"
3376
- * console.log(pm.category); // "card", "bnpl", "kiosk", "wallet"
3377
- * });
3378
- * ```
3379
- */
3380
- type PaymentMethodInfo = Required<Pick<PaymentMethodTypeResponseDto, "type" | "displayName">> & {
3381
- /** Payment method category for grouping in UI */
3382
- category: "card" | "bnpl" | "kiosk" | "wallet";
3383
- /** Icon URL for the payment method */
3384
- icon?: string;
3385
- /** Description of the next step (e.g., "You will be redirected to complete payment") */
3386
- nextActionText?: string;
3387
- };
3388
- /**
3389
- * Appearance overrides for the checkout UI.
3390
- * Merged with the session's server-side `brandingSettings`.
3391
- *
3392
- * @example
3393
- * ```ts
3394
- * const elements = xpay.elements({
3395
- * clientSecret,
3396
- * appearance: {
3397
- * colorMode: "dark",
3398
- * borderStyle: "rounded",
3399
- * inputStyle: "outlined",
3400
- * },
3401
- * });
3402
- * ```
3403
- */
3404
- type Appearance = Pick<BrandingSettingsResponseDto, "colorMode" | "borderStyle" | "spacing" | "inputSize" | "inputStyle" | "formLayout" | "colors" | "fontFamily">;
3405
- /**
3406
- * Structured session status — tagged union for exhaustive checking.
3407
- *
3408
- * @example
3409
- * ```ts
3410
- * switch (checkout.status.type) {
3411
- * case "open": // ready for payment
3412
- * case "expired": // session timed out
3413
- * case "complete": // payment completed — check paymentStatus
3414
- * }
3415
- * ```
3416
- */
3417
- /**
3418
- * `complete` means the customer is done with checkout, not that the money has
3419
- * arrived. Cards and other instant methods complete as `paid`; a method the customer
3420
- * pays afterwards (a Fawry reference) completes as `unpaid`, and the session turns
3421
- * `paid` later — announced by `checkout.session.async_payment_succeeded`. Fulfil on
3422
- * `paymentStatus === "paid"`, never on `type === "complete"` alone.
3423
- */
3424
- type SessionStatus = {
3425
- type: "open";
3426
- } | {
3427
- type: "expired";
3428
- } | {
3429
- type: "complete";
3430
- paymentStatus: CheckoutSessionResponseDtoPaymentStatus;
3431
- };
3432
- /**
3433
- * Checkout session data exposed to merchants.
3434
- *
3435
- * Contains everything needed to render a checkout UI: amounts, currency,
3436
- * available payment methods, line items, fees, and discounts.
3437
- *
3438
- * @example
3439
- * ```ts
3440
- * const state = useCheckout();
3441
- * if (state.type === "success") {
3442
- * const { checkout } = state;
3443
- * console.log(checkout.amountTotal); // "10000" (in minor units)
3444
- * console.log(checkout.currency); // "EGP"
3445
- * console.log(checkout.status.type); // "open"
3446
- * console.log(checkout.paymentMethods); // [{type: "card", ...}, ...]
3447
- * }
3448
- * ```
3449
- */
3450
- type CheckoutSession = Pick<CheckoutSessionResponseDto, "id" | "amountSubtotal" | "amountTotal" | "currency" | "merchantName" | "livemode" | "expiresAt"> & {
3451
- /** Structured session status */
3452
- status: SessionStatus;
3453
- /** Whether the session is ready for confirmation */
3454
- canConfirm: boolean;
3455
- /** Available payment methods */
3456
- paymentMethods: PaymentMethodInfo[];
3457
- /**
3458
- * Customer-facing amounts, present only when the merchant prices in a
3459
- * currency other than the processing currency — read amounts
3460
- * presentment-first (`presentmentDetails.amountTotal` when present,
3461
- * top-level `amountTotal` otherwise).
3462
- */
3463
- presentmentDetails?: CheckoutSessionResponseDto["presentmentDetails"];
3464
- /** Line items in the session */
3465
- lineItems?: CheckoutSessionResponseDto["lineItems"];
3466
- /** Totals breakdown (subtotal, tax, shipping, etc.) */
3467
- totalDetails?: CheckoutSessionResponseDto["totalDetails"];
3468
- /** Fee breakdown (when feesPassThrough is enabled) */
3469
- fees?: CheckoutSessionResponseDto["fees"];
3470
- /** Applied discounts / promotion codes */
3471
- discounts?: CheckoutSessionResponseDto["discounts"];
3472
- };
3473
-
3474
- /**
3475
- * Result of an action (confirm, promo, quantity update, etc.).
3476
- * Tagged union — check `result.type` to determine success or failure.
3477
- *
3478
- * @example
3479
- * ```ts
3480
- * const result = await checkout.applyPromotionCode("SAVE10");
3481
- * if (result.type === "success") {
3482
- * console.log(result.session.amountTotal); // updated amount
3483
- * } else {
3484
- * console.log(result.error.message); // "Invalid promotion code"
3485
- * }
3486
- * ```
3487
- */
3488
- type ActionResult<E = XPayError> = {
3489
- type: "success";
3490
- session: CheckoutSession;
3491
- } | {
3492
- type: "error";
3493
- error: E;
3494
- };
3495
- /**
3496
- * Unified error type for ALL SDK operations (Stripe-style).
3497
- *
3498
- * Same type for `confirm()`, `applyPromotionCode()`, `updateLineItemQuantity()`, etc.
3499
- * Payment-specific fields (`declineCode`, `adviceCode`, `chargeId`, `paymentMethod`) are
3500
- * `null` for non-payment errors.
3501
- *
3502
- * @example Payment decline:
3503
- * ```ts
3504
- * const result = await checkout.confirm({ customerDetails: { email } });
3505
- * if (result.type === "error") {
3506
- * console.log(result.error.type); // "card_error"
3507
- * console.log(result.error.code); // "card_declined"
3508
- * console.log(result.error.declineCode); // "insufficient_funds"
3509
- * console.log(result.error.adviceCode); // "try_again_later"
3510
- * console.log(result.error.message); // "Your card has insufficient funds."
3511
- * }
3512
- * ```
3513
- *
3514
- * @example API error (promo code, quantity, session):
3515
- * ```ts
3516
- * const result = await checkout.applyPromotionCode("INVALID");
3517
- * if (result.type === "error") {
3518
- * console.log(result.error.type); // "invalid_request_error"
3519
- * console.log(result.error.code); // "promotion_code_not_found"
3520
- * console.log(result.error.param); // "promotionCode"
3521
- * console.log(result.error.docUrl); // "https://docs.xpay.app/api/errors#promotion_code_not_found"
3522
- * console.log(result.error.message); // "No promotion code found for 'INVALID'"
3523
- * }
3524
- * ```
3525
- */
3526
- interface XPayError {
3527
- /** Error category: "card_error" | "payment_method_error" | "invalid_request_error" | "api_error" | ... */
3528
- type: string;
3529
- /** Machine-readable error code: "card_declined" | "checkout_session_expired" | "promotion_code_not_found" | ... */
3530
- code: string | null;
3531
- /** Human-readable error message */
3532
- message: string;
3533
- /** Parameter that caused the error (e.g., "promotionCode", "quantity") — null for payment errors */
3534
- param?: string | null;
3535
- /** Documentation URL for this error code */
3536
- docUrl?: string | null;
3537
- /** Decline code — WHY it failed specifically ("insufficient_funds", "generic_decline") — null for non-payment errors */
3538
- declineCode?: string | null;
3539
- /** Retry advice ("try_again_later" | "do_not_try_again" | "confirm_card_data") — null for non-payment errors */
3540
- adviceCode?: string | null;
3541
- /** Failed charge ID — null for non-payment errors */
3542
- chargeId?: string | null;
3543
- /** Failed payment method ID — null for non-payment errors */
3544
- paymentMethodId?: string | null;
3545
- /** Payment method type ("card" | "valu" | "fawry") — null for non-payment errors */
3546
- paymentMethodType?: string | null;
3547
- /** Payment method snapshot at time of failure — null for non-payment errors */
3548
- paymentMethod?: Record<string, unknown> | null;
3549
- }
3550
- /**
3551
- * The XPay SDK instance returned by `loadXPay()`.
3552
- *
3553
- * @example
3554
- * ```ts
3555
- * import { loadXPay } from "@xpayeg/sdk";
3556
- *
3557
- * const xpay = await loadXPay("pk_test_xxx");
3558
- * const elements = xpay.elements({ clientSecret: "cs_test_abc_secret_xyz" });
3559
- * ```
3560
- */
3561
- interface XPayInstance {
3562
- /**
3563
- * Create an Elements instance for custom checkout UI.
3564
- * Use with `PaymentElement` to render the payment form.
3565
- *
3566
- * @param options - Must include `clientSecret` from a checkout session
3567
- * @returns An Elements instance for creating and managing payment elements
3568
- */
3569
- elements(options: ElementsOptions): Elements;
3570
- /**
3571
- * Create a drop-in checkout modal or inline embed.
3572
- *
3573
- * @param options - Configuration including `clientSecret` and event handlers
3574
- * @returns A checkout instance with `open()`, `close()`, and `destroy()` methods
3575
- */
3576
- checkout(options: CheckoutOptions): CheckoutInstance;
3577
- /**
3578
- * Confirm a payment using the data collected by Elements.
3579
- *
3580
- * @param options - Must include `elements` and optionally `customerDetails`
3581
- * @returns Action result with the updated session on success, or an error
3582
- */
3583
- confirmPayment(options: ConfirmPaymentOptions): Promise<ActionResult>;
3584
- /**
3585
- * Initialize a checkout session — combines `elements()` with session data.
3586
- * Returns session data + action methods in a single call.
3587
- *
3588
- * @param options - Must include `clientSecret`
3589
- * @returns Session data merged with checkout action methods
3590
- */
3591
- initCheckout(options: InitCheckoutOptions): Promise<InitCheckoutResult>;
3592
- }
3593
- /**
3594
- * Options for creating an Elements instance from an existing checkout session.
3595
- *
3596
- * @example
3597
- * ```ts
3598
- * const elements = xpay.elements({
3599
- * clientSecret: "cs_test_abc_secret_xyz",
3600
- * appearance: { colorMode: "dark" },
3601
- * locale: "ar",
3602
- * });
3603
- * ```
3604
- */
3605
- interface ElementsOptionsClientSecret {
3606
- /** The client secret from a checkout session. Can be a string or a Promise. */
3607
- clientSecret: string | Promise<string>;
3608
- /** Either use mode or clientSecret when creating an Elements group. */
3609
- mode?: never;
3610
- /** Amount is only applicable in deferred mode (`mode: "payment"`). */
3611
- amount?: never;
3612
- /** Currency is only applicable in deferred mode (`mode: "payment"`). */
3613
- currency?: never;
3614
- /** Only applicable in deferred mode. Session-first elements render the session's own payment method types, set when the session is created. */
3615
- paymentMethodTypes?: never;
3616
- /** Appearance overrides for the checkout UI */
3617
- appearance?: Appearance;
3618
- /** Locale for the payment form — `"en"` (default) or `"ar"` */
3619
- locale?: "en" | "ar";
3620
- }
3621
- /**
3622
- * Options for creating a DEFERRED Elements instance — no checkout session
3623
- * exists yet. The Payment Element renders immediately from the amount and
3624
- * currency alone; your server creates the session with the final total when
3625
- * the customer clicks Pay, and its clientSecret is passed to
3626
- * `confirmPayment({ elements, clientSecret })`.
3627
- *
3628
- * The amount shown is the amount charged: if the session your server creates
3629
- * has a different total, the confirmation fails with
3630
- * `amount_reconfirmation_required` and nothing is charged.
3631
- *
3632
- * @example
3633
- * ```ts
3634
- * const elements = xpay.elements({
3635
- * mode: "payment",
3636
- * amount: 250000, // piasters
3637
- * currency: "EGP",
3638
- * });
3639
- * ```
3640
- */
3641
- interface ElementsOptionsMode {
3642
- /** Deferred mode. Only `"payment"` is supported. */
3643
- mode: "payment";
3644
- /** The amount to display and charge, in the currency's smallest unit (piasters). Integer, greater than zero. */
3645
- amount: number;
3646
- /** Three-letter currency code (e.g. `"EGP"`). */
3647
- currency: string;
3648
- /**
3649
- * Restrict which payment method types the element renders (e.g. `["card"]`).
3650
- * Narrow-only: the list is intersected with the payment methods enabled for
3651
- * your account, so a type that is not enabled is never rendered. If nothing
3652
- * survives the intersection the element fails to load with a `loaderror`.
3653
- * Fixed for the element's lifetime. Omit to render every enabled method.
3654
- * The same values are passed as `paymentMethodTypes` when your server
3655
- * creates the session at pay time, so display and acceptance match.
3656
- */
3657
- paymentMethodTypes?: string[];
3658
- /** Either use mode or clientSecret when creating an Elements group. */
3659
- clientSecret?: never;
3660
- /** Appearance overrides for the checkout UI */
3661
- appearance?: Appearance;
3662
- /** Locale for the payment form — `"en"` (default) or `"ar"` */
3663
- locale?: "en" | "ar";
3664
- }
3665
- /**
3666
- * Options for creating an Elements instance — with a session's
3667
- * `clientSecret`, or session-less with `{ mode, amount, currency }`
3668
- * (deferred). The two forms are mutually exclusive.
3669
- */
3670
- type ElementsOptions = ElementsOptionsClientSecret | ElementsOptionsMode;
3671
- /** Options for `elements.update()` — deferred mode only. */
3672
- interface ElementsUpdateOptions {
3673
- /** New display amount in the currency's smallest unit. Integer, greater than zero. */
3674
- amount?: number;
3675
- /** New three-letter currency code. */
3676
- currency?: string;
3677
- }
3678
- /**
3679
- * Manages the lifecycle of the PaymentElement.
3680
- *
3681
- * A single Elements instance manages one embed iframe shared by all elements.
3682
- * Provides session management methods (promo codes, quantities, etc.) and
3683
- * element creation.
3684
- */
3685
- interface Elements {
3686
- /** Create a PaymentElement (full payment method selector + card form) */
3687
- create(type: "payment", options?: PaymentElementOptions): PaymentElement;
3688
- /** Get an existing element by type, or null if not created */
3689
- getElement(type: "payment"): PaymentElement | null;
3690
- /** Fetch available payment methods for this session */
3691
- fetchPaymentMethods(): Promise<PaymentMethodInfo[]>;
3692
- /**
3693
- * Listen for the `ready` event — fires when the session is loaded and elements can render.
3694
- * If the session is already loaded, the handler fires immediately.
3695
- */
3696
- on(event: "ready", handler: (data: ElementsReadyEvent) => void): void;
3697
- /** Listen for session data changes (payment method selection, promo codes, fee updates, etc.) */
3698
- on(event: "change", handler: (session: CheckoutSession) => void): void;
3699
- /** Listen for session load failures (network errors, invalid client secret, API errors) */
3700
- on(event: "loaderror", handler: (data: ElementsLoadErrorEvent) => void): void;
3701
- /** Listen for unsolicited errors not triggered by a merchant action (e.g. session expired during fee recalculation, BIN detection failure) */
3702
- on(event: "error", handler: (error: XPayError) => void): void;
3703
- /** Listen for a custom event */
3704
- on(event: string, handler: (...args: unknown[]) => void): void;
3705
- /** Remove an event handler */
3706
- off(event: string, handler: (...args: unknown[]) => void): void;
3707
- /** Apply a promotion code to the session */
3708
- applyPromotionCode(code: string): Promise<ActionResult>;
3709
- /** Remove the applied promotion code */
3710
- removePromotionCode(): Promise<ActionResult>;
3711
- /** Update a line item's quantity */
3712
- updateLineItemQuantity(args: {
3713
- lineItem: string;
3714
- quantity: number;
3715
- }): Promise<ActionResult>;
3716
- /** Validate all element fields before confirming — returns the selected payment method on success */
3717
- submit(): Promise<{
3718
- error?: XPayError;
3719
- selectedPaymentMethod?: string;
3720
- }>;
3721
- /** Re-fetch the session from the server to get the latest data */
3722
- fetchUpdates(): Promise<ActionResult>;
3723
- /** Update the appearance at runtime without recreating elements */
3724
- changeAppearance(appearance: Appearance): void;
3725
- /**
3726
- * Update the displayed amount/currency of a DEFERRED Elements instance
3727
- * (created with `{ mode: "payment" }`). Throws when the instance was
3728
- * created with a `clientSecret` — session amounts are server-owned.
3729
- */
3730
- update(options: ElementsUpdateOptions): Promise<void>;
3731
- /** Destroy the Elements instance and clean up all resources */
3732
- destroy(): void;
3733
- }
3734
- /** Fired when the session is loaded and elements are ready to render */
3735
- interface ElementsReadyEvent {
3736
- /** The loaded checkout session data */
3737
- session: CheckoutSession;
3738
- }
3739
- /** Fired when the session fails to load */
3740
- interface ElementsLoadErrorEvent {
3741
- /** Error category */
3742
- type: "invalid_request_error" | "api_error" | "network_error";
3743
- /** Human-readable error message */
3744
- message: string;
3745
- /** Machine-readable error code */
3746
- code?: string;
3747
- /** The parameter that caused the error */
3748
- param?: string;
3749
- /** Link to documentation about this error */
3750
- docUrl?: string;
3751
- }
3752
- /** Options for creating a PaymentElement */
3753
- interface PaymentElementOptions {
3754
- /**
3755
- * How the element presents the payment method chooser.
3756
- *
3757
- * - `"accordion"` (default): a vertical list, one row per method, the
3758
- * selected method's content expanding beneath its row. With exactly one
3759
- * method the chooser disappears: a single non-card method shows a static
3760
- * identity header (logo and name, no radio) above its content, while a
3761
- * single card method renders the bare card form, since its fields
3762
- * already identify it.
3763
- * - `"tabs"`: a grid of tiles that fills the row and wraps when the
3764
- * methods no longer fit, with the selected method's content below it.
3765
- * With exactly one method the tile grid disappears and
3766
- * only the content renders, for pages whose own UI already shows the
3767
- * method's logo and name (e.g. a per-gateway plugin row).
3768
- *
3769
- * Updatable after creation via `element.update({ layout })`.
3770
- */
3771
- layout?: "accordion" | "tabs";
3772
- /** Pre-select a specific payment method by type */
3773
- defaultPaymentMethod?: string;
3774
- /** Custom ordering of payment methods by type */
3775
- paymentMethodOrder?: string[];
3776
- }
3777
- /**
3778
- * Change event from a PaymentElement.
3779
- * Fires on payment method selection, card field changes, and session updates.
3780
- *
3781
- * @example
3782
- * ```tsx
3783
- * <PaymentElement
3784
- * onChange={(event) => {
3785
- * setPaymentReady(event.complete);
3786
- * console.log("Selected method:", event.value.type);
3787
- * }}
3788
- * />
3789
- * ```
3790
- */
3791
- interface PaymentElementChangeEvent {
3792
- elementType: "payment";
3793
- /** Whether all card fields are empty (no user input yet) */
3794
- empty: boolean;
3795
- /** Whether the form is complete and ready for submission */
3796
- complete: boolean;
3797
- /** Whether the payment method selector is collapsed (no method selected) */
3798
- collapsed: boolean;
3799
- /** The currently selected payment method */
3800
- value: {
3801
- type: string;
3802
- };
3803
- /** Full session data including updated amounts, fees, and discounts */
3804
- session: CheckoutSession;
3805
- }
3806
- /** Base interface shared by all element types */
3807
- interface BaseElement {
3808
- /** Mount the element into a DOM container (CSS selector or HTMLElement) */
3809
- mount(container: string | HTMLElement): void;
3810
- /** Unmount the element from the DOM (can be re-mounted later) */
3811
- unmount(): void;
3812
- /** Destroy the element and release all resources */
3813
- destroy(): void;
3814
- /** Programmatically focus the element's iframe */
3815
- focus(): void;
3816
- /** Programmatically blur the element's iframe */
3817
- blur(): void;
3818
- /** Fired when the element is mounted and the iframe content is ready */
3819
- on(event: "ready", handler: () => void): void;
3820
- /** Fired when the element's iframe starts loading */
3821
- on(event: "loaderstart", handler: () => void): void;
3822
- /** Fired when the element fails to load */
3823
- on(event: "loaderror", handler: (event: ElementsLoadErrorEvent) => void): void;
3824
- on(event: string, handler: (...args: unknown[]) => void): void;
3825
- off(event: string, handler: (...args: unknown[]) => void): void;
3826
- }
3827
- /**
3828
- * The subset of `PaymentElementOptions` that can be updated after creation
3829
- * (Stripe's `StripePaymentElementUpdateOptions` pattern). Only `layout` is
3830
- * updatable; `defaultPaymentMethod` and `paymentMethodOrder` are set at
3831
- * creation.
3832
- */
3833
- type PaymentElementUpdateOptions = Pick<PaymentElementOptions, "layout">;
3834
- /** PaymentElement — full payment method selector with card form */
3835
- interface PaymentElement extends BaseElement {
3836
- /** Collapse the payment method selector (deselect all methods) */
3837
- collapse(): void;
3838
- /** Update element options at runtime — see {@link PaymentElementUpdateOptions} */
3839
- update(options: PaymentElementUpdateOptions): void;
3840
- }
3841
- /**
3842
- * Options for `confirmPayment()` or `checkout.confirm()`.
3843
- *
3844
- * The `redirect` option controls what happens after a successful payment:
3845
- * - `"if_required"` (default) — returns the result to your code
3846
- * - `"always"` — always redirects to the session's own destination after payment
3847
- *
3848
- * The destination is never set here. It is the `afterCompletion.redirect.url` you gave
3849
- * when creating the checkout session, because the same address is handed to the
3850
- * customer's bank during verification — before the browser leaves your page. A value
3851
- * supplied from the page could only ever disagree with what the bank was already told.
3852
- *
3853
- * @example
3854
- * ```ts
3855
- * // Default: get the result back in code
3856
- * const result = await checkout.confirm({
3857
- * customerDetails: { email: "user@example.com" },
3858
- * });
3859
- *
3860
- * // Always redirect to the session's own destination after payment
3861
- * await checkout.confirm({ redirect: "always" });
3862
- * ```
3863
- */
3864
- interface ConfirmPaymentOptions {
3865
- /** The Elements instance managing the payment form */
3866
- elements: Elements;
3867
- /**
3868
- * DEFERRED mode only, and required there: the clientSecret of the checkout
3869
- * session your server just created with the final total. A plain string —
3870
- * await your own fetch before calling. The session's total must equal the
3871
- * amount the element displays, or the confirmation fails with
3872
- * `amount_reconfirmation_required` and nothing is charged. Ignored when the
3873
- * elements were created with a clientSecret.
3874
- */
3875
- clientSecret?: string;
3876
- /** Customer details collected by the merchant's form */
3877
- customerDetails?: CustomerDetails;
3878
- /** Custom field values for the session */
3879
- customFields?: Record<string, string | number | boolean>;
3880
- /** Device fingerprint for fraud detection */
3881
- deviceFingerprint?: {
3882
- visitorId: string;
3883
- confidence?: number;
3884
- };
3885
- /** Override the selected payment method type */
3886
- paymentMethod?: string;
3887
- /**
3888
- * Redirect behavior after payment.
3889
- * - `"if_required"` (default) — returns the result to your code; only redirects if the payment method requires it
3890
- * - `"always"` — always redirects to the session's `afterCompletion.redirect.url` after payment. The page navigates away and the function never returns on success.
3891
- */
3892
- redirect?: "if_required" | "always";
3893
- }
3894
- /**
3895
- * Options for creating a drop-in checkout instance.
3896
- *
3897
- * @example
3898
- * ```ts
3899
- * const checkout = xpay.checkout({
3900
- * clientSecret: "cs_test_abc_secret_xyz",
3901
- * mode: "modal",
3902
- * onComplete: (result) => console.log("Paid!", result.paymentIntentId),
3903
- * });
3904
- * checkout.open();
3905
- * ```
3906
- */
3907
- interface CheckoutOptions {
3908
- /** Client secret from a checkout session */
3909
- clientSecret: string;
3910
- /** Display mode — `"modal"` (overlay) or `"inline"` (embedded in page) */
3911
- mode?: "modal" | "inline";
3912
- /** Container for inline mode (CSS selector or HTMLElement) */
3913
- container?: string | HTMLElement;
3914
- /** Called when the payment completes successfully */
3915
- onComplete?: (result: CheckoutCompleteResult) => void;
3916
- /** Called when the checkout UI is closed */
3917
- onClose?: () => void;
3918
- /** Called when the session is loaded and the checkout is ready */
3919
- onReady?: (session: CheckoutSession) => void;
3920
- /** Called when the payment is confirmed (before final result) */
3921
- onConfirmed?: () => void;
3922
- /** Called when an error occurs */
3923
- onError?: (error: CheckoutError) => void;
3924
- /** Appearance overrides */
3925
- appearance?: Appearance;
3926
- /** Locale for the checkout UI */
3927
- locale?: "en" | "ar";
3928
- }
3929
- /** Drop-in checkout instance with lifecycle control */
3930
- interface CheckoutInstance {
3931
- /** Open the checkout modal (only for `mode: "modal"`) */
3932
- open(): void;
3933
- /** Close the checkout UI */
3934
- close(): void;
3935
- /** Destroy the checkout instance and clean up resources */
3936
- destroy(): void;
3937
- on(event: "complete", handler: (result: CheckoutCompleteResult) => void): void;
3938
- on(event: "close", handler: () => void): void;
3939
- on(event: "ready", handler: (session: CheckoutSession) => void): void;
3940
- on(event: "confirmed", handler: () => void): void;
3941
- on(event: "error", handler: (error: CheckoutError) => void): void;
3942
- off(event: string, handler: (...args: unknown[]) => void): void;
3943
- }
3944
- /** Result of a successful payment via drop-in checkout */
3945
- interface CheckoutCompleteResult {
3946
- status: "succeeded";
3947
- /**
3948
- * Whether the money has arrived. `paid` for cards and other instant methods.
3949
- * `unpaid` when the customer holds a reference they pay afterwards (Fawry): the
3950
- * checkout is over, but fulfil only on `checkout.session.async_payment_succeeded`.
3951
- */
3952
- paymentStatus: "paid" | "unpaid" | "no_payment_required";
3953
- /** The payment intent ID for server-side verification */
3954
- paymentIntentId: string;
3955
- /** The charge ID (if available) */
3956
- chargeId?: string;
3957
- /** Redirect URL from the session's afterCompletion settings */
3958
- redirectUrl?: string;
3959
- }
3960
- /** Error from the drop-in checkout */
3961
- interface CheckoutError {
3962
- /** Human-readable error message */
3963
- message: string;
3964
- /** Machine-readable error code */
3965
- code?: string;
3966
- }
3967
- /**
3968
- * Options for `initCheckout()` — the modern single-call API.
3969
- *
3970
- * @example
3971
- * ```ts
3972
- * const checkout = await xpay.initCheckout({
3973
- * clientSecret: "cs_test_abc_secret_xyz",
3974
- * });
3975
- * console.log(checkout.amountTotal);
3976
- * await checkout.confirm({ customerDetails: { email: "..." } });
3977
- * ```
3978
- */
3979
- interface InitCheckoutOptions {
3980
- /** Client secret from a checkout session (string or Promise) */
3981
- clientSecret: string | Promise<string>;
3982
- /** Appearance overrides */
3983
- appearance?: Appearance;
3984
- /** Locale for the payment form */
3985
- locale?: "en" | "ar";
3986
- }
3987
- /** Result of `initCheckout()` — session data merged with action methods */
3988
- type InitCheckoutResult = CheckoutSession & CheckoutActions;
3989
- /**
3990
- * Action methods available on the checkout object.
3991
- * These are merged with `CheckoutSession` to form the `Checkout` type.
3992
- */
3993
- interface CheckoutActions {
3994
- /**
3995
- * Confirm the payment.
3996
- *
3997
- * @param options - Customer details and redirect behavior
3998
- * @returns Action result with updated session on success, or an `XPayError`.
3999
- * With `redirect: "always"`, the page navigates away on success (never returns).
4000
- *
4001
- * @example
4002
- * ```ts
4003
- * const result = await checkout.confirm({
4004
- * customerDetails: { email: "user@example.com" },
4005
- * });
4006
- * if (result.type === "error") {
4007
- * console.error(result.error.message);
4008
- * }
4009
- * ```
4010
- */
4011
- confirm(options?: Omit<ConfirmPaymentOptions, "elements">): Promise<ActionResult>;
4012
- /** Apply a promotion code to the session */
4013
- applyPromotionCode(code: string): Promise<ActionResult>;
4014
- /** Remove the applied promotion code */
4015
- removePromotionCode(): Promise<ActionResult>;
4016
- /** Update a line item's quantity */
4017
- updateLineItemQuantity(args: {
4018
- lineItem: string;
4019
- quantity: number;
4020
- }): Promise<ActionResult>;
4021
- /** Validate all fields before confirming — returns the selected payment method on success */
4022
- submit(): Promise<{
4023
- error?: XPayError;
4024
- selectedPaymentMethod?: string;
4025
- }>;
4026
- /** Re-fetch the session from the server */
4027
- fetchUpdates(): Promise<ActionResult>;
4028
- /** Update the appearance at runtime */
4029
- changeAppearance(appearance: Appearance): void;
4030
- /** Listen for session data changes */
4031
- on(event: "change", handler: (session: CheckoutSession) => void): void;
4032
- /** Listen for unsolicited errors (e.g. session expired during internal updates) */
4033
- on(event: "error", handler: (error: XPayError) => void): void;
4034
- /** Listen for a custom event */
4035
- on(event: string, handler: (...args: unknown[]) => void): void;
4036
- /** Access the underlying Elements instance for element creation */
4037
- getElements(): Elements;
4038
- }
4039
- /** Customer details collected by the merchant's form */
4040
- interface CustomerDetails {
4041
- /** Customer email address */
4042
- email?: string;
4043
- /** Customer full name */
4044
- name?: string;
4045
- /** Customer phone number */
4046
- phone?: string;
4047
- /** Billing details for the payment */
4048
- billingDetails?: {
4049
- name?: string;
4050
- email?: string;
4051
- phone?: string;
4052
- address?: Address;
4053
- };
4054
- /** Shipping details */
4055
- shipping?: {
4056
- name?: string;
4057
- phone?: string;
4058
- address?: Address;
4059
- };
4060
- }
4061
- /** Physical address */
4062
- interface Address {
4063
- line1?: string;
4064
- line2?: string;
4065
- city?: string;
4066
- state?: string;
4067
- postalCode?: string;
4068
- country?: string;
4069
- }
4070
-
4071
- /**
4072
- * @xpayeg/sdk — XPay JavaScript SDK Loader
4073
- *
4074
- * Loads the XPay SDK runtime from CDN and provides TypeScript types.
4075
- *
4076
- * Usage:
4077
- * import { loadXPay } from '@xpayeg/sdk';
4078
- *
4079
- * const xpay = await loadXPay('pk_test_xxx');
4080
- * const elements = xpay.elements({ clientSecret: '...' });
4081
- */
4082
-
4083
- type XPayFactory = (publishableKey: string) => XPayInstance;
4084
- declare global {
4085
- interface Window {
4086
- XPay?: XPayFactory;
4087
- }
4088
- }
4089
- /**
4090
- * Load the XPay SDK from CDN.
4091
- *
4092
- * Returns a promise that resolves to an XPayInstance with full TypeScript support.
4093
- * The SDK script is loaded once and cached — subsequent calls return the same instance.
4094
- *
4095
- * @param publishableKey - Your publishable API key (pk_test_... or pk_live_...)
4096
- *
4097
- * @example
4098
- * ```typescript
4099
- * import { loadXPay } from '@xpayeg/sdk';
4100
- *
4101
- * const xpay = await loadXPay('pk_test_xxx');
4102
- * const elements = xpay.elements({ clientSecret: 'cs_test_abc_secret_xyz' });
4103
- * ```
4104
- */
4105
- declare function loadXPay(publishableKey: string): Promise<XPayInstance | null>;
4106
-
4107
- export { loadXPay };
4108
- export type { ActionResult, Address, Appearance, BaseElement, CheckoutActions, CheckoutCompleteResult, DiscountResponseDto as CheckoutDiscount, CheckoutError, FeesResponseDto as CheckoutFees, CheckoutInstance, LineItemDto as CheckoutLineItem, CheckoutOptions, CheckoutSession, TotalDetailsResponseDto as CheckoutTotalDetails, ConfirmPaymentOptions, CustomerDetails, Elements, ElementsLoadErrorEvent, ElementsOptions, ElementsOptionsClientSecret, ElementsOptionsMode, ElementsReadyEvent, ElementsUpdateOptions, InitCheckoutOptions, InitCheckoutResult, PaymentElement, PaymentElementChangeEvent, PaymentElementOptions, PaymentMethodInfo, SessionStatus, XPayError, XPayInstance };