@flopay/shared 1.4.19 → 1.4.21
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/README.md +8 -3
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +148 -7
- package/dist/index.d.ts +148 -7
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -193,6 +193,60 @@ interface LineItem {
|
|
|
193
193
|
}
|
|
194
194
|
/** Checkout mode controlling the payment UI behavior. */
|
|
195
195
|
type CheckoutMode = 'full' | 'auto' | 'confirm';
|
|
196
|
+
/**
|
|
197
|
+
* Checkout mode reported by a session read. `setup` is read-only in the
|
|
198
|
+
* browser SDK: merchant-authenticated setup-session creation stays on the
|
|
199
|
+
* merchant's server, while the existing create parameter types intentionally
|
|
200
|
+
* continue to accept only {@link CheckoutMode}.
|
|
201
|
+
*/
|
|
202
|
+
type CheckoutSessionMode = CheckoutMode | 'setup';
|
|
203
|
+
/** Whether checkout captures immediately or only authorises funds for later capture. */
|
|
204
|
+
type CaptureMethod = 'automatic' | 'manual';
|
|
205
|
+
/** Stable, provider-neutral authorization lifecycle failures exposed by the SDK. */
|
|
206
|
+
type CheckoutFailureOutcome = 'authorization_declined' | 'authentication_required' | 'authorization_expired' | 'capture_failed';
|
|
207
|
+
/** Lifecycle states returned by the merchant-scoped saved-method list. */
|
|
208
|
+
type SavedPaymentMethodStatus = 'pending' | 'active' | 'deleted';
|
|
209
|
+
/**
|
|
210
|
+
* Display-only card fields safe to show to a customer. This deliberately has
|
|
211
|
+
* no provider payment-method id, vault token, capture reference, or reusable
|
|
212
|
+
* credential.
|
|
213
|
+
*/
|
|
214
|
+
interface SavedCardDisplay {
|
|
215
|
+
/** FloPay payment-method UUID. */
|
|
216
|
+
id: string;
|
|
217
|
+
brand: string;
|
|
218
|
+
lastFour: string;
|
|
219
|
+
expiryMonth: number;
|
|
220
|
+
expiryYear: number;
|
|
221
|
+
status: SavedPaymentMethodStatus;
|
|
222
|
+
}
|
|
223
|
+
/** Stable conflicts returned by `DELETE /v1/payment-methods/:id`. */
|
|
224
|
+
type PaymentMethodRemovalConflictCode = 'payment_method_has_active_payment' | 'payment_method_in_use' | 'payment_method_reassignment_requires_payer_action';
|
|
225
|
+
/** Indistinguishable missing-or-inaccessible saved-method response. */
|
|
226
|
+
interface PaymentMethodRemovalNotFoundError {
|
|
227
|
+
statusCode: 404;
|
|
228
|
+
code: 'payment_method_not_found';
|
|
229
|
+
message?: string;
|
|
230
|
+
}
|
|
231
|
+
/** A blocked removal that requires merchant/customer guidance. */
|
|
232
|
+
interface PaymentMethodRemovalConflictError {
|
|
233
|
+
statusCode: 409;
|
|
234
|
+
code: PaymentMethodRemovalConflictCode;
|
|
235
|
+
message?: string;
|
|
236
|
+
}
|
|
237
|
+
/** Provider-neutral reason accompanying a retry-safe removal failure. */
|
|
238
|
+
type PaymentMethodRemovalFailureReason = 'payment_method_data_incomplete' | 'provider_cleanup_failed' | 'provider_unavailable' | 'provider_verification_failed';
|
|
239
|
+
/** Retry-safe incomplete provider/vault cleanup response. */
|
|
240
|
+
interface PaymentMethodRemovalRetryableError {
|
|
241
|
+
statusCode: 502;
|
|
242
|
+
code: 'payment_method_deletion_failed';
|
|
243
|
+
reason: PaymentMethodRemovalFailureReason;
|
|
244
|
+
retrySafe: true;
|
|
245
|
+
resolution: string;
|
|
246
|
+
message?: string;
|
|
247
|
+
}
|
|
248
|
+
/** Stable error union for merchant-server saved-method removal calls. */
|
|
249
|
+
type PaymentMethodRemovalError = PaymentMethodRemovalNotFoundError | PaymentMethodRemovalConflictError | PaymentMethodRemovalRetryableError;
|
|
196
250
|
/**
|
|
197
251
|
* Discriminator describing whether a checkout product is a one-time item or a
|
|
198
252
|
* recurring subscription. Mirrors the backend's `ProductTypeEnum`.
|
|
@@ -306,13 +360,21 @@ interface CheckoutSession {
|
|
|
306
360
|
id: string;
|
|
307
361
|
clientSecret: string;
|
|
308
362
|
mode: 'payment' | 'subscription' | 'setup';
|
|
309
|
-
status: 'open' | 'complete' | 'expired';
|
|
363
|
+
status: 'open' | 'authorized' | 'complete' | 'expired';
|
|
310
364
|
amount: number;
|
|
311
365
|
currency: string;
|
|
366
|
+
/** Capture behavior persisted by the billing API. Omitted on legacy sessions. */
|
|
367
|
+
captureMethod?: CaptureMethod;
|
|
368
|
+
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
369
|
+
paymentId?: string;
|
|
370
|
+
/** Provider authorisation deadline. Present while an authorisation is capturable. */
|
|
371
|
+
authorizationExpiresAt?: string;
|
|
372
|
+
/** Stable failure outcome when the authorization lifecycle did not settle. */
|
|
373
|
+
failureOutcome?: CheckoutFailureOutcome;
|
|
312
374
|
lineItems?: LineItem[];
|
|
313
375
|
customer?: Customer;
|
|
314
376
|
metadata?: Record<string, string>;
|
|
315
|
-
checkoutMode?:
|
|
377
|
+
checkoutMode?: CheckoutSessionMode;
|
|
316
378
|
/**
|
|
317
379
|
* Optional embedded hosted vault capture credentials
|
|
318
380
|
* (TeamFloPay/backend#823). This remains the preferred fast path during the
|
|
@@ -375,7 +437,13 @@ interface CheckoutSession {
|
|
|
375
437
|
}
|
|
376
438
|
/** The result of a payment confirmation attempt. */
|
|
377
439
|
interface PaymentResult {
|
|
378
|
-
status: 'succeeded' | 'processing' | 'requires_action' | 'failed';
|
|
440
|
+
status: 'authorized' | 'succeeded' | 'processing' | 'requires_action' | 'failed';
|
|
441
|
+
/** FloPay payment transaction UUID, present for an authorised outcome. */
|
|
442
|
+
paymentId?: string;
|
|
443
|
+
/** Owning checkout session UUID, present for an authorised outcome. */
|
|
444
|
+
sessionId?: string;
|
|
445
|
+
/** Provider authorisation deadline, present while the hold is capturable. */
|
|
446
|
+
authorizationExpiresAt?: string;
|
|
379
447
|
paymentIntentId?: string;
|
|
380
448
|
paymentMethodId?: string;
|
|
381
449
|
checkoutMethod?: CheckoutButtonMethod;
|
|
@@ -690,6 +758,14 @@ type CardCaptureEventType = 'ready' | 'submitting' | 'complete' | 'decline' | 'e
|
|
|
690
758
|
interface CardCaptureOutcomeEvent {
|
|
691
759
|
/** Owning checkout session id, for correlation. */
|
|
692
760
|
sessionId?: string;
|
|
761
|
+
/** Provider-neutral terminal result. Absent on legacy widget messages. */
|
|
762
|
+
outcome?: 'authorized' | 'succeeded';
|
|
763
|
+
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
764
|
+
paymentId?: string;
|
|
765
|
+
/** Provider authorisation deadline while the hold is capturable. */
|
|
766
|
+
authorizationExpiresAt?: string;
|
|
767
|
+
/** Stable provider-neutral failure for decline/error outcomes. */
|
|
768
|
+
failureOutcome?: CheckoutFailureOutcome;
|
|
693
769
|
/** Provider intent / transaction id on a terminal outcome, when available. */
|
|
694
770
|
intentId?: string;
|
|
695
771
|
/** Mapped decline reason on `decline` (backend `PaymentDeclineReason` enum). */
|
|
@@ -702,6 +778,8 @@ interface CardCaptureOutcomeEvent {
|
|
|
702
778
|
* other event type.
|
|
703
779
|
*/
|
|
704
780
|
nextActionRedirectUrl?: string;
|
|
781
|
+
/** Display-only saved card produced by a successful setup, when supplied. */
|
|
782
|
+
paymentMethod?: SavedCardDisplay;
|
|
705
783
|
}
|
|
706
784
|
/**
|
|
707
785
|
* `window.postMessage` payload the hosted vault widget sends its embedding SDK
|
|
@@ -735,6 +813,14 @@ interface VaultCaptureResultMessage {
|
|
|
735
813
|
* the SDK was given a token it rejects messages that omit or mismatch it.
|
|
736
814
|
*/
|
|
737
815
|
messageToken?: string;
|
|
816
|
+
/** Provider-neutral terminal result. Absent on legacy widget messages. */
|
|
817
|
+
outcome?: 'authorized' | 'succeeded';
|
|
818
|
+
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
819
|
+
paymentId?: string;
|
|
820
|
+
/** Provider authorisation deadline while the hold is capturable. */
|
|
821
|
+
authorizationExpiresAt?: string;
|
|
822
|
+
/** Stable provider-neutral failure for decline/error outcomes. */
|
|
823
|
+
failureOutcome?: CheckoutFailureOutcome;
|
|
738
824
|
intentId?: string;
|
|
739
825
|
declineReason?: string;
|
|
740
826
|
message?: string;
|
|
@@ -745,6 +831,8 @@ interface VaultCaptureResultMessage {
|
|
|
745
831
|
* blocked by the SDK's processing backdrop.
|
|
746
832
|
*/
|
|
747
833
|
nextActionRedirectUrl?: string;
|
|
834
|
+
/** Display-only saved card produced by a successful setup, when supplied. */
|
|
835
|
+
paymentMethod?: SavedCardDisplay;
|
|
748
836
|
}
|
|
749
837
|
/** Options for mounting the hosted vault widget into a container element. */
|
|
750
838
|
interface CardCaptureMountOptions {
|
|
@@ -892,6 +980,8 @@ interface TokenizedBody {
|
|
|
892
980
|
/** Structured checkout-processing error returned by the billing API. */
|
|
893
981
|
interface CheckoutProcessError {
|
|
894
982
|
type: string;
|
|
983
|
+
/** Stable provider-neutral failure outcome when supplied by the backend. */
|
|
984
|
+
outcome?: CheckoutFailureOutcome;
|
|
895
985
|
message?: string;
|
|
896
986
|
transactionId?: string;
|
|
897
987
|
threeDSecureToken?: string;
|
|
@@ -1167,6 +1257,12 @@ interface CreateSessionParams {
|
|
|
1167
1257
|
* - 'full' – full checkout flow
|
|
1168
1258
|
*/
|
|
1169
1259
|
checkoutMode?: 'confirm' | 'auto' | 'full';
|
|
1260
|
+
/**
|
|
1261
|
+
* Payment capture behavior. Omit (or use `'automatic'`) to preserve
|
|
1262
|
+
* immediate capture; use `'manual'` to authorise funds for later capture.
|
|
1263
|
+
* Manual capture is not supported for subscription products.
|
|
1264
|
+
*/
|
|
1265
|
+
captureMethod?: CaptureMethod;
|
|
1170
1266
|
/** Coupon codes to apply. */
|
|
1171
1267
|
couponCodes?: string[];
|
|
1172
1268
|
/** Pixel / analytics tags forwarded to the checkout page. */
|
|
@@ -1226,6 +1322,12 @@ interface InlineSessionParams {
|
|
|
1226
1322
|
cancelUrl: string;
|
|
1227
1323
|
/** Checkout mode: 'full' (default), 'auto', or 'confirm'. */
|
|
1228
1324
|
checkoutMode?: 'full' | 'auto' | 'confirm';
|
|
1325
|
+
/**
|
|
1326
|
+
* Payment capture behavior. Omit (or use `'automatic'`) to preserve
|
|
1327
|
+
* immediate capture; use `'manual'` to authorise funds for later capture.
|
|
1328
|
+
* Manual capture is not supported for subscription products.
|
|
1329
|
+
*/
|
|
1330
|
+
captureMethod?: CaptureMethod;
|
|
1229
1331
|
/** Optional saved/tokenized payment method for inline auto or confirm checkout. */
|
|
1230
1332
|
tokenizedData?: TokenizedBody;
|
|
1231
1333
|
/** Coupon codes to apply. */
|
|
@@ -1407,6 +1509,13 @@ interface CountryOption {
|
|
|
1407
1509
|
flag: string;
|
|
1408
1510
|
}
|
|
1409
1511
|
|
|
1512
|
+
/**
|
|
1513
|
+
* Whether a read session is safe to mount in a no-charge card-setup surface.
|
|
1514
|
+
* Both the explicit setup mode and the empty, zero-amount cart are required so
|
|
1515
|
+
* a purchase session can never be mistaken for a bare card form.
|
|
1516
|
+
*/
|
|
1517
|
+
declare function isCardSetupCheckoutSession(session: CheckoutSession): boolean;
|
|
1518
|
+
|
|
1410
1519
|
interface SentryStackFrameLike {
|
|
1411
1520
|
in_app?: boolean;
|
|
1412
1521
|
filename?: string;
|
|
@@ -1454,13 +1563,13 @@ declare const TELEMETRY_REQUEST_CATEGORIES: readonly ["session_create", "session
|
|
|
1454
1563
|
type TelemetryRequestCategory = (typeof TELEMETRY_REQUEST_CATEGORIES)[number];
|
|
1455
1564
|
declare const TELEMETRY_STATUS_CLASSES: readonly ["2xx", "3xx", "4xx", "5xx", "network_error", "timeout", "unknown"];
|
|
1456
1565
|
type TelemetryStatusClass = (typeof TELEMETRY_STATUS_CLASSES)[number];
|
|
1457
|
-
declare const TELEMETRY_CHECKOUT_MODES: readonly ["full", "auto", "confirm", "unknown"];
|
|
1566
|
+
declare const TELEMETRY_CHECKOUT_MODES: readonly ["full", "auto", "confirm", "setup", "unknown"];
|
|
1458
1567
|
type TelemetryCheckoutMode = (typeof TELEMETRY_CHECKOUT_MODES)[number];
|
|
1459
1568
|
declare const TELEMETRY_LAYOUTS: readonly ["embedded", "buttons", "automatic", "unknown"];
|
|
1460
1569
|
type TelemetryLayout = (typeof TELEMETRY_LAYOUTS)[number];
|
|
1461
1570
|
declare const TELEMETRY_DURATION_MODES: readonly ["machine", "buyer", "total"];
|
|
1462
1571
|
type TelemetryDurationMode = (typeof TELEMETRY_DURATION_MODES)[number];
|
|
1463
|
-
declare const TELEMETRY_EXPECTED_OUTCOMES: readonly ["action_required", "customer_abandoned", "payment_cancelled", "payment_declined", "payment_succeeded", "validation_rejected"];
|
|
1572
|
+
declare const TELEMETRY_EXPECTED_OUTCOMES: readonly ["action_required", "card_setup_declined", "card_setup_succeeded", "customer_abandoned", "payment_cancelled", "payment_declined", "payment_authorized", "payment_succeeded", "validation_rejected"];
|
|
1464
1573
|
type TelemetryExpectedOutcome = (typeof TELEMETRY_EXPECTED_OUTCOMES)[number];
|
|
1465
1574
|
interface TelemetryCommonFields {
|
|
1466
1575
|
eventId: string;
|
|
@@ -1596,7 +1705,7 @@ declare function getConfiguredBillingApiUrl(): string;
|
|
|
1596
1705
|
declare function getFloPayEnvironment(): FloPayEnvironment;
|
|
1597
1706
|
|
|
1598
1707
|
/** Current SDK version. */
|
|
1599
|
-
declare const SDK_VERSION = "1.4.
|
|
1708
|
+
declare const SDK_VERSION = "1.4.21";
|
|
1600
1709
|
/**
|
|
1601
1710
|
* HTTP header the SDK sends on checkout-session create/read requests so the
|
|
1602
1711
|
* backend can observe compatibility. Version 1.4.9 is the first release that
|
|
@@ -2123,6 +2232,24 @@ interface BuildCheckoutDisplayDataOptions {
|
|
|
2123
2232
|
*/
|
|
2124
2233
|
declare function buildCheckoutDisplayData(session: CheckoutSession, options?: BuildCheckoutDisplayDataOptions): CheckoutDisplayData;
|
|
2125
2234
|
|
|
2235
|
+
interface CaptureMethodEligibilityParams {
|
|
2236
|
+
captureMethod?: CaptureMethod;
|
|
2237
|
+
products?: readonly CheckoutProduct[];
|
|
2238
|
+
items?: readonly CheckoutItem[];
|
|
2239
|
+
subscriptions?: readonly CheckoutSubscription[];
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Reject authorisation-only checkout carts that contain a subscription.
|
|
2243
|
+
*
|
|
2244
|
+
* The backend remains authoritative; this shared preflight keeps every SDK
|
|
2245
|
+
* creation style from mounting or redirecting to a checkout that cannot
|
|
2246
|
+
* support manual capture.
|
|
2247
|
+
*
|
|
2248
|
+
* Subscription detection in the unified `products` shape is best-effort:
|
|
2249
|
+
* `CheckoutProduct.type` is optional, so catalog-backed subscriptions that
|
|
2250
|
+
* omit it are resolved and rejected by the authoritative backend validation.
|
|
2251
|
+
*/
|
|
2252
|
+
declare function assertCaptureMethodEligible(params: CaptureMethodEligibilityParams): void;
|
|
2126
2253
|
/**
|
|
2127
2254
|
* Whether a session may be created through the **detached** shell + claim flow
|
|
2128
2255
|
* (TeamFloPay/backend#1099).
|
|
@@ -2186,6 +2313,20 @@ declare function buildItemPayload(item: CheckoutItem, sessionCurrency: string):
|
|
|
2186
2313
|
*/
|
|
2187
2314
|
declare function buildSubscriptionPayload(subscription: CheckoutSubscription, sessionCurrency: string): Record<string, unknown>;
|
|
2188
2315
|
|
|
2316
|
+
/** Returns whether a checkout deliberately stops after placing an authorization hold. */
|
|
2317
|
+
declare function isAuthorizationOnlySession(session?: {
|
|
2318
|
+
captureMethod?: CaptureMethod;
|
|
2319
|
+
} | null): boolean;
|
|
2320
|
+
/**
|
|
2321
|
+
* Returns whether an outcome represents money settled for the active checkout.
|
|
2322
|
+
*
|
|
2323
|
+
* `requires_capture` remains successful for legacy automatic/PayPal flows, but
|
|
2324
|
+
* can never be treated as settled for a manual-capture session.
|
|
2325
|
+
*/
|
|
2326
|
+
declare function isMoneySettledOutcome(outcome?: string | null, captureMethod?: CaptureMethod): boolean;
|
|
2327
|
+
/** Collapses provider/backend reason strings into the SDK's closed failure vocabulary. */
|
|
2328
|
+
declare function normalizeCheckoutFailureOutcome(value: unknown): CheckoutFailureOutcome | undefined;
|
|
2329
|
+
|
|
2189
2330
|
/**
|
|
2190
2331
|
* Look up currency information by ISO 3166-1 alpha-2 country code.
|
|
2191
2332
|
* Falls back to USD when the country is not in the map.
|
|
@@ -2279,4 +2420,4 @@ declare function isUuidV4(value: unknown): value is string;
|
|
|
2279
2420
|
*/
|
|
2280
2421
|
declare function randomUuidV4(): string;
|
|
2281
2422
|
|
|
2282
|
-
export { type AVSFieldConfig, BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, BOLD_DARK_APPEARANCE, BOLD_LIGHT_APPEARANCE, BUTTONS_LAYOUT_BOLD_DARK, BUTTONS_LAYOUT_BOLD_LIGHT, BUTTONS_LAYOUT_DARK, BUTTONS_LAYOUT_DEFAULT, BUTTONS_LAYOUT_GLASS_DARK, BUTTONS_LAYOUT_GLASS_LIGHT, BUTTONS_LAYOUT_MINIMAL, BUTTONS_LAYOUT_MODERN_DARK, BUTTONS_LAYOUT_MODERN_LIGHT, BUTTONS_LAYOUT_ROUNDED, type BeforeButtonClickEvent, type BillingDetails, type BillingProvider, type BuildCheckoutDisplayDataOptions, type BuildTelemetryErrorEventInput, type BuildTelemetryLogEventInput, type BuildTelemetryPerformanceEventInput, type BuildTelemetryTerminalEventInput, type ButtonsLayoutStyles, type ButtonsLayoutTheme, CA_PROVINCES, COUNTRY_OPTIONS, CURRENCY_MAP, type CardCaptureAdapter, type CardCaptureEventType, type CardCaptureMountOptions, type CardCaptureOutcomeEvent, type CardCaptureProviderId, type CheckoutAccount, type CheckoutButtonMethod, type CheckoutDisplayData, type CheckoutGateway, type CheckoutGateways, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutProcessError, type CheckoutProcessingPending, type CheckoutProduct, type CheckoutProductType, type CheckoutSession, type CheckoutSessionProduct, type CheckoutSessionResult, type CheckoutSubscription, type ClassifiedTelemetryFailure, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreateSessionIntentRequest, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DeclineEvent, type DetachedCheckoutSession, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, FLO_SDK_VERSION_HEADER, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, GLASS_DARK_APPEARANCE, GLASS_LIGHT_APPEARANCE, type GatewayEnvironment, IDEMPOTENCY_IN_PROGRESS_CODE, IDEMPOTENCY_KEY_HEADER, type InlineSessionDraft, type InlineSessionParams, type InlineSessionPatch, type LineItem, MAX_IDEMPOTENCY_KEY_LENGTH, MODERN_DARK_APPEARANCE, MODERN_LIGHT_APPEARANCE, type MountedElement, NIGHT_APPEARANCE, type NonCardPaymentMethodCategory, type NormalizedCheckoutSession, type NormalizedGatewayEnvironment, type PayPalPaymentResult, type PayPalSessionIntent, type PayPalSessionIntentRequest, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, STRIPE_EXPRESS_METHODS, STRIPE_METHOD_AMOUNT_LIMITS, STRIPE_METHOD_COUNTRIES, STRIPE_METHOD_CURRENCIES, STRIPE_METHOD_MATRIX, SUPPORTED_CARD_BRANDS, type SentryEventLike, type SentryStackFrameLike, type SerializeTelemetryBatchOptions, type SessionIntent, type SessionIntentDeclineRequest, type StateOption, type StripeMethodEntry, type StripeMethodThemeVariant, type StripeSessionIntent, type StripeSessionIntentRequest, TELEMETRY_ERROR_CODES, TELEMETRY_FAILURE_CATEGORIES, TELEMETRY_LOG_NAMES, TELEMETRY_MAX_BATCH_BYTES, TELEMETRY_MAX_BATCH_EVENTS, TELEMETRY_SCHEMA_VERSION, TELEMETRY_SDK_PACKAGES, THEMES, type TagsData, type TelemetryBatchEnvelope, type TelemetryCheckoutMode, type TelemetryDurationMode, type TelemetryErrorCode, type TelemetryErrorEvent, type TelemetryEvent, type TelemetryEventClass, type TelemetryExpectedOutcome, type TelemetryExpectedOutcomeEvent, type TelemetryFailureCategory, type TelemetryLayout, type TelemetryLogEvent, type TelemetryLogName, type TelemetryPaymentMethodCategory, type TelemetryPerformanceEvent, type TelemetryProvider, type TelemetryProviderInput, type TelemetryRequestCategory, type TelemetrySdkPackage, type TelemetryStage, type TelemetryStatusClass, type ThemeBundle, type ThemeBundleId, type ThemeId, type TokenizedBody, US_STATES, UUID_V4, type UpdateCustomerParams, type VaultCaptureBlock, type VaultCaptureResultMessage, type VaultCardFieldKey, type VaultCardThemeColors, type WebhookEvent, apiError, authenticationError, buildCheckoutDisplayData, buildItemPayload, buildProductPayload, buildSubscriptionPayload, buildTelemetryErrorEvent, buildTelemetryLogEvent, buildTelemetryPerformanceEvent, buildTelemetryTerminalEvent, classifyPaymentRejection, classifyTelemetryFailure, configureFlopay, dropThirdPartyOnlyError, filterStripeMethodsByAmount, filterStripeMethodsByCountry, filterStripeMethodsByCurrency, foldIntoProducts, generateIdempotencyKey, getConfiguredBillingApiUrl, getCountryByCode, getCurrencyByCountry, getFloPayEnvironment, getPostalCodeExample, getPostalCodeLabel, getStateFromPostalCode, getStateLabel, getStateOptions, getStripeMethodDisplayName, hasVendoredStripeMethodLogo, isAVSEnabled, isAVSFieldVisible, isDetachedSessionEligible, isPostalCodeSupported, isSetupIntentClientSecret, isUuidV4, isValidPostalCode, isValidPublishableKey, isValidSecretKey, needsStripeMethodExplicitConfirm, networkError, normalizeGatewayEnvironment, partitionStripeMethods, randomUuidV4, rateLimitError, resolveAVSConfig, resolveBillingApiUrl, resolveButtonsLayoutTheme, resolveIdempotencyKey, resolveSessionCurrency, resolveStripeMethodBrandVariant, resolveTheme, serializeTelemetryBatch, stripeExpressMethodToOptionKey, telemetryStatusClass, validationError };
|
|
2423
|
+
export { type AVSFieldConfig, BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, BOLD_DARK_APPEARANCE, BOLD_LIGHT_APPEARANCE, BUTTONS_LAYOUT_BOLD_DARK, BUTTONS_LAYOUT_BOLD_LIGHT, BUTTONS_LAYOUT_DARK, BUTTONS_LAYOUT_DEFAULT, BUTTONS_LAYOUT_GLASS_DARK, BUTTONS_LAYOUT_GLASS_LIGHT, BUTTONS_LAYOUT_MINIMAL, BUTTONS_LAYOUT_MODERN_DARK, BUTTONS_LAYOUT_MODERN_LIGHT, BUTTONS_LAYOUT_ROUNDED, type BeforeButtonClickEvent, type BillingDetails, type BillingProvider, type BuildCheckoutDisplayDataOptions, type BuildTelemetryErrorEventInput, type BuildTelemetryLogEventInput, type BuildTelemetryPerformanceEventInput, type BuildTelemetryTerminalEventInput, type ButtonsLayoutStyles, type ButtonsLayoutTheme, CA_PROVINCES, COUNTRY_OPTIONS, CURRENCY_MAP, type CaptureMethod, type CardCaptureAdapter, type CardCaptureEventType, type CardCaptureMountOptions, type CardCaptureOutcomeEvent, type CardCaptureProviderId, type CheckoutAccount, type CheckoutButtonMethod, type CheckoutDisplayData, type CheckoutFailureOutcome, type CheckoutGateway, type CheckoutGateways, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutProcessError, type CheckoutProcessingPending, type CheckoutProduct, type CheckoutProductType, type CheckoutSession, type CheckoutSessionMode, type CheckoutSessionProduct, type CheckoutSessionResult, type CheckoutSubscription, type ClassifiedTelemetryFailure, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreateSessionIntentRequest, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DeclineEvent, type DetachedCheckoutSession, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, FLO_SDK_VERSION_HEADER, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, GLASS_DARK_APPEARANCE, GLASS_LIGHT_APPEARANCE, type GatewayEnvironment, IDEMPOTENCY_IN_PROGRESS_CODE, IDEMPOTENCY_KEY_HEADER, type InlineSessionDraft, type InlineSessionParams, type InlineSessionPatch, type LineItem, MAX_IDEMPOTENCY_KEY_LENGTH, MODERN_DARK_APPEARANCE, MODERN_LIGHT_APPEARANCE, type MountedElement, NIGHT_APPEARANCE, type NonCardPaymentMethodCategory, type NormalizedCheckoutSession, type NormalizedGatewayEnvironment, type PayPalPaymentResult, type PayPalSessionIntent, type PayPalSessionIntentRequest, type PaymentMethodRemovalConflictCode, type PaymentMethodRemovalConflictError, type PaymentMethodRemovalError, type PaymentMethodRemovalFailureReason, type PaymentMethodRemovalNotFoundError, type PaymentMethodRemovalRetryableError, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, STRIPE_EXPRESS_METHODS, STRIPE_METHOD_AMOUNT_LIMITS, STRIPE_METHOD_COUNTRIES, STRIPE_METHOD_CURRENCIES, STRIPE_METHOD_MATRIX, SUPPORTED_CARD_BRANDS, type SavedCardDisplay, type SavedPaymentMethodStatus, type SentryEventLike, type SentryStackFrameLike, type SerializeTelemetryBatchOptions, type SessionIntent, type SessionIntentDeclineRequest, type StateOption, type StripeMethodEntry, type StripeMethodThemeVariant, type StripeSessionIntent, type StripeSessionIntentRequest, TELEMETRY_ERROR_CODES, TELEMETRY_FAILURE_CATEGORIES, TELEMETRY_LOG_NAMES, TELEMETRY_MAX_BATCH_BYTES, TELEMETRY_MAX_BATCH_EVENTS, TELEMETRY_SCHEMA_VERSION, TELEMETRY_SDK_PACKAGES, THEMES, type TagsData, type TelemetryBatchEnvelope, type TelemetryCheckoutMode, type TelemetryDurationMode, type TelemetryErrorCode, type TelemetryErrorEvent, type TelemetryEvent, type TelemetryEventClass, type TelemetryExpectedOutcome, type TelemetryExpectedOutcomeEvent, type TelemetryFailureCategory, type TelemetryLayout, type TelemetryLogEvent, type TelemetryLogName, type TelemetryPaymentMethodCategory, type TelemetryPerformanceEvent, type TelemetryProvider, type TelemetryProviderInput, type TelemetryRequestCategory, type TelemetrySdkPackage, type TelemetryStage, type TelemetryStatusClass, type ThemeBundle, type ThemeBundleId, type ThemeId, type TokenizedBody, US_STATES, UUID_V4, type UpdateCustomerParams, type VaultCaptureBlock, type VaultCaptureResultMessage, type VaultCardFieldKey, type VaultCardThemeColors, type WebhookEvent, apiError, assertCaptureMethodEligible, authenticationError, buildCheckoutDisplayData, buildItemPayload, buildProductPayload, buildSubscriptionPayload, buildTelemetryErrorEvent, buildTelemetryLogEvent, buildTelemetryPerformanceEvent, buildTelemetryTerminalEvent, classifyPaymentRejection, classifyTelemetryFailure, configureFlopay, dropThirdPartyOnlyError, filterStripeMethodsByAmount, filterStripeMethodsByCountry, filterStripeMethodsByCurrency, foldIntoProducts, generateIdempotencyKey, getConfiguredBillingApiUrl, getCountryByCode, getCurrencyByCountry, getFloPayEnvironment, getPostalCodeExample, getPostalCodeLabel, getStateFromPostalCode, getStateLabel, getStateOptions, getStripeMethodDisplayName, hasVendoredStripeMethodLogo, isAVSEnabled, isAVSFieldVisible, isAuthorizationOnlySession, isCardSetupCheckoutSession, isDetachedSessionEligible, isMoneySettledOutcome, isPostalCodeSupported, isSetupIntentClientSecret, isUuidV4, isValidPostalCode, isValidPublishableKey, isValidSecretKey, needsStripeMethodExplicitConfirm, networkError, normalizeCheckoutFailureOutcome, normalizeGatewayEnvironment, partitionStripeMethods, randomUuidV4, rateLimitError, resolveAVSConfig, resolveBillingApiUrl, resolveButtonsLayoutTheme, resolveIdempotencyKey, resolveSessionCurrency, resolveStripeMethodBrandVariant, resolveTheme, serializeTelemetryBatch, stripeExpressMethodToOptionKey, telemetryStatusClass, validationError };
|
package/dist/index.d.ts
CHANGED
|
@@ -193,6 +193,60 @@ interface LineItem {
|
|
|
193
193
|
}
|
|
194
194
|
/** Checkout mode controlling the payment UI behavior. */
|
|
195
195
|
type CheckoutMode = 'full' | 'auto' | 'confirm';
|
|
196
|
+
/**
|
|
197
|
+
* Checkout mode reported by a session read. `setup` is read-only in the
|
|
198
|
+
* browser SDK: merchant-authenticated setup-session creation stays on the
|
|
199
|
+
* merchant's server, while the existing create parameter types intentionally
|
|
200
|
+
* continue to accept only {@link CheckoutMode}.
|
|
201
|
+
*/
|
|
202
|
+
type CheckoutSessionMode = CheckoutMode | 'setup';
|
|
203
|
+
/** Whether checkout captures immediately or only authorises funds for later capture. */
|
|
204
|
+
type CaptureMethod = 'automatic' | 'manual';
|
|
205
|
+
/** Stable, provider-neutral authorization lifecycle failures exposed by the SDK. */
|
|
206
|
+
type CheckoutFailureOutcome = 'authorization_declined' | 'authentication_required' | 'authorization_expired' | 'capture_failed';
|
|
207
|
+
/** Lifecycle states returned by the merchant-scoped saved-method list. */
|
|
208
|
+
type SavedPaymentMethodStatus = 'pending' | 'active' | 'deleted';
|
|
209
|
+
/**
|
|
210
|
+
* Display-only card fields safe to show to a customer. This deliberately has
|
|
211
|
+
* no provider payment-method id, vault token, capture reference, or reusable
|
|
212
|
+
* credential.
|
|
213
|
+
*/
|
|
214
|
+
interface SavedCardDisplay {
|
|
215
|
+
/** FloPay payment-method UUID. */
|
|
216
|
+
id: string;
|
|
217
|
+
brand: string;
|
|
218
|
+
lastFour: string;
|
|
219
|
+
expiryMonth: number;
|
|
220
|
+
expiryYear: number;
|
|
221
|
+
status: SavedPaymentMethodStatus;
|
|
222
|
+
}
|
|
223
|
+
/** Stable conflicts returned by `DELETE /v1/payment-methods/:id`. */
|
|
224
|
+
type PaymentMethodRemovalConflictCode = 'payment_method_has_active_payment' | 'payment_method_in_use' | 'payment_method_reassignment_requires_payer_action';
|
|
225
|
+
/** Indistinguishable missing-or-inaccessible saved-method response. */
|
|
226
|
+
interface PaymentMethodRemovalNotFoundError {
|
|
227
|
+
statusCode: 404;
|
|
228
|
+
code: 'payment_method_not_found';
|
|
229
|
+
message?: string;
|
|
230
|
+
}
|
|
231
|
+
/** A blocked removal that requires merchant/customer guidance. */
|
|
232
|
+
interface PaymentMethodRemovalConflictError {
|
|
233
|
+
statusCode: 409;
|
|
234
|
+
code: PaymentMethodRemovalConflictCode;
|
|
235
|
+
message?: string;
|
|
236
|
+
}
|
|
237
|
+
/** Provider-neutral reason accompanying a retry-safe removal failure. */
|
|
238
|
+
type PaymentMethodRemovalFailureReason = 'payment_method_data_incomplete' | 'provider_cleanup_failed' | 'provider_unavailable' | 'provider_verification_failed';
|
|
239
|
+
/** Retry-safe incomplete provider/vault cleanup response. */
|
|
240
|
+
interface PaymentMethodRemovalRetryableError {
|
|
241
|
+
statusCode: 502;
|
|
242
|
+
code: 'payment_method_deletion_failed';
|
|
243
|
+
reason: PaymentMethodRemovalFailureReason;
|
|
244
|
+
retrySafe: true;
|
|
245
|
+
resolution: string;
|
|
246
|
+
message?: string;
|
|
247
|
+
}
|
|
248
|
+
/** Stable error union for merchant-server saved-method removal calls. */
|
|
249
|
+
type PaymentMethodRemovalError = PaymentMethodRemovalNotFoundError | PaymentMethodRemovalConflictError | PaymentMethodRemovalRetryableError;
|
|
196
250
|
/**
|
|
197
251
|
* Discriminator describing whether a checkout product is a one-time item or a
|
|
198
252
|
* recurring subscription. Mirrors the backend's `ProductTypeEnum`.
|
|
@@ -306,13 +360,21 @@ interface CheckoutSession {
|
|
|
306
360
|
id: string;
|
|
307
361
|
clientSecret: string;
|
|
308
362
|
mode: 'payment' | 'subscription' | 'setup';
|
|
309
|
-
status: 'open' | 'complete' | 'expired';
|
|
363
|
+
status: 'open' | 'authorized' | 'complete' | 'expired';
|
|
310
364
|
amount: number;
|
|
311
365
|
currency: string;
|
|
366
|
+
/** Capture behavior persisted by the billing API. Omitted on legacy sessions. */
|
|
367
|
+
captureMethod?: CaptureMethod;
|
|
368
|
+
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
369
|
+
paymentId?: string;
|
|
370
|
+
/** Provider authorisation deadline. Present while an authorisation is capturable. */
|
|
371
|
+
authorizationExpiresAt?: string;
|
|
372
|
+
/** Stable failure outcome when the authorization lifecycle did not settle. */
|
|
373
|
+
failureOutcome?: CheckoutFailureOutcome;
|
|
312
374
|
lineItems?: LineItem[];
|
|
313
375
|
customer?: Customer;
|
|
314
376
|
metadata?: Record<string, string>;
|
|
315
|
-
checkoutMode?:
|
|
377
|
+
checkoutMode?: CheckoutSessionMode;
|
|
316
378
|
/**
|
|
317
379
|
* Optional embedded hosted vault capture credentials
|
|
318
380
|
* (TeamFloPay/backend#823). This remains the preferred fast path during the
|
|
@@ -375,7 +437,13 @@ interface CheckoutSession {
|
|
|
375
437
|
}
|
|
376
438
|
/** The result of a payment confirmation attempt. */
|
|
377
439
|
interface PaymentResult {
|
|
378
|
-
status: 'succeeded' | 'processing' | 'requires_action' | 'failed';
|
|
440
|
+
status: 'authorized' | 'succeeded' | 'processing' | 'requires_action' | 'failed';
|
|
441
|
+
/** FloPay payment transaction UUID, present for an authorised outcome. */
|
|
442
|
+
paymentId?: string;
|
|
443
|
+
/** Owning checkout session UUID, present for an authorised outcome. */
|
|
444
|
+
sessionId?: string;
|
|
445
|
+
/** Provider authorisation deadline, present while the hold is capturable. */
|
|
446
|
+
authorizationExpiresAt?: string;
|
|
379
447
|
paymentIntentId?: string;
|
|
380
448
|
paymentMethodId?: string;
|
|
381
449
|
checkoutMethod?: CheckoutButtonMethod;
|
|
@@ -690,6 +758,14 @@ type CardCaptureEventType = 'ready' | 'submitting' | 'complete' | 'decline' | 'e
|
|
|
690
758
|
interface CardCaptureOutcomeEvent {
|
|
691
759
|
/** Owning checkout session id, for correlation. */
|
|
692
760
|
sessionId?: string;
|
|
761
|
+
/** Provider-neutral terminal result. Absent on legacy widget messages. */
|
|
762
|
+
outcome?: 'authorized' | 'succeeded';
|
|
763
|
+
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
764
|
+
paymentId?: string;
|
|
765
|
+
/** Provider authorisation deadline while the hold is capturable. */
|
|
766
|
+
authorizationExpiresAt?: string;
|
|
767
|
+
/** Stable provider-neutral failure for decline/error outcomes. */
|
|
768
|
+
failureOutcome?: CheckoutFailureOutcome;
|
|
693
769
|
/** Provider intent / transaction id on a terminal outcome, when available. */
|
|
694
770
|
intentId?: string;
|
|
695
771
|
/** Mapped decline reason on `decline` (backend `PaymentDeclineReason` enum). */
|
|
@@ -702,6 +778,8 @@ interface CardCaptureOutcomeEvent {
|
|
|
702
778
|
* other event type.
|
|
703
779
|
*/
|
|
704
780
|
nextActionRedirectUrl?: string;
|
|
781
|
+
/** Display-only saved card produced by a successful setup, when supplied. */
|
|
782
|
+
paymentMethod?: SavedCardDisplay;
|
|
705
783
|
}
|
|
706
784
|
/**
|
|
707
785
|
* `window.postMessage` payload the hosted vault widget sends its embedding SDK
|
|
@@ -735,6 +813,14 @@ interface VaultCaptureResultMessage {
|
|
|
735
813
|
* the SDK was given a token it rejects messages that omit or mismatch it.
|
|
736
814
|
*/
|
|
737
815
|
messageToken?: string;
|
|
816
|
+
/** Provider-neutral terminal result. Absent on legacy widget messages. */
|
|
817
|
+
outcome?: 'authorized' | 'succeeded';
|
|
818
|
+
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
819
|
+
paymentId?: string;
|
|
820
|
+
/** Provider authorisation deadline while the hold is capturable. */
|
|
821
|
+
authorizationExpiresAt?: string;
|
|
822
|
+
/** Stable provider-neutral failure for decline/error outcomes. */
|
|
823
|
+
failureOutcome?: CheckoutFailureOutcome;
|
|
738
824
|
intentId?: string;
|
|
739
825
|
declineReason?: string;
|
|
740
826
|
message?: string;
|
|
@@ -745,6 +831,8 @@ interface VaultCaptureResultMessage {
|
|
|
745
831
|
* blocked by the SDK's processing backdrop.
|
|
746
832
|
*/
|
|
747
833
|
nextActionRedirectUrl?: string;
|
|
834
|
+
/** Display-only saved card produced by a successful setup, when supplied. */
|
|
835
|
+
paymentMethod?: SavedCardDisplay;
|
|
748
836
|
}
|
|
749
837
|
/** Options for mounting the hosted vault widget into a container element. */
|
|
750
838
|
interface CardCaptureMountOptions {
|
|
@@ -892,6 +980,8 @@ interface TokenizedBody {
|
|
|
892
980
|
/** Structured checkout-processing error returned by the billing API. */
|
|
893
981
|
interface CheckoutProcessError {
|
|
894
982
|
type: string;
|
|
983
|
+
/** Stable provider-neutral failure outcome when supplied by the backend. */
|
|
984
|
+
outcome?: CheckoutFailureOutcome;
|
|
895
985
|
message?: string;
|
|
896
986
|
transactionId?: string;
|
|
897
987
|
threeDSecureToken?: string;
|
|
@@ -1167,6 +1257,12 @@ interface CreateSessionParams {
|
|
|
1167
1257
|
* - 'full' – full checkout flow
|
|
1168
1258
|
*/
|
|
1169
1259
|
checkoutMode?: 'confirm' | 'auto' | 'full';
|
|
1260
|
+
/**
|
|
1261
|
+
* Payment capture behavior. Omit (or use `'automatic'`) to preserve
|
|
1262
|
+
* immediate capture; use `'manual'` to authorise funds for later capture.
|
|
1263
|
+
* Manual capture is not supported for subscription products.
|
|
1264
|
+
*/
|
|
1265
|
+
captureMethod?: CaptureMethod;
|
|
1170
1266
|
/** Coupon codes to apply. */
|
|
1171
1267
|
couponCodes?: string[];
|
|
1172
1268
|
/** Pixel / analytics tags forwarded to the checkout page. */
|
|
@@ -1226,6 +1322,12 @@ interface InlineSessionParams {
|
|
|
1226
1322
|
cancelUrl: string;
|
|
1227
1323
|
/** Checkout mode: 'full' (default), 'auto', or 'confirm'. */
|
|
1228
1324
|
checkoutMode?: 'full' | 'auto' | 'confirm';
|
|
1325
|
+
/**
|
|
1326
|
+
* Payment capture behavior. Omit (or use `'automatic'`) to preserve
|
|
1327
|
+
* immediate capture; use `'manual'` to authorise funds for later capture.
|
|
1328
|
+
* Manual capture is not supported for subscription products.
|
|
1329
|
+
*/
|
|
1330
|
+
captureMethod?: CaptureMethod;
|
|
1229
1331
|
/** Optional saved/tokenized payment method for inline auto or confirm checkout. */
|
|
1230
1332
|
tokenizedData?: TokenizedBody;
|
|
1231
1333
|
/** Coupon codes to apply. */
|
|
@@ -1407,6 +1509,13 @@ interface CountryOption {
|
|
|
1407
1509
|
flag: string;
|
|
1408
1510
|
}
|
|
1409
1511
|
|
|
1512
|
+
/**
|
|
1513
|
+
* Whether a read session is safe to mount in a no-charge card-setup surface.
|
|
1514
|
+
* Both the explicit setup mode and the empty, zero-amount cart are required so
|
|
1515
|
+
* a purchase session can never be mistaken for a bare card form.
|
|
1516
|
+
*/
|
|
1517
|
+
declare function isCardSetupCheckoutSession(session: CheckoutSession): boolean;
|
|
1518
|
+
|
|
1410
1519
|
interface SentryStackFrameLike {
|
|
1411
1520
|
in_app?: boolean;
|
|
1412
1521
|
filename?: string;
|
|
@@ -1454,13 +1563,13 @@ declare const TELEMETRY_REQUEST_CATEGORIES: readonly ["session_create", "session
|
|
|
1454
1563
|
type TelemetryRequestCategory = (typeof TELEMETRY_REQUEST_CATEGORIES)[number];
|
|
1455
1564
|
declare const TELEMETRY_STATUS_CLASSES: readonly ["2xx", "3xx", "4xx", "5xx", "network_error", "timeout", "unknown"];
|
|
1456
1565
|
type TelemetryStatusClass = (typeof TELEMETRY_STATUS_CLASSES)[number];
|
|
1457
|
-
declare const TELEMETRY_CHECKOUT_MODES: readonly ["full", "auto", "confirm", "unknown"];
|
|
1566
|
+
declare const TELEMETRY_CHECKOUT_MODES: readonly ["full", "auto", "confirm", "setup", "unknown"];
|
|
1458
1567
|
type TelemetryCheckoutMode = (typeof TELEMETRY_CHECKOUT_MODES)[number];
|
|
1459
1568
|
declare const TELEMETRY_LAYOUTS: readonly ["embedded", "buttons", "automatic", "unknown"];
|
|
1460
1569
|
type TelemetryLayout = (typeof TELEMETRY_LAYOUTS)[number];
|
|
1461
1570
|
declare const TELEMETRY_DURATION_MODES: readonly ["machine", "buyer", "total"];
|
|
1462
1571
|
type TelemetryDurationMode = (typeof TELEMETRY_DURATION_MODES)[number];
|
|
1463
|
-
declare const TELEMETRY_EXPECTED_OUTCOMES: readonly ["action_required", "customer_abandoned", "payment_cancelled", "payment_declined", "payment_succeeded", "validation_rejected"];
|
|
1572
|
+
declare const TELEMETRY_EXPECTED_OUTCOMES: readonly ["action_required", "card_setup_declined", "card_setup_succeeded", "customer_abandoned", "payment_cancelled", "payment_declined", "payment_authorized", "payment_succeeded", "validation_rejected"];
|
|
1464
1573
|
type TelemetryExpectedOutcome = (typeof TELEMETRY_EXPECTED_OUTCOMES)[number];
|
|
1465
1574
|
interface TelemetryCommonFields {
|
|
1466
1575
|
eventId: string;
|
|
@@ -1596,7 +1705,7 @@ declare function getConfiguredBillingApiUrl(): string;
|
|
|
1596
1705
|
declare function getFloPayEnvironment(): FloPayEnvironment;
|
|
1597
1706
|
|
|
1598
1707
|
/** Current SDK version. */
|
|
1599
|
-
declare const SDK_VERSION = "1.4.
|
|
1708
|
+
declare const SDK_VERSION = "1.4.21";
|
|
1600
1709
|
/**
|
|
1601
1710
|
* HTTP header the SDK sends on checkout-session create/read requests so the
|
|
1602
1711
|
* backend can observe compatibility. Version 1.4.9 is the first release that
|
|
@@ -2123,6 +2232,24 @@ interface BuildCheckoutDisplayDataOptions {
|
|
|
2123
2232
|
*/
|
|
2124
2233
|
declare function buildCheckoutDisplayData(session: CheckoutSession, options?: BuildCheckoutDisplayDataOptions): CheckoutDisplayData;
|
|
2125
2234
|
|
|
2235
|
+
interface CaptureMethodEligibilityParams {
|
|
2236
|
+
captureMethod?: CaptureMethod;
|
|
2237
|
+
products?: readonly CheckoutProduct[];
|
|
2238
|
+
items?: readonly CheckoutItem[];
|
|
2239
|
+
subscriptions?: readonly CheckoutSubscription[];
|
|
2240
|
+
}
|
|
2241
|
+
/**
|
|
2242
|
+
* Reject authorisation-only checkout carts that contain a subscription.
|
|
2243
|
+
*
|
|
2244
|
+
* The backend remains authoritative; this shared preflight keeps every SDK
|
|
2245
|
+
* creation style from mounting or redirecting to a checkout that cannot
|
|
2246
|
+
* support manual capture.
|
|
2247
|
+
*
|
|
2248
|
+
* Subscription detection in the unified `products` shape is best-effort:
|
|
2249
|
+
* `CheckoutProduct.type` is optional, so catalog-backed subscriptions that
|
|
2250
|
+
* omit it are resolved and rejected by the authoritative backend validation.
|
|
2251
|
+
*/
|
|
2252
|
+
declare function assertCaptureMethodEligible(params: CaptureMethodEligibilityParams): void;
|
|
2126
2253
|
/**
|
|
2127
2254
|
* Whether a session may be created through the **detached** shell + claim flow
|
|
2128
2255
|
* (TeamFloPay/backend#1099).
|
|
@@ -2186,6 +2313,20 @@ declare function buildItemPayload(item: CheckoutItem, sessionCurrency: string):
|
|
|
2186
2313
|
*/
|
|
2187
2314
|
declare function buildSubscriptionPayload(subscription: CheckoutSubscription, sessionCurrency: string): Record<string, unknown>;
|
|
2188
2315
|
|
|
2316
|
+
/** Returns whether a checkout deliberately stops after placing an authorization hold. */
|
|
2317
|
+
declare function isAuthorizationOnlySession(session?: {
|
|
2318
|
+
captureMethod?: CaptureMethod;
|
|
2319
|
+
} | null): boolean;
|
|
2320
|
+
/**
|
|
2321
|
+
* Returns whether an outcome represents money settled for the active checkout.
|
|
2322
|
+
*
|
|
2323
|
+
* `requires_capture` remains successful for legacy automatic/PayPal flows, but
|
|
2324
|
+
* can never be treated as settled for a manual-capture session.
|
|
2325
|
+
*/
|
|
2326
|
+
declare function isMoneySettledOutcome(outcome?: string | null, captureMethod?: CaptureMethod): boolean;
|
|
2327
|
+
/** Collapses provider/backend reason strings into the SDK's closed failure vocabulary. */
|
|
2328
|
+
declare function normalizeCheckoutFailureOutcome(value: unknown): CheckoutFailureOutcome | undefined;
|
|
2329
|
+
|
|
2189
2330
|
/**
|
|
2190
2331
|
* Look up currency information by ISO 3166-1 alpha-2 country code.
|
|
2191
2332
|
* Falls back to USD when the country is not in the map.
|
|
@@ -2279,4 +2420,4 @@ declare function isUuidV4(value: unknown): value is string;
|
|
|
2279
2420
|
*/
|
|
2280
2421
|
declare function randomUuidV4(): string;
|
|
2281
2422
|
|
|
2282
|
-
export { type AVSFieldConfig, BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, BOLD_DARK_APPEARANCE, BOLD_LIGHT_APPEARANCE, BUTTONS_LAYOUT_BOLD_DARK, BUTTONS_LAYOUT_BOLD_LIGHT, BUTTONS_LAYOUT_DARK, BUTTONS_LAYOUT_DEFAULT, BUTTONS_LAYOUT_GLASS_DARK, BUTTONS_LAYOUT_GLASS_LIGHT, BUTTONS_LAYOUT_MINIMAL, BUTTONS_LAYOUT_MODERN_DARK, BUTTONS_LAYOUT_MODERN_LIGHT, BUTTONS_LAYOUT_ROUNDED, type BeforeButtonClickEvent, type BillingDetails, type BillingProvider, type BuildCheckoutDisplayDataOptions, type BuildTelemetryErrorEventInput, type BuildTelemetryLogEventInput, type BuildTelemetryPerformanceEventInput, type BuildTelemetryTerminalEventInput, type ButtonsLayoutStyles, type ButtonsLayoutTheme, CA_PROVINCES, COUNTRY_OPTIONS, CURRENCY_MAP, type CardCaptureAdapter, type CardCaptureEventType, type CardCaptureMountOptions, type CardCaptureOutcomeEvent, type CardCaptureProviderId, type CheckoutAccount, type CheckoutButtonMethod, type CheckoutDisplayData, type CheckoutGateway, type CheckoutGateways, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutProcessError, type CheckoutProcessingPending, type CheckoutProduct, type CheckoutProductType, type CheckoutSession, type CheckoutSessionProduct, type CheckoutSessionResult, type CheckoutSubscription, type ClassifiedTelemetryFailure, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreateSessionIntentRequest, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DeclineEvent, type DetachedCheckoutSession, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, FLO_SDK_VERSION_HEADER, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, GLASS_DARK_APPEARANCE, GLASS_LIGHT_APPEARANCE, type GatewayEnvironment, IDEMPOTENCY_IN_PROGRESS_CODE, IDEMPOTENCY_KEY_HEADER, type InlineSessionDraft, type InlineSessionParams, type InlineSessionPatch, type LineItem, MAX_IDEMPOTENCY_KEY_LENGTH, MODERN_DARK_APPEARANCE, MODERN_LIGHT_APPEARANCE, type MountedElement, NIGHT_APPEARANCE, type NonCardPaymentMethodCategory, type NormalizedCheckoutSession, type NormalizedGatewayEnvironment, type PayPalPaymentResult, type PayPalSessionIntent, type PayPalSessionIntentRequest, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, STRIPE_EXPRESS_METHODS, STRIPE_METHOD_AMOUNT_LIMITS, STRIPE_METHOD_COUNTRIES, STRIPE_METHOD_CURRENCIES, STRIPE_METHOD_MATRIX, SUPPORTED_CARD_BRANDS, type SentryEventLike, type SentryStackFrameLike, type SerializeTelemetryBatchOptions, type SessionIntent, type SessionIntentDeclineRequest, type StateOption, type StripeMethodEntry, type StripeMethodThemeVariant, type StripeSessionIntent, type StripeSessionIntentRequest, TELEMETRY_ERROR_CODES, TELEMETRY_FAILURE_CATEGORIES, TELEMETRY_LOG_NAMES, TELEMETRY_MAX_BATCH_BYTES, TELEMETRY_MAX_BATCH_EVENTS, TELEMETRY_SCHEMA_VERSION, TELEMETRY_SDK_PACKAGES, THEMES, type TagsData, type TelemetryBatchEnvelope, type TelemetryCheckoutMode, type TelemetryDurationMode, type TelemetryErrorCode, type TelemetryErrorEvent, type TelemetryEvent, type TelemetryEventClass, type TelemetryExpectedOutcome, type TelemetryExpectedOutcomeEvent, type TelemetryFailureCategory, type TelemetryLayout, type TelemetryLogEvent, type TelemetryLogName, type TelemetryPaymentMethodCategory, type TelemetryPerformanceEvent, type TelemetryProvider, type TelemetryProviderInput, type TelemetryRequestCategory, type TelemetrySdkPackage, type TelemetryStage, type TelemetryStatusClass, type ThemeBundle, type ThemeBundleId, type ThemeId, type TokenizedBody, US_STATES, UUID_V4, type UpdateCustomerParams, type VaultCaptureBlock, type VaultCaptureResultMessage, type VaultCardFieldKey, type VaultCardThemeColors, type WebhookEvent, apiError, authenticationError, buildCheckoutDisplayData, buildItemPayload, buildProductPayload, buildSubscriptionPayload, buildTelemetryErrorEvent, buildTelemetryLogEvent, buildTelemetryPerformanceEvent, buildTelemetryTerminalEvent, classifyPaymentRejection, classifyTelemetryFailure, configureFlopay, dropThirdPartyOnlyError, filterStripeMethodsByAmount, filterStripeMethodsByCountry, filterStripeMethodsByCurrency, foldIntoProducts, generateIdempotencyKey, getConfiguredBillingApiUrl, getCountryByCode, getCurrencyByCountry, getFloPayEnvironment, getPostalCodeExample, getPostalCodeLabel, getStateFromPostalCode, getStateLabel, getStateOptions, getStripeMethodDisplayName, hasVendoredStripeMethodLogo, isAVSEnabled, isAVSFieldVisible, isDetachedSessionEligible, isPostalCodeSupported, isSetupIntentClientSecret, isUuidV4, isValidPostalCode, isValidPublishableKey, isValidSecretKey, needsStripeMethodExplicitConfirm, networkError, normalizeGatewayEnvironment, partitionStripeMethods, randomUuidV4, rateLimitError, resolveAVSConfig, resolveBillingApiUrl, resolveButtonsLayoutTheme, resolveIdempotencyKey, resolveSessionCurrency, resolveStripeMethodBrandVariant, resolveTheme, serializeTelemetryBatch, stripeExpressMethodToOptionKey, telemetryStatusClass, validationError };
|
|
2423
|
+
export { type AVSFieldConfig, BILLING_API_URL, BILLING_API_URL_PRODUCTION, BILLING_API_URL_STAGING, BOLD_DARK_APPEARANCE, BOLD_LIGHT_APPEARANCE, BUTTONS_LAYOUT_BOLD_DARK, BUTTONS_LAYOUT_BOLD_LIGHT, BUTTONS_LAYOUT_DARK, BUTTONS_LAYOUT_DEFAULT, BUTTONS_LAYOUT_GLASS_DARK, BUTTONS_LAYOUT_GLASS_LIGHT, BUTTONS_LAYOUT_MINIMAL, BUTTONS_LAYOUT_MODERN_DARK, BUTTONS_LAYOUT_MODERN_LIGHT, BUTTONS_LAYOUT_ROUNDED, type BeforeButtonClickEvent, type BillingDetails, type BillingProvider, type BuildCheckoutDisplayDataOptions, type BuildTelemetryErrorEventInput, type BuildTelemetryLogEventInput, type BuildTelemetryPerformanceEventInput, type BuildTelemetryTerminalEventInput, type ButtonsLayoutStyles, type ButtonsLayoutTheme, CA_PROVINCES, COUNTRY_OPTIONS, CURRENCY_MAP, type CaptureMethod, type CardCaptureAdapter, type CardCaptureEventType, type CardCaptureMountOptions, type CardCaptureOutcomeEvent, type CardCaptureProviderId, type CheckoutAccount, type CheckoutButtonMethod, type CheckoutDisplayData, type CheckoutFailureOutcome, type CheckoutGateway, type CheckoutGateways, type CheckoutItem, type CheckoutMode, type CheckoutModeKind, type CheckoutProcessError, type CheckoutProcessingPending, type CheckoutProduct, type CheckoutProductType, type CheckoutSession, type CheckoutSessionMode, type CheckoutSessionProduct, type CheckoutSessionResult, type CheckoutSubscription, type ClassifiedTelemetryFailure, type ConfirmPaymentParams, type CountryOption, type CreateCustomerParams, type CreateSessionIntentRequest, type CreateSessionParams, type CurrencyInfo, type Customer, DEFAULT_API_BASE_URL, DEFAULT_API_VERSION, DEFAULT_APPEARANCE, DEFAULT_CURRENCY, type DeclineEvent, type DetachedCheckoutSession, type DisplayLineItem, ELEMENT_TYPES, type ElementChangeEvent, type ElementOptions, type ElementType, FLAT_APPEARANCE, FLO_SDK_VERSION_HEADER, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayThemeVariables, GLASS_DARK_APPEARANCE, GLASS_LIGHT_APPEARANCE, type GatewayEnvironment, IDEMPOTENCY_IN_PROGRESS_CODE, IDEMPOTENCY_KEY_HEADER, type InlineSessionDraft, type InlineSessionParams, type InlineSessionPatch, type LineItem, MAX_IDEMPOTENCY_KEY_LENGTH, MODERN_DARK_APPEARANCE, MODERN_LIGHT_APPEARANCE, type MountedElement, NIGHT_APPEARANCE, type NonCardPaymentMethodCategory, type NormalizedCheckoutSession, type NormalizedGatewayEnvironment, type PayPalPaymentResult, type PayPalSessionIntent, type PayPalSessionIntentRequest, type PaymentMethodRemovalConflictCode, type PaymentMethodRemovalConflictError, type PaymentMethodRemovalError, type PaymentMethodRemovalFailureReason, type PaymentMethodRemovalNotFoundError, type PaymentMethodRemovalRetryableError, type PaymentProviderAdapter, type PaymentResult, type PriceData, type ProcessPaymentParams, type RecurringInterval, SDK_VERSION, STRIPE_EXPRESS_METHODS, STRIPE_METHOD_AMOUNT_LIMITS, STRIPE_METHOD_COUNTRIES, STRIPE_METHOD_CURRENCIES, STRIPE_METHOD_MATRIX, SUPPORTED_CARD_BRANDS, type SavedCardDisplay, type SavedPaymentMethodStatus, type SentryEventLike, type SentryStackFrameLike, type SerializeTelemetryBatchOptions, type SessionIntent, type SessionIntentDeclineRequest, type StateOption, type StripeMethodEntry, type StripeMethodThemeVariant, type StripeSessionIntent, type StripeSessionIntentRequest, TELEMETRY_ERROR_CODES, TELEMETRY_FAILURE_CATEGORIES, TELEMETRY_LOG_NAMES, TELEMETRY_MAX_BATCH_BYTES, TELEMETRY_MAX_BATCH_EVENTS, TELEMETRY_SCHEMA_VERSION, TELEMETRY_SDK_PACKAGES, THEMES, type TagsData, type TelemetryBatchEnvelope, type TelemetryCheckoutMode, type TelemetryDurationMode, type TelemetryErrorCode, type TelemetryErrorEvent, type TelemetryEvent, type TelemetryEventClass, type TelemetryExpectedOutcome, type TelemetryExpectedOutcomeEvent, type TelemetryFailureCategory, type TelemetryLayout, type TelemetryLogEvent, type TelemetryLogName, type TelemetryPaymentMethodCategory, type TelemetryPerformanceEvent, type TelemetryProvider, type TelemetryProviderInput, type TelemetryRequestCategory, type TelemetrySdkPackage, type TelemetryStage, type TelemetryStatusClass, type ThemeBundle, type ThemeBundleId, type ThemeId, type TokenizedBody, US_STATES, UUID_V4, type UpdateCustomerParams, type VaultCaptureBlock, type VaultCaptureResultMessage, type VaultCardFieldKey, type VaultCardThemeColors, type WebhookEvent, apiError, assertCaptureMethodEligible, authenticationError, buildCheckoutDisplayData, buildItemPayload, buildProductPayload, buildSubscriptionPayload, buildTelemetryErrorEvent, buildTelemetryLogEvent, buildTelemetryPerformanceEvent, buildTelemetryTerminalEvent, classifyPaymentRejection, classifyTelemetryFailure, configureFlopay, dropThirdPartyOnlyError, filterStripeMethodsByAmount, filterStripeMethodsByCountry, filterStripeMethodsByCurrency, foldIntoProducts, generateIdempotencyKey, getConfiguredBillingApiUrl, getCountryByCode, getCurrencyByCountry, getFloPayEnvironment, getPostalCodeExample, getPostalCodeLabel, getStateFromPostalCode, getStateLabel, getStateOptions, getStripeMethodDisplayName, hasVendoredStripeMethodLogo, isAVSEnabled, isAVSFieldVisible, isAuthorizationOnlySession, isCardSetupCheckoutSession, isDetachedSessionEligible, isMoneySettledOutcome, isPostalCodeSupported, isSetupIntentClientSecret, isUuidV4, isValidPostalCode, isValidPublishableKey, isValidSecretKey, needsStripeMethodExplicitConfirm, networkError, normalizeCheckoutFailureOutcome, normalizeGatewayEnvironment, partitionStripeMethods, randomUuidV4, rateLimitError, resolveAVSConfig, resolveBillingApiUrl, resolveButtonsLayoutTheme, resolveIdempotencyKey, resolveSessionCurrency, resolveStripeMethodBrandVariant, resolveTheme, serializeTelemetryBatch, stripeExpressMethodToOptionKey, telemetryStatusClass, validationError };
|