@xpayeg/sdk 1.0.1 → 2.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/CHANGELOG.md +34 -0
- package/README.md +3 -11
- package/dist/index.d.cts +169 -15
- package/dist/index.d.mts +169 -15
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
# @xpayeg/sdk
|
|
2
2
|
|
|
3
|
+
## 2.1.0
|
|
4
|
+
### Minor Changes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- [#224](https://github.com/xpayeg/xpay/pull/224) [`40beff5`](https://github.com/xpayeg/xpay/commit/40beff5ee4660914dff5c0f7c43480083bf331c4) Thanks [@mariamkamel](https://github.com/mariamkamel)! - `CheckoutCompleteResult` (drop-in `onComplete`) and the `session` in `confirmPayment()`'s success result now carry `paymentStatus`. Methods the customer pays afterwards, such as Fawry, complete checkout as `unpaid` and are paid later. Fulfil on `paymentStatus: "paid"`, never on completion alone.
|
|
9
|
+
|
|
10
|
+
Drop-in `onError` now fires when an attempt fails (declined, canceled, processing error) and when the session is expired or already complete on load. The modal unlocks after a failed attempt so the customer can close it; previously it stayed locked until a successful payment.
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
- [#453](https://github.com/xpayeg/xpay/pull/453) [`5445718`](https://github.com/xpayeg/xpay/commit/5445718b5027cba56f1d645cba6f42904d2c2f2c) Thanks [@Elmosh](https://github.com/Elmosh)! - `@xpayeg/react` now declares its `@xpayeg/sdk` peer dependency as `^2.0.0` instead of an exact pinned version, so the two packages no longer have to be upgraded in lockstep within a major.
|
|
17
|
+
|
|
18
|
+
## 2.0.0
|
|
19
|
+
### Major Changes
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- [#331](https://github.com/xpayeg/xpay/pull/331) [`bdc6a48`](https://github.com/xpayeg/xpay/commit/bdc6a4865f8c0326a4c0eb3dd20808e1207d682a) Thanks [@Elmosh](https://github.com/Elmosh)! - **Breaking:** `returnUrl` is removed from `confirmPayment()` options. The return destination is always the checkout session's `afterCompletion.redirect.url`, set server-side at session creation.
|
|
24
|
+
|
|
25
|
+
The URL is sent to the bank during authentication, before the browser leaves your page, so a value passed at confirm time could only ever conflict with what the bank already received. Delete `returnUrl` from `confirmPayment()` and set `afterCompletion.redirect.url` on `createSession`. `redirect: "always"` now follows that destination.
|
|
26
|
+
|
|
27
|
+
**Breaking:** `afterCompletion` is now required for `uiMode: "embedded"` and `uiMode: "custom"`, and must be `type: "redirect"`. That URL is where the bank returns when authentication takes over the full page, which happens in in-app browsers where an embedded challenge cannot run. `hosted_confirmation` is rejected for these modes since those integrations run on your own site and there is no XPay page to return to.
|
|
28
|
+
|
|
29
|
+
Also fixed: the 3DS challenge now renders at the size declared to the issuer (previously cropped or oversized), the overlay waits for the issuer's page to paint instead of showing an empty frame, and a challenge that cannot run in an iframe takes over the full tab instead of failing silently.
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- [#333](https://github.com/xpayeg/xpay/pull/333) [`3dcea81`](https://github.com/xpayeg/xpay/commit/3dcea81b3e3f67267624105560c38f2615c35d96) Thanks [@Elmosh](https://github.com/Elmosh)! - Documentation: the `redirect: "always"` tables and examples now state that the destination is the checkout session's `afterCompletion.redirect.url`, set server-side at session creation.
|
|
36
|
+
|
|
3
37
|
## 1.0.1
|
|
4
38
|
### Patch Changes
|
|
5
39
|
|
package/README.md
CHANGED
|
@@ -231,18 +231,10 @@ await checkout.confirm({
|
|
|
231
231
|
| `redirect` | Behavior |
|
|
232
232
|
|---|---|
|
|
233
233
|
| Not set (default) | `"if_required"` — returns result to your code |
|
|
234
|
-
| `"always"` | Redirects to
|
|
234
|
+
| `"always"` | Redirects to the session's `afterCompletion.redirect.url` |
|
|
235
235
|
| `"if_required"` | Returns result to your code — no redirect |
|
|
236
236
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
```javascript
|
|
240
|
-
await checkout.confirm({
|
|
241
|
-
customerDetails: { email, name },
|
|
242
|
-
redirect: 'always',
|
|
243
|
-
returnUrl: 'https://mysite.com/custom-success', // Overrides server URL
|
|
244
|
-
});
|
|
245
|
-
```
|
|
237
|
+
Your server sets that URL when it creates the session. XPay navigates there unchanged, appending nothing.
|
|
246
238
|
|
|
247
239
|
### Pre-validation with `submit()`
|
|
248
240
|
|
|
@@ -466,7 +458,7 @@ elements.changeAppearance({ colorMode: 'light' });
|
|
|
466
458
|
|
|
467
459
|
## API Reference
|
|
468
460
|
|
|
469
|
-
### `loadXPay(publishableKey
|
|
461
|
+
### `loadXPay(publishableKey)`
|
|
470
462
|
|
|
471
463
|
Loads the XPay SDK from CDN. Returns a Promise. Call at module level, not inside components.
|
|
472
464
|
|
package/dist/index.d.cts
CHANGED
|
@@ -749,7 +749,11 @@ interface ChargeCardDetailsDto {
|
|
|
749
749
|
expYear: number;
|
|
750
750
|
funding: string;
|
|
751
751
|
last4: string;
|
|
752
|
-
|
|
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;
|
|
753
757
|
/** Card fingerprint for identifying the same card across customers */
|
|
754
758
|
fingerprint: string;
|
|
755
759
|
threeDSecure: ThreeDSecureDto;
|
|
@@ -903,6 +907,55 @@ interface ValuDetailsDto {
|
|
|
903
907
|
*/
|
|
904
908
|
type PaymentMethodDetailsDtoValu = ValuDetailsDto | null;
|
|
905
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
|
+
|
|
906
959
|
/**
|
|
907
960
|
* Generated by orval v7.21.0 🍺
|
|
908
961
|
* Do not edit manually.
|
|
@@ -921,6 +974,11 @@ interface PaymentMethodDetailsDto {
|
|
|
921
974
|
* @nullable
|
|
922
975
|
*/
|
|
923
976
|
valu?: PaymentMethodDetailsDtoValu;
|
|
977
|
+
/**
|
|
978
|
+
* Fawry details (if type is 'fawry')
|
|
979
|
+
* @nullable
|
|
980
|
+
*/
|
|
981
|
+
fawry?: PaymentMethodDetailsDtoFawry;
|
|
924
982
|
}
|
|
925
983
|
|
|
926
984
|
/**
|
|
@@ -1238,6 +1296,10 @@ interface RefundResponseDto {
|
|
|
1238
1296
|
reason?: RefundResponseDtoReason;
|
|
1239
1297
|
/** Reason for refund failure */
|
|
1240
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;
|
|
1241
1303
|
/** Reason for pending status */
|
|
1242
1304
|
pendingReason?: RefundResponseDtoPendingReason;
|
|
1243
1305
|
/** Description for non-card refunds */
|
|
@@ -1347,6 +1409,16 @@ interface ChargeResponseDto {
|
|
|
1347
1409
|
config: ChargeConfigDto;
|
|
1348
1410
|
geocoding?: ChargeGeocodingDto;
|
|
1349
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;
|
|
1350
1422
|
processorCapabilities?: ProcessorCapabilitiesDto;
|
|
1351
1423
|
/**
|
|
1352
1424
|
* ID of the currently-active risk hold on this charge, if any
|
|
@@ -1507,7 +1579,7 @@ declare const CheckoutSessionResponseDtoCustomerCreation: {
|
|
|
1507
1579
|
* OpenAPI spec version: 1.0
|
|
1508
1580
|
*/
|
|
1509
1581
|
/**
|
|
1510
|
-
*
|
|
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.
|
|
1511
1583
|
*/
|
|
1512
1584
|
type CheckoutSessionResponseDtoStatus = typeof CheckoutSessionResponseDtoStatus[keyof typeof CheckoutSessionResponseDtoStatus];
|
|
1513
1585
|
declare const CheckoutSessionResponseDtoStatus: {
|
|
@@ -1524,7 +1596,7 @@ declare const CheckoutSessionResponseDtoStatus: {
|
|
|
1524
1596
|
* OpenAPI spec version: 1.0
|
|
1525
1597
|
*/
|
|
1526
1598
|
/**
|
|
1527
|
-
*
|
|
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.
|
|
1528
1600
|
*/
|
|
1529
1601
|
type CheckoutSessionResponseDtoPaymentStatus = typeof CheckoutSessionResponseDtoPaymentStatus[keyof typeof CheckoutSessionResponseDtoPaymentStatus];
|
|
1530
1602
|
declare const CheckoutSessionResponseDtoPaymentStatus: {
|
|
@@ -1914,6 +1986,20 @@ type PaymentMethodObjectDtoCard = PaymentMethodCardDto | null;
|
|
|
1914
1986
|
*/
|
|
1915
1987
|
type PaymentMethodObjectDtoValu = ValuDetailsDto | null;
|
|
1916
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
|
+
|
|
1917
2003
|
/**
|
|
1918
2004
|
* Generated by orval v7.21.0 🍺
|
|
1919
2005
|
* Do not edit manually.
|
|
@@ -1960,6 +2046,11 @@ interface PaymentMethodObjectDto {
|
|
|
1960
2046
|
* @nullable
|
|
1961
2047
|
*/
|
|
1962
2048
|
valu?: PaymentMethodObjectDtoValu;
|
|
2049
|
+
/**
|
|
2050
|
+
* Fawry details (if type is 'fawry')
|
|
2051
|
+
* @nullable
|
|
2052
|
+
*/
|
|
2053
|
+
fawry?: PaymentMethodObjectDtoFawry;
|
|
1963
2054
|
billingDetails: BillingDetailsDto;
|
|
1964
2055
|
type: PaymentMethodObjectDtoType;
|
|
1965
2056
|
/** Created timestamp (ISO 8601) */
|
|
@@ -2052,6 +2143,49 @@ interface NextActionRedirectDto {
|
|
|
2052
2143
|
*/
|
|
2053
2144
|
type NextActionDetailDtoRedirectToUrl = NextActionRedirectDto | null;
|
|
2054
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
|
+
|
|
2055
2189
|
/**
|
|
2056
2190
|
* Generated by orval v7.21.0 🍺
|
|
2057
2191
|
* Do not edit manually.
|
|
@@ -2061,13 +2195,18 @@ type NextActionDetailDtoRedirectToUrl = NextActionRedirectDto | null;
|
|
|
2061
2195
|
*/
|
|
2062
2196
|
|
|
2063
2197
|
interface NextActionDetailDto {
|
|
2064
|
-
/** Kind of action the customer must take next
|
|
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). */
|
|
2065
2199
|
type: string;
|
|
2066
2200
|
/**
|
|
2067
2201
|
* Redirect details when `type` is `redirect_to_url`. `null` for any other action type.
|
|
2068
2202
|
* @nullable
|
|
2069
2203
|
*/
|
|
2070
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;
|
|
2071
2210
|
}
|
|
2072
2211
|
|
|
2073
2212
|
/**
|
|
@@ -3134,9 +3273,9 @@ interface CheckoutSessionResponseDto {
|
|
|
3134
3273
|
submitType: CheckoutSessionResponseDtoSubmitType;
|
|
3135
3274
|
/** Customer creation mode */
|
|
3136
3275
|
customerCreation: CheckoutSessionResponseDtoCustomerCreation;
|
|
3137
|
-
/**
|
|
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. */
|
|
3138
3277
|
status: CheckoutSessionResponseDtoStatus;
|
|
3139
|
-
/**
|
|
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. */
|
|
3140
3279
|
paymentStatus: CheckoutSessionResponseDtoPaymentStatus;
|
|
3141
3280
|
/** Currency code (ISO 4217) */
|
|
3142
3281
|
currency?: CheckoutSessionResponseDtoCurrency;
|
|
@@ -3158,6 +3297,8 @@ interface CheckoutSessionResponseDto {
|
|
|
3158
3297
|
clientSecret?: string;
|
|
3159
3298
|
/** Expiration timestamp (ISO 8601) */
|
|
3160
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;
|
|
3161
3302
|
/** Customer ID (when existing customer linked) */
|
|
3162
3303
|
customerId?: string;
|
|
3163
3304
|
/** Customer object (when customerId is provided). Contains existing customer data for prefill. */
|
|
@@ -3273,6 +3414,13 @@ type Appearance = Pick<BrandingSettingsResponseDto, "colorMode" | "borderStyle"
|
|
|
3273
3414
|
* }
|
|
3274
3415
|
* ```
|
|
3275
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
|
+
*/
|
|
3276
3424
|
type SessionStatus = {
|
|
3277
3425
|
type: "open";
|
|
3278
3426
|
} | {
|
|
@@ -3594,7 +3742,12 @@ interface PaymentElement extends BaseElement {
|
|
|
3594
3742
|
*
|
|
3595
3743
|
* The `redirect` option controls what happens after a successful payment:
|
|
3596
3744
|
* - `"if_required"` (default) — returns the result to your code
|
|
3597
|
-
* - `"always"` — always redirects to
|
|
3745
|
+
* - `"always"` — always redirects to the session's own destination after payment
|
|
3746
|
+
*
|
|
3747
|
+
* The destination is never set here. It is the `afterCompletion.redirect.url` you gave
|
|
3748
|
+
* when creating the checkout session, because the same address is handed to the
|
|
3749
|
+
* customer's bank during verification — before the browser leaves your page. A value
|
|
3750
|
+
* supplied from the page could only ever disagree with what the bank was already told.
|
|
3598
3751
|
*
|
|
3599
3752
|
* @example
|
|
3600
3753
|
* ```ts
|
|
@@ -3603,11 +3756,8 @@ interface PaymentElement extends BaseElement {
|
|
|
3603
3756
|
* customerDetails: { email: "user@example.com" },
|
|
3604
3757
|
* });
|
|
3605
3758
|
*
|
|
3606
|
-
* // Always redirect after payment
|
|
3607
|
-
* await checkout.confirm({
|
|
3608
|
-
* redirect: "always",
|
|
3609
|
-
* returnUrl: "https://merchant.com/success",
|
|
3610
|
-
* });
|
|
3759
|
+
* // Always redirect to the session's own destination after payment
|
|
3760
|
+
* await checkout.confirm({ redirect: "always" });
|
|
3611
3761
|
* ```
|
|
3612
3762
|
*/
|
|
3613
3763
|
interface ConfirmPaymentOptions {
|
|
@@ -3627,11 +3777,9 @@ interface ConfirmPaymentOptions {
|
|
|
3627
3777
|
/**
|
|
3628
3778
|
* Redirect behavior after payment.
|
|
3629
3779
|
* - `"if_required"` (default) — returns the result to your code; only redirects if the payment method requires it
|
|
3630
|
-
* - `"always"` — always redirects to `
|
|
3780
|
+
* - `"always"` — always redirects to the session's `afterCompletion.redirect.url` after payment. The page navigates away and the function never returns on success.
|
|
3631
3781
|
*/
|
|
3632
3782
|
redirect?: "if_required" | "always";
|
|
3633
|
-
/** URL to redirect to after payment. Overrides the session's `afterCompletion.redirect.url`. Only needed if you want a different URL than the one set server-side. */
|
|
3634
|
-
returnUrl?: string;
|
|
3635
3783
|
}
|
|
3636
3784
|
/**
|
|
3637
3785
|
* Options for creating a drop-in checkout instance.
|
|
@@ -3686,6 +3834,12 @@ interface CheckoutInstance {
|
|
|
3686
3834
|
/** Result of a successful payment via drop-in checkout */
|
|
3687
3835
|
interface CheckoutCompleteResult {
|
|
3688
3836
|
status: "succeeded";
|
|
3837
|
+
/**
|
|
3838
|
+
* Whether the money has arrived. `paid` for cards and other instant methods.
|
|
3839
|
+
* `unpaid` when the customer holds a reference they pay afterwards (Fawry): the
|
|
3840
|
+
* checkout is over, but fulfil only on `checkout.session.async_payment_succeeded`.
|
|
3841
|
+
*/
|
|
3842
|
+
paymentStatus: "paid" | "unpaid" | "no_payment_required";
|
|
3689
3843
|
/** The payment intent ID for server-side verification */
|
|
3690
3844
|
paymentIntentId: string;
|
|
3691
3845
|
/** The charge ID (if available) */
|
package/dist/index.d.mts
CHANGED
|
@@ -749,7 +749,11 @@ interface ChargeCardDetailsDto {
|
|
|
749
749
|
expYear: number;
|
|
750
750
|
funding: string;
|
|
751
751
|
last4: string;
|
|
752
|
-
|
|
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;
|
|
753
757
|
/** Card fingerprint for identifying the same card across customers */
|
|
754
758
|
fingerprint: string;
|
|
755
759
|
threeDSecure: ThreeDSecureDto;
|
|
@@ -903,6 +907,55 @@ interface ValuDetailsDto {
|
|
|
903
907
|
*/
|
|
904
908
|
type PaymentMethodDetailsDtoValu = ValuDetailsDto | null;
|
|
905
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
|
+
|
|
906
959
|
/**
|
|
907
960
|
* Generated by orval v7.21.0 🍺
|
|
908
961
|
* Do not edit manually.
|
|
@@ -921,6 +974,11 @@ interface PaymentMethodDetailsDto {
|
|
|
921
974
|
* @nullable
|
|
922
975
|
*/
|
|
923
976
|
valu?: PaymentMethodDetailsDtoValu;
|
|
977
|
+
/**
|
|
978
|
+
* Fawry details (if type is 'fawry')
|
|
979
|
+
* @nullable
|
|
980
|
+
*/
|
|
981
|
+
fawry?: PaymentMethodDetailsDtoFawry;
|
|
924
982
|
}
|
|
925
983
|
|
|
926
984
|
/**
|
|
@@ -1238,6 +1296,10 @@ interface RefundResponseDto {
|
|
|
1238
1296
|
reason?: RefundResponseDtoReason;
|
|
1239
1297
|
/** Reason for refund failure */
|
|
1240
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;
|
|
1241
1303
|
/** Reason for pending status */
|
|
1242
1304
|
pendingReason?: RefundResponseDtoPendingReason;
|
|
1243
1305
|
/** Description for non-card refunds */
|
|
@@ -1347,6 +1409,16 @@ interface ChargeResponseDto {
|
|
|
1347
1409
|
config: ChargeConfigDto;
|
|
1348
1410
|
geocoding?: ChargeGeocodingDto;
|
|
1349
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;
|
|
1350
1422
|
processorCapabilities?: ProcessorCapabilitiesDto;
|
|
1351
1423
|
/**
|
|
1352
1424
|
* ID of the currently-active risk hold on this charge, if any
|
|
@@ -1507,7 +1579,7 @@ declare const CheckoutSessionResponseDtoCustomerCreation: {
|
|
|
1507
1579
|
* OpenAPI spec version: 1.0
|
|
1508
1580
|
*/
|
|
1509
1581
|
/**
|
|
1510
|
-
*
|
|
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.
|
|
1511
1583
|
*/
|
|
1512
1584
|
type CheckoutSessionResponseDtoStatus = typeof CheckoutSessionResponseDtoStatus[keyof typeof CheckoutSessionResponseDtoStatus];
|
|
1513
1585
|
declare const CheckoutSessionResponseDtoStatus: {
|
|
@@ -1524,7 +1596,7 @@ declare const CheckoutSessionResponseDtoStatus: {
|
|
|
1524
1596
|
* OpenAPI spec version: 1.0
|
|
1525
1597
|
*/
|
|
1526
1598
|
/**
|
|
1527
|
-
*
|
|
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.
|
|
1528
1600
|
*/
|
|
1529
1601
|
type CheckoutSessionResponseDtoPaymentStatus = typeof CheckoutSessionResponseDtoPaymentStatus[keyof typeof CheckoutSessionResponseDtoPaymentStatus];
|
|
1530
1602
|
declare const CheckoutSessionResponseDtoPaymentStatus: {
|
|
@@ -1914,6 +1986,20 @@ type PaymentMethodObjectDtoCard = PaymentMethodCardDto | null;
|
|
|
1914
1986
|
*/
|
|
1915
1987
|
type PaymentMethodObjectDtoValu = ValuDetailsDto | null;
|
|
1916
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
|
+
|
|
1917
2003
|
/**
|
|
1918
2004
|
* Generated by orval v7.21.0 🍺
|
|
1919
2005
|
* Do not edit manually.
|
|
@@ -1960,6 +2046,11 @@ interface PaymentMethodObjectDto {
|
|
|
1960
2046
|
* @nullable
|
|
1961
2047
|
*/
|
|
1962
2048
|
valu?: PaymentMethodObjectDtoValu;
|
|
2049
|
+
/**
|
|
2050
|
+
* Fawry details (if type is 'fawry')
|
|
2051
|
+
* @nullable
|
|
2052
|
+
*/
|
|
2053
|
+
fawry?: PaymentMethodObjectDtoFawry;
|
|
1963
2054
|
billingDetails: BillingDetailsDto;
|
|
1964
2055
|
type: PaymentMethodObjectDtoType;
|
|
1965
2056
|
/** Created timestamp (ISO 8601) */
|
|
@@ -2052,6 +2143,49 @@ interface NextActionRedirectDto {
|
|
|
2052
2143
|
*/
|
|
2053
2144
|
type NextActionDetailDtoRedirectToUrl = NextActionRedirectDto | null;
|
|
2054
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
|
+
|
|
2055
2189
|
/**
|
|
2056
2190
|
* Generated by orval v7.21.0 🍺
|
|
2057
2191
|
* Do not edit manually.
|
|
@@ -2061,13 +2195,18 @@ type NextActionDetailDtoRedirectToUrl = NextActionRedirectDto | null;
|
|
|
2061
2195
|
*/
|
|
2062
2196
|
|
|
2063
2197
|
interface NextActionDetailDto {
|
|
2064
|
-
/** Kind of action the customer must take next
|
|
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). */
|
|
2065
2199
|
type: string;
|
|
2066
2200
|
/**
|
|
2067
2201
|
* Redirect details when `type` is `redirect_to_url`. `null` for any other action type.
|
|
2068
2202
|
* @nullable
|
|
2069
2203
|
*/
|
|
2070
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;
|
|
2071
2210
|
}
|
|
2072
2211
|
|
|
2073
2212
|
/**
|
|
@@ -3134,9 +3273,9 @@ interface CheckoutSessionResponseDto {
|
|
|
3134
3273
|
submitType: CheckoutSessionResponseDtoSubmitType;
|
|
3135
3274
|
/** Customer creation mode */
|
|
3136
3275
|
customerCreation: CheckoutSessionResponseDtoCustomerCreation;
|
|
3137
|
-
/**
|
|
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. */
|
|
3138
3277
|
status: CheckoutSessionResponseDtoStatus;
|
|
3139
|
-
/**
|
|
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. */
|
|
3140
3279
|
paymentStatus: CheckoutSessionResponseDtoPaymentStatus;
|
|
3141
3280
|
/** Currency code (ISO 4217) */
|
|
3142
3281
|
currency?: CheckoutSessionResponseDtoCurrency;
|
|
@@ -3158,6 +3297,8 @@ interface CheckoutSessionResponseDto {
|
|
|
3158
3297
|
clientSecret?: string;
|
|
3159
3298
|
/** Expiration timestamp (ISO 8601) */
|
|
3160
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;
|
|
3161
3302
|
/** Customer ID (when existing customer linked) */
|
|
3162
3303
|
customerId?: string;
|
|
3163
3304
|
/** Customer object (when customerId is provided). Contains existing customer data for prefill. */
|
|
@@ -3273,6 +3414,13 @@ type Appearance = Pick<BrandingSettingsResponseDto, "colorMode" | "borderStyle"
|
|
|
3273
3414
|
* }
|
|
3274
3415
|
* ```
|
|
3275
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
|
+
*/
|
|
3276
3424
|
type SessionStatus = {
|
|
3277
3425
|
type: "open";
|
|
3278
3426
|
} | {
|
|
@@ -3594,7 +3742,12 @@ interface PaymentElement extends BaseElement {
|
|
|
3594
3742
|
*
|
|
3595
3743
|
* The `redirect` option controls what happens after a successful payment:
|
|
3596
3744
|
* - `"if_required"` (default) — returns the result to your code
|
|
3597
|
-
* - `"always"` — always redirects to
|
|
3745
|
+
* - `"always"` — always redirects to the session's own destination after payment
|
|
3746
|
+
*
|
|
3747
|
+
* The destination is never set here. It is the `afterCompletion.redirect.url` you gave
|
|
3748
|
+
* when creating the checkout session, because the same address is handed to the
|
|
3749
|
+
* customer's bank during verification — before the browser leaves your page. A value
|
|
3750
|
+
* supplied from the page could only ever disagree with what the bank was already told.
|
|
3598
3751
|
*
|
|
3599
3752
|
* @example
|
|
3600
3753
|
* ```ts
|
|
@@ -3603,11 +3756,8 @@ interface PaymentElement extends BaseElement {
|
|
|
3603
3756
|
* customerDetails: { email: "user@example.com" },
|
|
3604
3757
|
* });
|
|
3605
3758
|
*
|
|
3606
|
-
* // Always redirect after payment
|
|
3607
|
-
* await checkout.confirm({
|
|
3608
|
-
* redirect: "always",
|
|
3609
|
-
* returnUrl: "https://merchant.com/success",
|
|
3610
|
-
* });
|
|
3759
|
+
* // Always redirect to the session's own destination after payment
|
|
3760
|
+
* await checkout.confirm({ redirect: "always" });
|
|
3611
3761
|
* ```
|
|
3612
3762
|
*/
|
|
3613
3763
|
interface ConfirmPaymentOptions {
|
|
@@ -3627,11 +3777,9 @@ interface ConfirmPaymentOptions {
|
|
|
3627
3777
|
/**
|
|
3628
3778
|
* Redirect behavior after payment.
|
|
3629
3779
|
* - `"if_required"` (default) — returns the result to your code; only redirects if the payment method requires it
|
|
3630
|
-
* - `"always"` — always redirects to `
|
|
3780
|
+
* - `"always"` — always redirects to the session's `afterCompletion.redirect.url` after payment. The page navigates away and the function never returns on success.
|
|
3631
3781
|
*/
|
|
3632
3782
|
redirect?: "if_required" | "always";
|
|
3633
|
-
/** URL to redirect to after payment. Overrides the session's `afterCompletion.redirect.url`. Only needed if you want a different URL than the one set server-side. */
|
|
3634
|
-
returnUrl?: string;
|
|
3635
3783
|
}
|
|
3636
3784
|
/**
|
|
3637
3785
|
* Options for creating a drop-in checkout instance.
|
|
@@ -3686,6 +3834,12 @@ interface CheckoutInstance {
|
|
|
3686
3834
|
/** Result of a successful payment via drop-in checkout */
|
|
3687
3835
|
interface CheckoutCompleteResult {
|
|
3688
3836
|
status: "succeeded";
|
|
3837
|
+
/**
|
|
3838
|
+
* Whether the money has arrived. `paid` for cards and other instant methods.
|
|
3839
|
+
* `unpaid` when the customer holds a reference they pay afterwards (Fawry): the
|
|
3840
|
+
* checkout is over, but fulfil only on `checkout.session.async_payment_succeeded`.
|
|
3841
|
+
*/
|
|
3842
|
+
paymentStatus: "paid" | "unpaid" | "no_payment_required";
|
|
3689
3843
|
/** The payment intent ID for server-side verification */
|
|
3690
3844
|
paymentIntentId: string;
|
|
3691
3845
|
/** The charge ID (if available) */
|