@flopay/shared 1.14.4 → 1.14.6
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/before-button-click.d.ts +11 -0
- package/dist/card-setup-overlay-theme.d.ts +34 -0
- package/dist/card-setup-surface.d.ts +24 -0
- package/dist/card-setup-theme.d.ts +62 -0
- package/dist/card-setup.d.ts +7 -0
- package/dist/checkout-gateway-rules.d.ts +50 -0
- package/dist/checkout-outcomes.d.ts +14 -0
- package/dist/checkout-payload.d.ts +86 -0
- package/dist/checkout-process-request.d.ts +57 -0
- package/dist/config.d.ts +29 -0
- package/dist/constants.d.ts +452 -0
- package/dist/display.d.ts +64 -0
- package/dist/email-validation.d.ts +2 -0
- package/dist/errors.d.ts +53 -0
- package/dist/external-method-recovery.d.ts +24 -0
- package/dist/friendly-message.d.ts +5 -0
- package/dist/future-use.d.ts +24 -0
- package/dist/idempotency.d.ts +55 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +67 -3739
- package/dist/index.mjs +1 -1
- package/dist/inline-session-cache.d.ts +20 -0
- package/dist/instrument-dispatch.d.ts +28 -0
- package/dist/instruments.d.ts +51 -0
- package/dist/payment-logos.generated.d.ts +1 -0
- package/dist/payment-method-setup-advertisement.d.ts +67 -0
- package/dist/paypal-buyer-identity.d.ts +46 -0
- package/dist/paypal-channel.d.ts +77 -0
- package/dist/paypal-environment.d.ts +14 -0
- package/dist/postal-code-lookup.d.ts +19 -0
- package/dist/postal-code-validation.d.ts +46 -0
- package/dist/primary-tile-style.d.ts +46 -0
- package/dist/recent-completion.d.ts +2 -0
- package/dist/saved-payment-methods.d.ts +96 -0
- package/dist/sentry-filter.d.ts +21 -0
- package/dist/stripe-appearance.d.ts +19 -0
- package/dist/stripe-paypal-presentation.d.ts +42 -0
- package/dist/telemetry-failure.d.ts +14 -0
- package/dist/telemetry.d.ts +161 -0
- package/dist/types.d.ts +1747 -0
- package/dist/uuid.d.ts +19 -0
- package/dist/validation.d.ts +19 -0
- package/dist/vault-submit-theme.d.ts +22 -0
- package/dist/vault-theme.d.ts +28 -0
- package/dist/vault-verification.d.ts +45 -0
- package/dist/wallet-elements-mode.d.ts +27 -0
- package/dist/wallet-sheet-window.d.ts +44 -0
- package/package.json +4 -3
- package/dist/index.d.cts +0 -3739
package/dist/index.d.cts
DELETED
|
@@ -1,3739 +0,0 @@
|
|
|
1
|
-
/** Wire schema version shared with the Flo telemetry ingestion service. */
|
|
2
|
-
declare const TELEMETRY_SCHEMA_VERSION: 1;
|
|
3
|
-
declare const TELEMETRY_SDK_PACKAGES: readonly ["@flopay/shared", "@flopay/js", "@flopay/react"];
|
|
4
|
-
type TelemetrySdkPackage = (typeof TELEMETRY_SDK_PACKAGES)[number];
|
|
5
|
-
declare const TELEMETRY_MAX_BATCH_BYTES: number;
|
|
6
|
-
declare const TELEMETRY_MAX_BATCH_EVENTS = 20;
|
|
7
|
-
type TelemetryEventClass = 'technical_error' | 'lifecycle' | 'expected_outcome' | 'performance';
|
|
8
|
-
declare const TELEMETRY_PROVIDERS: readonly ["stripe", "paypal"];
|
|
9
|
-
type TelemetryProvider = (typeof TELEMETRY_PROVIDERS)[number];
|
|
10
|
-
type TelemetryProviderInput = TelemetryProvider | 'flo' | 'pcivault' | 'other' | 'unknown';
|
|
11
|
-
declare const TELEMETRY_PAYMENT_METHOD_CATEGORIES: readonly ["card", "wallet", "paypal", "apm", "saved", "unknown"];
|
|
12
|
-
type TelemetryPaymentMethodCategory = (typeof TELEMETRY_PAYMENT_METHOD_CATEGORIES)[number];
|
|
13
|
-
declare const TELEMETRY_WALLET_TYPES: readonly ["apple_pay", "google_pay"];
|
|
14
|
-
type TelemetryWalletType = (typeof TELEMETRY_WALLET_TYPES)[number];
|
|
15
|
-
declare const TELEMETRY_OPERATION_OUTCOMES: readonly ["watchdog_expired", "resolved", "rejected", "returned_error", "resolved_late", "rejected_late", "returned_error_late"];
|
|
16
|
-
type TelemetryOperationOutcome = (typeof TELEMETRY_OPERATION_OUTCOMES)[number];
|
|
17
|
-
declare const TELEMETRY_APP_FAMILIES: readonly ["none", "facebook", "instagram", "tiktok", "generic_webview", "other_in_app"];
|
|
18
|
-
type TelemetryAppFamily = (typeof TELEMETRY_APP_FAMILIES)[number];
|
|
19
|
-
declare const TELEMETRY_POPUP_CAPABILITIES: readonly ["unknown", "available", "blocked"];
|
|
20
|
-
type TelemetryPopupCapability = (typeof TELEMETRY_POPUP_CAPABILITIES)[number];
|
|
21
|
-
declare const TELEMETRY_PRESENTATION_MODES: readonly ["popup", "app_switch", "redirect"];
|
|
22
|
-
type TelemetryPresentationMode = (typeof TELEMETRY_PRESENTATION_MODES)[number];
|
|
23
|
-
declare const TELEMETRY_TERMINAL_REASONS: readonly ["approved", "cancelled", "provider_declined", "popup_blocked", "provider_error", "overlay_timeout"];
|
|
24
|
-
type TelemetryTerminalReason = (typeof TELEMETRY_TERMINAL_REASONS)[number];
|
|
25
|
-
declare const TELEMETRY_STAGES: readonly ["callback", "sdk_initialize", "checkout_mount", "session_create", "session_shell", "session_claim", "session_read", "session_first_byte", "session_complete", "checkout_data_ready", "checkout_render", "provider_load", "provider_ready", "provider_confirmation", "overlay_open", "overlay_return", "redirect", "redirect_resume", "vault_request", "vault_mount", "vault_ready", "vault_submit", "tokenization", "three_ds_handoff", "three_ds_return", "processing", "recovery", "completion", "unmount", "total_journey"];
|
|
26
|
-
type TelemetryStage = (typeof TELEMETRY_STAGES)[number];
|
|
27
|
-
declare const TELEMETRY_ERROR_CODES: readonly ["CALLBACK_FAILED", "CHECKOUT_SESSION_CREATE_FAILED", "CONFIGURATION_INVALID", "INTERNAL_SDK_ERROR", "NETWORK_REQUEST_FAILED", "PAYMENT_PROCESSING_FAILED", "POPUP_BLOCKED", "PROVIDER_LOAD_FAILED", "PROVIDER_RUNTIME_FAILED", "RECOVERY_FAILED", "REDIRECT_RESUME_FAILED", "REQUEST_TIMEOUT", "SDK_INITIALIZATION_FAILED", "THREE_DS_FAILED", "TOKENIZATION_FAILED", "VAULT_LOAD_FAILED", "VAULT_SUBMIT_FAILED"];
|
|
28
|
-
type TelemetryErrorCode = (typeof TELEMETRY_ERROR_CODES)[number];
|
|
29
|
-
declare const TELEMETRY_FAILURE_CATEGORIES: readonly ["server_error", "transport_error", "invalid_response", "provider_runtime"];
|
|
30
|
-
type TelemetryFailureCategory = (typeof TELEMETRY_FAILURE_CATEGORIES)[number];
|
|
31
|
-
/**
|
|
32
|
-
* Closed, bounded cause of a technical error. Producers map a provider-neutral
|
|
33
|
-
* discriminant onto one of these values (never free text); anything outside
|
|
34
|
-
* the set becomes `unknown`.
|
|
35
|
-
*/
|
|
36
|
-
declare const TELEMETRY_ERROR_REASONS: readonly ["authorization_declined", "authentication_required", "authorization_expired", "capture_failed", "deferred_contract_mismatch", "intent_unexpected_state", "invalid_request", "confirmation_result_missing", "confirmation_result_not_object", "confirmation_result_unconfirmed", "unknown"];
|
|
37
|
-
type TelemetryErrorReason = (typeof TELEMETRY_ERROR_REASONS)[number];
|
|
38
|
-
/** Closed catalog of SDK-authored lifecycle and operational log names. */
|
|
39
|
-
declare const TELEMETRY_LOG_NAMES: readonly ["sdk.initialize.started", "sdk.initialize.ready", "sdk.cache.hit", "sdk.cache.miss", "checkout.mount", "session.create.started", "session.shell.ready", "session.claim.started", "session.claim.completed", "session.read.started", "session.request.first_byte", "session.request.completed", "checkout.data.ready", "checkout.rendered", "checkout.recovery.started", "checkout.recovery.completed", "checkout.unmount", "provider.load.started", "provider.eligibility.checked", "provider.availability.checked", "provider.ready", "provider.handoff.requested", "provider.popup.opened", "provider.overlay.opened", "provider.overlay.returned", "provider.redirect.started", "provider.redirect.resumed", "vault.capture.requested", "vault.widget.mounted", "vault.widget.ready", "vault.submission.started", "vault.action.required", "vault.three_ds.handoff", "vault.three_ds.returned", "vault.terminal", "payment.method.selected", "payment.intent.started", "payment.intent.completed", "payment.provider_confirmation.started", "payment.provider_confirmation.returned", "payment.tokenization.started", "payment.tokenization.completed", "payment.processing.started", "payment.processing.completed", "payment.three_ds.handoff", "payment.three_ds.returned", "operation.retry", "operation.deduplicated", "operation.fallback", "operation.cache.hit", "operation.cache.miss", "operation.recovery.started", "operation.recovery.completed", "operation.state_transition"];
|
|
40
|
-
type TelemetryLogName = (typeof TELEMETRY_LOG_NAMES)[number];
|
|
41
|
-
declare const TELEMETRY_REQUEST_CATEGORIES: readonly ["session_create", "session_claim", "session_read", "intent_create", "process_payment", "vault_capture", "account_snapshot", "provider_sdk", "other"];
|
|
42
|
-
type TelemetryRequestCategory = (typeof TELEMETRY_REQUEST_CATEGORIES)[number];
|
|
43
|
-
declare const TELEMETRY_STATUS_CLASSES: readonly ["2xx", "3xx", "4xx", "5xx", "network_error", "timeout", "unknown"];
|
|
44
|
-
type TelemetryStatusClass = (typeof TELEMETRY_STATUS_CLASSES)[number];
|
|
45
|
-
declare const TELEMETRY_CHECKOUT_MODES: readonly ["full", "auto", "confirm", "setup", "unknown"];
|
|
46
|
-
type TelemetryCheckoutMode = (typeof TELEMETRY_CHECKOUT_MODES)[number];
|
|
47
|
-
declare const TELEMETRY_LAYOUTS: readonly ["embedded", "buttons", "automatic", "unknown"];
|
|
48
|
-
type TelemetryLayout = (typeof TELEMETRY_LAYOUTS)[number];
|
|
49
|
-
declare const TELEMETRY_DURATION_MODES: readonly ["machine", "buyer", "total"];
|
|
50
|
-
type TelemetryDurationMode = (typeof TELEMETRY_DURATION_MODES)[number];
|
|
51
|
-
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"];
|
|
52
|
-
type TelemetryExpectedOutcome = (typeof TELEMETRY_EXPECTED_OUTCOMES)[number];
|
|
53
|
-
interface TelemetryCommonFields {
|
|
54
|
-
eventId: string;
|
|
55
|
-
stage: TelemetryStage;
|
|
56
|
-
sequence: number;
|
|
57
|
-
provider?: TelemetryProvider;
|
|
58
|
-
attempt?: number;
|
|
59
|
-
statusClass?: TelemetryStatusClass;
|
|
60
|
-
requestCategory?: TelemetryRequestCategory;
|
|
61
|
-
paymentMethodCategory?: TelemetryPaymentMethodCategory;
|
|
62
|
-
walletType?: TelemetryWalletType;
|
|
63
|
-
operationOutcome?: TelemetryOperationOutcome;
|
|
64
|
-
checkoutMode?: TelemetryCheckoutMode;
|
|
65
|
-
layout?: TelemetryLayout;
|
|
66
|
-
inAppBrowser?: boolean;
|
|
67
|
-
appFamily?: TelemetryAppFamily;
|
|
68
|
-
popupCapability?: TelemetryPopupCapability;
|
|
69
|
-
presentationMode?: TelemetryPresentationMode;
|
|
70
|
-
terminalReason?: TelemetryTerminalReason;
|
|
71
|
-
}
|
|
72
|
-
interface BuildTelemetryCommonInput {
|
|
73
|
-
eventId: string;
|
|
74
|
-
stage: TelemetryStage;
|
|
75
|
-
sequence: number;
|
|
76
|
-
provider?: TelemetryProviderInput;
|
|
77
|
-
attempt?: number;
|
|
78
|
-
statusClass?: TelemetryStatusClass;
|
|
79
|
-
requestCategory?: TelemetryRequestCategory;
|
|
80
|
-
paymentMethodCategory?: TelemetryPaymentMethodCategory;
|
|
81
|
-
walletType?: TelemetryWalletType;
|
|
82
|
-
operationOutcome?: TelemetryOperationOutcome;
|
|
83
|
-
checkoutMode?: TelemetryCheckoutMode;
|
|
84
|
-
layout?: TelemetryLayout;
|
|
85
|
-
inAppBrowser?: boolean;
|
|
86
|
-
appFamily?: TelemetryAppFamily;
|
|
87
|
-
popupCapability?: TelemetryPopupCapability;
|
|
88
|
-
presentationMode?: TelemetryPresentationMode;
|
|
89
|
-
terminalReason?: TelemetryTerminalReason;
|
|
90
|
-
}
|
|
91
|
-
interface TelemetryErrorEvent extends TelemetryCommonFields {
|
|
92
|
-
class: 'technical_error';
|
|
93
|
-
code: TelemetryErrorCode;
|
|
94
|
-
failureCategory?: TelemetryFailureCategory;
|
|
95
|
-
reason?: TelemetryErrorReason;
|
|
96
|
-
checkoutSessionId?: string;
|
|
97
|
-
durationMs?: number;
|
|
98
|
-
}
|
|
99
|
-
interface BuildTelemetryErrorEventInput extends BuildTelemetryCommonInput {
|
|
100
|
-
errorCode: TelemetryErrorCode;
|
|
101
|
-
failureCategory?: TelemetryFailureCategory;
|
|
102
|
-
reason?: TelemetryErrorReason;
|
|
103
|
-
checkoutSessionId?: string;
|
|
104
|
-
durationMs?: number;
|
|
105
|
-
}
|
|
106
|
-
interface TelemetryLogEvent extends TelemetryCommonFields {
|
|
107
|
-
class: 'lifecycle';
|
|
108
|
-
name: TelemetryLogName;
|
|
109
|
-
}
|
|
110
|
-
interface BuildTelemetryLogEventInput extends BuildTelemetryCommonInput {
|
|
111
|
-
name: TelemetryLogName;
|
|
112
|
-
}
|
|
113
|
-
interface TelemetryExpectedOutcomeEvent extends TelemetryCommonFields {
|
|
114
|
-
class: 'expected_outcome';
|
|
115
|
-
outcome: TelemetryExpectedOutcome;
|
|
116
|
-
}
|
|
117
|
-
interface BuildTelemetryTerminalEventInput extends Omit<BuildTelemetryCommonInput, 'stage'> {
|
|
118
|
-
outcome: TelemetryExpectedOutcome;
|
|
119
|
-
stage?: TelemetryStage;
|
|
120
|
-
}
|
|
121
|
-
interface TelemetryPerformanceEvent extends TelemetryCommonFields {
|
|
122
|
-
class: 'performance';
|
|
123
|
-
durationMs: number;
|
|
124
|
-
/** True when the measured duration exceeded the bounded wire value. */
|
|
125
|
-
durationTruncated?: true;
|
|
126
|
-
durationMode: TelemetryDurationMode;
|
|
127
|
-
}
|
|
128
|
-
interface BuildTelemetryPerformanceEventInput extends BuildTelemetryCommonInput {
|
|
129
|
-
durationMs: number;
|
|
130
|
-
/** Preserves a previously sanitized truncation marker during serialization. */
|
|
131
|
-
durationTruncated?: boolean;
|
|
132
|
-
durationMode: TelemetryDurationMode;
|
|
133
|
-
}
|
|
134
|
-
type TelemetryEvent = TelemetryErrorEvent | TelemetryLogEvent | TelemetryExpectedOutcomeEvent | TelemetryPerformanceEvent;
|
|
135
|
-
interface SerializeTelemetryBatchOptions {
|
|
136
|
-
correlationId: string;
|
|
137
|
-
sdkPackage: TelemetrySdkPackage;
|
|
138
|
-
sdkVersion: string;
|
|
139
|
-
batchId?: string;
|
|
140
|
-
}
|
|
141
|
-
interface TelemetryBatchEnvelope {
|
|
142
|
-
schemaVersion: typeof TELEMETRY_SCHEMA_VERSION;
|
|
143
|
-
batchId: string;
|
|
144
|
-
correlationId: string;
|
|
145
|
-
sdk: {
|
|
146
|
-
package: TelemetrySdkPackage;
|
|
147
|
-
version: string;
|
|
148
|
-
};
|
|
149
|
-
events: TelemetryEvent[];
|
|
150
|
-
}
|
|
151
|
-
/** Build a closed SDK technical-error event. */
|
|
152
|
-
declare function buildTelemetryErrorEvent(input: BuildTelemetryErrorEventInput): TelemetryErrorEvent;
|
|
153
|
-
/** Build a typed SDK lifecycle event; arbitrary text is never accepted. */
|
|
154
|
-
declare function buildTelemetryLogEvent(input: BuildTelemetryLogEventInput): TelemetryLogEvent;
|
|
155
|
-
/** Build a non-error expected checkout outcome. */
|
|
156
|
-
declare function buildTelemetryTerminalEvent(input: BuildTelemetryTerminalEventInput): TelemetryExpectedOutcomeEvent;
|
|
157
|
-
/** Build a monotonic SDK-owned duration measurement. */
|
|
158
|
-
declare function buildTelemetryPerformanceEvent(input: BuildTelemetryPerformanceEventInput): TelemetryPerformanceEvent;
|
|
159
|
-
/** Serialize one closed backend-owned v1 telemetry envelope. */
|
|
160
|
-
declare function serializeTelemetryBatch(events: readonly TelemetryEvent[], options: SerializeTelemetryBatchOptions): string;
|
|
161
|
-
|
|
162
|
-
/** Discriminated error types returned by the FloPay SDK. */
|
|
163
|
-
type FloPayErrorType = 'validation_error' | 'api_error' | 'authentication_error' | 'rate_limit_error' | 'network_error';
|
|
164
|
-
/** Privacy-bounded diagnostics for an external wallet or PayPal failure. */
|
|
165
|
-
interface ExternalMethodFailureDetails {
|
|
166
|
-
providerCode: string;
|
|
167
|
-
popupBlocked: boolean;
|
|
168
|
-
inAppBrowser: boolean;
|
|
169
|
-
appFamily: TelemetryAppFamily;
|
|
170
|
-
popupCapability: TelemetryPopupCapability;
|
|
171
|
-
presentationMode?: TelemetryPresentationMode;
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Custom error class for all FloPay SDK errors.
|
|
175
|
-
*
|
|
176
|
-
* Extends the native `Error` and adds structured fields that mirror
|
|
177
|
-
* Stripe-style error responses for familiarity.
|
|
178
|
-
*/
|
|
179
|
-
declare class FloPayError extends Error {
|
|
180
|
-
readonly type: FloPayErrorType;
|
|
181
|
-
readonly code?: string;
|
|
182
|
-
readonly declineCode?: string;
|
|
183
|
-
readonly param?: string;
|
|
184
|
-
readonly statusCode?: number;
|
|
185
|
-
readonly details?: ExternalMethodFailureDetails;
|
|
186
|
-
/**
|
|
187
|
-
* The checkout session the failure belongs to, when one exists: for matching
|
|
188
|
-
* it to `payment.*` webhooks, the dashboard, or a support request. Never the
|
|
189
|
-
* session nonce.
|
|
190
|
-
*/
|
|
191
|
-
readonly sessionId?: string;
|
|
192
|
-
/** The underlying error when this one wraps another (the standard `Error.cause` slot). */
|
|
193
|
-
readonly cause?: unknown;
|
|
194
|
-
constructor(message: string, type: FloPayErrorType, options?: {
|
|
195
|
-
code?: string;
|
|
196
|
-
declineCode?: string;
|
|
197
|
-
param?: string;
|
|
198
|
-
statusCode?: number;
|
|
199
|
-
details?: ExternalMethodFailureDetails;
|
|
200
|
-
sessionId?: string;
|
|
201
|
-
cause?: unknown;
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
/** Create a validation error (e.g. missing required field). */
|
|
205
|
-
declare function validationError(message: string, param?: string): FloPayError;
|
|
206
|
-
/** Create an API error (e.g. upstream provider returned an error). */
|
|
207
|
-
declare function apiError(message: string, code?: string, statusCode?: number): FloPayError;
|
|
208
|
-
/** Create an authentication error (e.g. invalid publishable key). */
|
|
209
|
-
declare function authenticationError(message: string): FloPayError;
|
|
210
|
-
/** Create a rate limit error. */
|
|
211
|
-
declare function rateLimitError(message: string): FloPayError;
|
|
212
|
-
/** Create a network error (e.g. fetch failed). */
|
|
213
|
-
declare function networkError(message: string): FloPayError;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* The family a saved payment method belongs to: the same grouping as
|
|
217
|
-
* {@link AdvertisedPaymentMethod.family}. It discriminates {@link SavedPaymentMethodDisplay} by
|
|
218
|
-
* `type`. The billing API's list request takes a method type instead, typed as
|
|
219
|
-
* {@link SavedPaymentMethodListType}.
|
|
220
|
-
*/
|
|
221
|
-
type SavedPaymentMethodFamily = 'card' | 'wallet' | 'paypal' | 'apm';
|
|
222
|
-
/**
|
|
223
|
-
* Every {@link SavedPaymentMethodFamily}, for exhaustive handling and grouping.
|
|
224
|
-
* A plain readonly literal like the other shared constants: a module-scope `Object.freeze` call
|
|
225
|
-
* cannot be tree-shaken, so every checkout bundle would carry it.
|
|
226
|
-
*/
|
|
227
|
-
declare const SAVED_PAYMENT_METHOD_FAMILIES: readonly SavedPaymentMethodFamily[];
|
|
228
|
-
/**
|
|
229
|
-
* The family a saved payment method belongs to.
|
|
230
|
-
* @deprecated Use {@link SavedPaymentMethodFamily}, the same type. For the list request's `type`,
|
|
231
|
-
* use {@link SavedPaymentMethodListType}: the billing API does not accept `wallet` or `apm` there.
|
|
232
|
-
*/
|
|
233
|
-
type SavedPaymentMethodType = SavedPaymentMethodFamily;
|
|
234
|
-
/**
|
|
235
|
-
* Every saved payment method family, the same values in the same order as
|
|
236
|
-
* {@link SAVED_PAYMENT_METHOD_FAMILIES}. Its own plain readonly literal, so it tree-shakes too.
|
|
237
|
-
* @deprecated Use {@link SAVED_PAYMENT_METHOD_FAMILIES}. For the list request's `type`, use
|
|
238
|
-
* {@link SAVED_PAYMENT_METHOD_LIST_TYPES}.
|
|
239
|
-
*/
|
|
240
|
-
declare const SAVED_PAYMENT_METHOD_TYPES: readonly SavedPaymentMethodType[];
|
|
241
|
-
/**
|
|
242
|
-
* A method type the billing API's saved payment method list (`GET /v1/payment-methods`) accepts as
|
|
243
|
-
* its `type` filter: `card`, `paypal`, or a saved wallet or APM method type. It is a method type,
|
|
244
|
-
* never a family, so `wallet` and `apm` are not values; nor is the setup flow's `paypal_vaulted`.
|
|
245
|
-
*/
|
|
246
|
-
type SavedPaymentMethodListType = 'card' | 'paypal' | 'apple_pay' | 'google_pay' | 'sepa_debit' | 'us_bank_account';
|
|
247
|
-
/**
|
|
248
|
-
* Every {@link SavedPaymentMethodListType}: exactly the values the billing API accepts for the list
|
|
249
|
-
* `type` filter. A plain readonly literal that tree-shakes, like {@link SAVED_PAYMENT_METHOD_FAMILIES}.
|
|
250
|
-
*/
|
|
251
|
-
declare const SAVED_PAYMENT_METHOD_LIST_TYPES: readonly SavedPaymentMethodListType[];
|
|
252
|
-
/** Saved card in the generalised display type; `type` stays optional for card-only consumers. */
|
|
253
|
-
interface SavedCardPaymentMethodDisplay extends SavedCardDisplay {
|
|
254
|
-
type?: 'card';
|
|
255
|
-
/** The row's method type as the billing API returns it: always `card` for a card. */
|
|
256
|
-
methodType?: 'card';
|
|
257
|
-
label?: string;
|
|
258
|
-
/** The billing API's display label for the row; `null` for a card, so build one from `brand`. */
|
|
259
|
-
displayLabel?: string | null;
|
|
260
|
-
}
|
|
261
|
-
/** Saved non-card method: only safe, display-only label fields. */
|
|
262
|
-
interface SavedOtherPaymentMethodDisplay {
|
|
263
|
-
id: string;
|
|
264
|
-
/** The method's family, for grouping. */
|
|
265
|
-
type: 'wallet' | 'paypal' | 'apm';
|
|
266
|
-
/**
|
|
267
|
-
* The row's method type as the billing API returns it, such as `apple_pay`, `google_pay`,
|
|
268
|
-
* `sepa_debit`, `us_bank_account` or `paypal`. It tells methods of one family apart. An open
|
|
269
|
-
* string: a newer billing API may return a type this SDK does not name yet.
|
|
270
|
-
*/
|
|
271
|
-
methodType?: string;
|
|
272
|
-
/** @deprecated Use {@link SavedOtherPaymentMethodDisplay.displayLabel}, which holds the same value. */
|
|
273
|
-
label: string;
|
|
274
|
-
/** The billing API's safe display label for the row. */
|
|
275
|
-
displayLabel?: string;
|
|
276
|
-
status: SavedPaymentMethodStatus;
|
|
277
|
-
}
|
|
278
|
-
/** Display-only saved payment method of any type. */
|
|
279
|
-
type SavedPaymentMethodDisplay = SavedCardPaymentMethodDisplay | SavedOtherPaymentMethodDisplay;
|
|
280
|
-
/** Optional filter for listing saved payment methods. */
|
|
281
|
-
interface ListSavedPaymentMethodsQuery {
|
|
282
|
-
/** List only methods of this method type. Leave it out to list every saved method. */
|
|
283
|
-
type?: SavedPaymentMethodListType;
|
|
284
|
-
}
|
|
285
|
-
/**
|
|
286
|
-
* Whether a read session is a no-charge setup session, whatever methods it advertises.
|
|
287
|
-
* Only the explicit setup mode, a zero amount and an empty cart decide it: the billing API
|
|
288
|
-
* alone chooses which methods (and gateways) a setup session offers, so
|
|
289
|
-
* `advertisedPaymentMethods` is never consulted here.
|
|
290
|
-
*/
|
|
291
|
-
declare function isSetupCheckoutSession(session: CheckoutSession): boolean;
|
|
292
|
-
/**
|
|
293
|
-
* One payment method a setup session advertises, exactly as the billing API sends it
|
|
294
|
-
* (backend docs/card-setup.md, "Advertised payment methods"). The values are open:
|
|
295
|
-
* a client skips a `family` or `paymentMethodType` it does not know.
|
|
296
|
-
*/
|
|
297
|
-
interface AdvertisedPaymentMethod {
|
|
298
|
-
/** `card`, `wallet`, `apm` or `paypal` today. */
|
|
299
|
-
family: string;
|
|
300
|
-
/** The method itself: `card`, `apple_pay`, `sepa_debit`, `paypal_vaulted`, ... */
|
|
301
|
-
paymentMethodType: string;
|
|
302
|
-
/** The gateway the backend chose for this method. */
|
|
303
|
-
gatewayId: string;
|
|
304
|
-
/** That gateway's provider: `stripe` or `paypal` today. */
|
|
305
|
-
providerType: string;
|
|
306
|
-
/** This method's own publishable key (the client id for PayPal). */
|
|
307
|
-
publishableKey: string;
|
|
308
|
-
environment: string;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/** Theme variables that map to CSS custom properties on FloPay elements. */
|
|
312
|
-
interface FloPayThemeVariables {
|
|
313
|
-
colorPrimary?: string;
|
|
314
|
-
/** Hover background for all "flo" buttons (submit / card / wallet CTAs). */
|
|
315
|
-
colorPrimaryHover?: string;
|
|
316
|
-
colorBackground?: string;
|
|
317
|
-
colorText?: string;
|
|
318
|
-
colorDanger?: string;
|
|
319
|
-
borderRadius?: string;
|
|
320
|
-
fontFamily?: string;
|
|
321
|
-
fontSizeBase?: string;
|
|
322
|
-
spacingUnit?: string;
|
|
323
|
-
}
|
|
324
|
-
/** Controls the visual appearance of all FloPay elements. */
|
|
325
|
-
interface FloPayAppearance {
|
|
326
|
-
theme?: 'default' | 'flat' | 'night' | 'none';
|
|
327
|
-
variables?: FloPayThemeVariables;
|
|
328
|
-
/** CSS-like rules keyed by selector (e.g. `".Input"`, `".Label"`). */
|
|
329
|
-
rules?: Record<string, Record<string, string>>;
|
|
330
|
-
}
|
|
331
|
-
/** Style overrides for the `buttons` layout mode. */
|
|
332
|
-
interface ButtonsLayoutStyles {
|
|
333
|
-
/** Style for the "Credit / Debit Card" button. */
|
|
334
|
-
cardButton?: Record<string, string | number>;
|
|
335
|
-
/** Font size for the "Credit / Debit Card" button label. */
|
|
336
|
-
cardButtonFontSize?: string;
|
|
337
|
-
/** Style for the card form container when expanded. */
|
|
338
|
-
cardFormContainer?: Record<string, string | number>;
|
|
339
|
-
/** Border color for card input fields. */
|
|
340
|
-
cardInputBorder?: string;
|
|
341
|
-
/** Text color inside the card input fields (number, expiry, CVC). */
|
|
342
|
-
cardInputColor?: string;
|
|
343
|
-
/** Placeholder text color for the card input fields. */
|
|
344
|
-
cardInputPlaceholderColor?: string;
|
|
345
|
-
/** Font size for the card input fields. */
|
|
346
|
-
cardInputFontSize?: string;
|
|
347
|
-
/** Background color for card input fields. */
|
|
348
|
-
cardInputBackground?: string;
|
|
349
|
-
/**
|
|
350
|
-
* Opt-in escape hatch for vault-only style hooks that the appearance →
|
|
351
|
-
* hosted-field mapper cannot express. Merged last (last-write-wins) into the
|
|
352
|
-
* style config handed to the vault PCI card form, so these win over the
|
|
353
|
-
* auto-translated `cardInput*` knobs and `appearance.variables`. Keys are
|
|
354
|
-
* passed through verbatim — use vault-supported style property names.
|
|
355
|
-
* Applied only to the hosted vault card form.
|
|
356
|
-
*/
|
|
357
|
-
vaultCardForm?: Record<string, string | number>;
|
|
358
|
-
/** Style for the full-name text input. */
|
|
359
|
-
nameInput?: Record<string, string | number>;
|
|
360
|
-
/** Style for the "Go back" button text/container. */
|
|
361
|
-
backButton?: Record<string, string | number>;
|
|
362
|
-
/** Font size for the "Go back" button label. */
|
|
363
|
-
backButtonFontSize?: string;
|
|
364
|
-
/** Style for the back button circle icon. */
|
|
365
|
-
backButtonIcon?: Record<string, string | number>;
|
|
366
|
-
/** Style for the submit/confirm button. */
|
|
367
|
-
submitButton?: Record<string, string | number>;
|
|
368
|
-
/** Font size for the submit button label. */
|
|
369
|
-
submitButtonFontSize?: string;
|
|
370
|
-
/** Style for the "Secure card checkout" title. */
|
|
371
|
-
title?: Record<string, string | number>;
|
|
372
|
-
/** Font size for the "Secure card checkout" title. */
|
|
373
|
-
titleFontSize?: string;
|
|
374
|
-
/** Style for the error banner. */
|
|
375
|
-
errorBanner?: Record<string, string | number>;
|
|
376
|
-
/** Style for the country select dropdown container (AVS). */
|
|
377
|
-
countrySelect?: Record<string, string | number>;
|
|
378
|
-
/** Style for the ZIP/postcode input container (AVS). */
|
|
379
|
-
zipInput?: Record<string, string | number>;
|
|
380
|
-
/** Style for the street address input (AVS address_line_1). */
|
|
381
|
-
addressLine1Input?: Record<string, string | number>;
|
|
382
|
-
/** Style for the apt/suite input (AVS address_line_2). */
|
|
383
|
-
addressLine2Input?: Record<string, string | number>;
|
|
384
|
-
/** Style for the city input (AVS). */
|
|
385
|
-
cityInput?: Record<string, string | number>;
|
|
386
|
-
/** Style for the state/province input or dropdown (AVS). */
|
|
387
|
-
stateInput?: Record<string, string | number>;
|
|
388
|
-
}
|
|
389
|
-
/** Predefined theme for the `buttons` layout. */
|
|
390
|
-
type ButtonsLayoutTheme = 'default' | 'minimal' | 'rounded' | 'dark' | 'modern-light' | 'modern-dark' | 'bold-light' | 'bold-dark' | 'glass-light' | 'glass-dark';
|
|
391
|
-
/**
|
|
392
|
-
* Identifier for a coherent {appearance, buttonsLayout} theme bundle exported
|
|
393
|
-
* by `@flopay/shared`. Subset of `ButtonsLayoutTheme` covering the bundles
|
|
394
|
-
* that ship matching `*_APPEARANCE` + `BUTTONS_LAYOUT_*` halves.
|
|
395
|
-
*/
|
|
396
|
-
type ThemeBundleId = 'modern-light' | 'modern-dark' | 'bold-light' | 'bold-dark' | 'glass-light' | 'glass-dark';
|
|
397
|
-
/**
|
|
398
|
-
* Theme identifier accepted by FloPay React components (`FloPayCheckout`,
|
|
399
|
-
* `FloPayAutomaticPaymentButton`, `SplitCardForm`) on the `theme` prop.
|
|
400
|
-
*
|
|
401
|
-
* - `'classic'` — historic FloPay look (no bundle applied); kept as the
|
|
402
|
-
* no-theme baseline so consumers can declare it explicitly.
|
|
403
|
-
* - Bundle ids (`'modern-light'`, `'glass-dark'`, …) pull both halves
|
|
404
|
-
* (`appearance` + `buttonsLayout`) from {@link THEMES} so a single prop
|
|
405
|
-
* styles every part of the checkout consistently.
|
|
406
|
-
*/
|
|
407
|
-
type ThemeId = 'classic' | ThemeBundleId;
|
|
408
|
-
/** A coherent theme: appearance for Stripe Elements + wrapper styles for the FloPay buttons/card form. */
|
|
409
|
-
interface ThemeBundle {
|
|
410
|
-
appearance: FloPayAppearance;
|
|
411
|
-
buttonsLayout: ButtonsLayoutStyles;
|
|
412
|
-
}
|
|
413
|
-
/**
|
|
414
|
-
* Per-field AVS configuration.
|
|
415
|
-
* - `true` = show for all countries
|
|
416
|
-
* - `string[]` = show only for listed country codes (ISO 3166-1 alpha-2)
|
|
417
|
-
* - `false` or omitted = hidden
|
|
418
|
-
*/
|
|
419
|
-
interface AVSFieldConfig {
|
|
420
|
-
/** Street address (line 1). */
|
|
421
|
-
address_line_1?: boolean | string[];
|
|
422
|
-
/** Apt, suite, unit, etc. (line 2). */
|
|
423
|
-
address_line_2?: boolean | string[];
|
|
424
|
-
/** City / Town. */
|
|
425
|
-
city?: boolean | string[];
|
|
426
|
-
/** State / Province / Region. Renders as dropdown for US and CA. */
|
|
427
|
-
state?: boolean | string[];
|
|
428
|
-
/** ZIP / Postal code. */
|
|
429
|
-
postal_code?: boolean | string[];
|
|
430
|
-
/** Country dropdown. */
|
|
431
|
-
country?: boolean | string[];
|
|
432
|
-
}
|
|
433
|
-
/** A customer attached to a checkout session. */
|
|
434
|
-
interface Customer {
|
|
435
|
-
id: string;
|
|
436
|
-
email: string;
|
|
437
|
-
firstName?: string;
|
|
438
|
-
lastName?: string;
|
|
439
|
-
gender?: string;
|
|
440
|
-
city?: string;
|
|
441
|
-
state?: string;
|
|
442
|
-
country?: string;
|
|
443
|
-
zip?: string;
|
|
444
|
-
/** Street address (line 1). */
|
|
445
|
-
line1?: string;
|
|
446
|
-
/** Apt, suite, unit (line 2). */
|
|
447
|
-
line2?: string;
|
|
448
|
-
}
|
|
449
|
-
/** Recurring interval configuration for subscription line items. */
|
|
450
|
-
interface RecurringInterval {
|
|
451
|
-
interval: 'month' | 'year';
|
|
452
|
-
intervalCount?: number;
|
|
453
|
-
}
|
|
454
|
-
/** Inline product data when no pre-created price is referenced. */
|
|
455
|
-
interface PriceData {
|
|
456
|
-
currency: string;
|
|
457
|
-
unitAmount: number;
|
|
458
|
-
productData: {
|
|
459
|
-
name: string;
|
|
460
|
-
description?: string;
|
|
461
|
-
};
|
|
462
|
-
recurring?: RecurringInterval;
|
|
463
|
-
}
|
|
464
|
-
/** A single line item within a checkout session. */
|
|
465
|
-
interface LineItem {
|
|
466
|
-
/** Reference to a pre-created price object on the provider. */
|
|
467
|
-
price?: string;
|
|
468
|
-
/** Inline price data (used when no `price` reference exists). */
|
|
469
|
-
priceData?: PriceData;
|
|
470
|
-
quantity: number;
|
|
471
|
-
}
|
|
472
|
-
/** Checkout mode controlling the payment UI behavior. */
|
|
473
|
-
type CheckoutMode = 'full' | 'auto' | 'confirm';
|
|
474
|
-
/** Merchant preference for wallet approval presentation when the provider supports it. */
|
|
475
|
-
type WalletPresentation = 'auto' | 'popup' | 'prefer_redirect';
|
|
476
|
-
/** Non-sensitive client context preserved with a checkout session. */
|
|
477
|
-
type CheckoutMetadata = Record<string, string>;
|
|
478
|
-
/**
|
|
479
|
-
* Checkout mode reported by a session read. `setup` is read-only in the
|
|
480
|
-
* browser SDK: merchant-authenticated setup-session creation stays on the
|
|
481
|
-
* merchant's server (its body is {@link CreateCardSetupSessionRequest}), while
|
|
482
|
-
* the existing create parameter types intentionally continue to accept only
|
|
483
|
-
* {@link CheckoutMode}.
|
|
484
|
-
*/
|
|
485
|
-
type CheckoutSessionMode = CheckoutMode | 'setup';
|
|
486
|
-
/** Whether checkout captures immediately or only authorises funds for later capture. */
|
|
487
|
-
type CaptureMethod = 'automatic' | 'manual';
|
|
488
|
-
/** Stable, provider-neutral authorization lifecycle failures exposed by the SDK. */
|
|
489
|
-
type CheckoutFailureOutcome = 'authorization_declined' | 'authentication_required' | 'authorization_expired' | 'capture_failed';
|
|
490
|
-
/** Stable provider-neutral outcome for a saved method that cannot fund this checkout. */
|
|
491
|
-
type StoredPaymentMethodOutcomeCode = 'stored_payment_method_unsupported';
|
|
492
|
-
/** Lifecycle states returned by the merchant-scoped saved-method list. */
|
|
493
|
-
type SavedPaymentMethodStatus = 'pending' | 'active' | 'deleted';
|
|
494
|
-
/**
|
|
495
|
-
* Display-only card fields safe to show to a customer. This deliberately has
|
|
496
|
-
* no provider payment-method id, vault token, capture reference, or reusable
|
|
497
|
-
* credential.
|
|
498
|
-
*/
|
|
499
|
-
interface SavedCardDisplay {
|
|
500
|
-
/** FloPay payment-method UUID. */
|
|
501
|
-
id: string;
|
|
502
|
-
brand: string;
|
|
503
|
-
lastFour: string;
|
|
504
|
-
expiryMonth: number;
|
|
505
|
-
expiryYear: number;
|
|
506
|
-
status: SavedPaymentMethodStatus;
|
|
507
|
-
}
|
|
508
|
-
/** Stable conflicts returned by `DELETE /v1/payment-methods/:id`. */
|
|
509
|
-
type PaymentMethodRemovalConflictCode = 'payment_method_has_active_payment' | 'payment_method_in_use' | 'payment_method_reassignment_requires_payer_action';
|
|
510
|
-
/** Indistinguishable missing-or-inaccessible saved-method response. */
|
|
511
|
-
interface PaymentMethodRemovalNotFoundError {
|
|
512
|
-
statusCode: 404;
|
|
513
|
-
code: 'payment_method_not_found';
|
|
514
|
-
message?: string;
|
|
515
|
-
}
|
|
516
|
-
/** A blocked removal that requires merchant/customer guidance. */
|
|
517
|
-
interface PaymentMethodRemovalConflictError {
|
|
518
|
-
statusCode: 409;
|
|
519
|
-
code: PaymentMethodRemovalConflictCode;
|
|
520
|
-
message?: string;
|
|
521
|
-
}
|
|
522
|
-
/** Provider-neutral reason accompanying a retry-safe removal failure. */
|
|
523
|
-
type PaymentMethodRemovalFailureReason = 'payment_method_data_incomplete' | 'provider_cleanup_failed' | 'provider_unavailable' | 'provider_verification_failed';
|
|
524
|
-
/** Retry-safe incomplete provider/vault cleanup response. */
|
|
525
|
-
interface PaymentMethodRemovalRetryableError {
|
|
526
|
-
statusCode: 502;
|
|
527
|
-
code: 'payment_method_deletion_failed';
|
|
528
|
-
reason: PaymentMethodRemovalFailureReason;
|
|
529
|
-
retrySafe: true;
|
|
530
|
-
resolution: string;
|
|
531
|
-
message?: string;
|
|
532
|
-
}
|
|
533
|
-
/** Stable error union for merchant-server saved-method removal calls. */
|
|
534
|
-
type PaymentMethodRemovalError = PaymentMethodRemovalNotFoundError | PaymentMethodRemovalConflictError | PaymentMethodRemovalRetryableError;
|
|
535
|
-
/**
|
|
536
|
-
* Stripe's future-use values. Future use is platform policy: the billing API
|
|
537
|
-
* sets every Stripe attempt up `'off_session'` and reports it on the session
|
|
538
|
-
* read as `CheckoutSession.futureUse`.
|
|
539
|
-
*/
|
|
540
|
-
type CardSetupFutureUse = 'on_session' | 'off_session';
|
|
541
|
-
/**
|
|
542
|
-
* A method the billing API cannot set up for future use (read field
|
|
543
|
-
* `futureUseUnsupported`). `reason` is the billing API's own code, passed
|
|
544
|
-
* through unchanged.
|
|
545
|
-
*/
|
|
546
|
-
interface FutureUseUnsupportedMethod {
|
|
547
|
-
paymentMethodType: string;
|
|
548
|
-
reason: string;
|
|
549
|
-
}
|
|
550
|
-
/**
|
|
551
|
-
* Body of the merchant-authenticated `POST /v1/checkouts/sessions/setup`
|
|
552
|
-
* request. Type-only: no FloPay package sends it or holds the merchant
|
|
553
|
-
* credential it needs. The merchant's server sends it with its own
|
|
554
|
-
* authenticated client and passes only the returned session id and nonce to
|
|
555
|
-
* the browser card-setup component.
|
|
556
|
-
*
|
|
557
|
-
* `country`, `currency`, and `futureUse` are independent, optional transaction
|
|
558
|
-
* context honoured by billing API v1.9.48+; older billing APIs silently ignore
|
|
559
|
-
* them. Send values as you hold them: the billing API owns normalization,
|
|
560
|
-
* validation, and defaults, and alone decides which gateway verifies the card.
|
|
561
|
-
* This context never selects or hints a gateway.
|
|
562
|
-
*/
|
|
563
|
-
interface CreateCardSetupSessionRequest {
|
|
564
|
-
/** UUID of an existing FloPay customer linked to the authenticated merchant. */
|
|
565
|
-
userId: string;
|
|
566
|
-
/** Success URL recorded on the setup session. */
|
|
567
|
-
successUrl?: string | null;
|
|
568
|
-
/** Cancel URL recorded on the setup session. */
|
|
569
|
-
cancelUrl?: string | null;
|
|
570
|
-
/**
|
|
571
|
-
* ISO 3166-1 alpha-2 country the card will be used in. The billing API trims
|
|
572
|
-
* and uppercases it before validating it, and never infers a currency from it.
|
|
573
|
-
*/
|
|
574
|
-
country?: string | null;
|
|
575
|
-
/**
|
|
576
|
-
* Three-letter code of the currency later payments will be charged in. The
|
|
577
|
-
* billing API trims and uppercases it before validating it, and never infers
|
|
578
|
-
* a country from it. When supplied, it becomes the setup session's currency.
|
|
579
|
-
*/
|
|
580
|
-
currency?: string | null;
|
|
581
|
-
/**
|
|
582
|
-
* @deprecated Future use is platform policy: the billing API always sets up
|
|
583
|
-
* `'off_session'` and ignores this value. Still accepted, so existing
|
|
584
|
-
* requests keep working; leave it out of new code.
|
|
585
|
-
*/
|
|
586
|
-
futureUse?: CardSetupFutureUse | null;
|
|
587
|
-
}
|
|
588
|
-
/**
|
|
589
|
-
* Discriminator describing whether a checkout product is a one-time item or a
|
|
590
|
-
* recurring subscription. Mirrors the backend's `ProductTypeEnum`.
|
|
591
|
-
*/
|
|
592
|
-
type CheckoutProductType = 'item' | 'subscription';
|
|
593
|
-
/** Unified checkout product from a session response. */
|
|
594
|
-
interface CheckoutSessionProduct {
|
|
595
|
-
uuid: string;
|
|
596
|
-
checkoutSessionId: string;
|
|
597
|
-
/**
|
|
598
|
-
* Whether this product is a one-time item or a recurring subscription.
|
|
599
|
-
* Optional to mirror {@link CheckoutProduct.type}; when omitted, consumers
|
|
600
|
-
* treat the product as an `'item'` for display ordering.
|
|
601
|
-
*/
|
|
602
|
-
type?: CheckoutProductType;
|
|
603
|
-
/** Preferred catalog code for the product. */
|
|
604
|
-
code?: string;
|
|
605
|
-
/**
|
|
606
|
-
* Display-only name. Resolved from the catalog server-side; the SDK
|
|
607
|
-
* populates this from the client-side display cache when missing.
|
|
608
|
-
*/
|
|
609
|
-
name?: string | null;
|
|
610
|
-
/** Display-only description from the catalog. */
|
|
611
|
-
description?: string | null;
|
|
612
|
-
quantity: number;
|
|
613
|
-
/** Display-only. Populated from cache when the server omits it. */
|
|
614
|
-
totalAmount?: number;
|
|
615
|
-
/** Display-only. Populated from cache when the server omits it. */
|
|
616
|
-
overrideAmount?: number | null;
|
|
617
|
-
/** @deprecated Prefer the session-level `currency` on {@link CheckoutSession}. */
|
|
618
|
-
currency?: string;
|
|
619
|
-
metadata?: Record<string, unknown> | null;
|
|
620
|
-
}
|
|
621
|
-
/**
|
|
622
|
-
* Environment for an upstream gateway. Accepts both the gateway-native values
|
|
623
|
-
* (`'sandbox'` | `'live'`) and FloPay's internal aliases (`'stage'` |
|
|
624
|
-
* `'production'`) so the same string can flow from the billing API straight
|
|
625
|
-
* to gateway SDKs without translation at every call site. Use
|
|
626
|
-
* {@link normalizeGatewayEnvironment} to collapse to the canonical pair
|
|
627
|
-
* before handing the value to a gateway SDK.
|
|
628
|
-
*/
|
|
629
|
-
type GatewayEnvironment = 'sandbox' | 'live' | 'stage' | 'production';
|
|
630
|
-
/** Canonical gateway-native form returned by {@link normalizeGatewayEnvironment}. */
|
|
631
|
-
type NormalizedGatewayEnvironment = 'sandbox' | 'live';
|
|
632
|
-
/**
|
|
633
|
-
* Map FloPay's environment aliases to the gateway-native `'sandbox'`/`'live'`
|
|
634
|
-
* pair. `'stage'` → `'sandbox'`, `'production'` → `'live'`. Returns `undefined`
|
|
635
|
-
* for `undefined` input and logs a console warning for unrecognized strings
|
|
636
|
-
* (so misconfiguration surfaces immediately instead of hanging later — most
|
|
637
|
-
* gateway SDKs silently fall back to live endpoints on an unknown env, which
|
|
638
|
-
* then fails opaquely against sandbox credentials).
|
|
639
|
-
*/
|
|
640
|
-
declare function normalizeGatewayEnvironment(env: GatewayEnvironment | string | undefined | null): NormalizedGatewayEnvironment | undefined;
|
|
641
|
-
/** Per-gateway configuration returned by the billing API. */
|
|
642
|
-
interface CheckoutGateway {
|
|
643
|
-
/** Public client identifier (e.g. Stripe publishable key, PayPal client id). */
|
|
644
|
-
publishableKey?: string | null;
|
|
645
|
-
/** Sandbox or live mode for the gateway credentials. */
|
|
646
|
-
environment?: GatewayEnvironment;
|
|
647
|
-
/**
|
|
648
|
-
* Optional Stripe PaymentIntent client secret exposed by the billing API
|
|
649
|
-
* when additional authentication is required for a saved payment method.
|
|
650
|
-
* Stripe-specific.
|
|
651
|
-
*/
|
|
652
|
-
stripeClientSecret?: string | null;
|
|
653
|
-
/**
|
|
654
|
-
* Optional publishable key for a dedicated Stripe sub-account that renders
|
|
655
|
-
* PayPal via Stripe Elements. Stripe-specific. Distinct from
|
|
656
|
-
* `gateways.paypal.publishableKey`, which is a PayPal client id used by the
|
|
657
|
-
* direct PayPal SDK.
|
|
658
|
-
*/
|
|
659
|
-
paypalPublishableKey?: string | null;
|
|
660
|
-
/**
|
|
661
|
-
* Per-session list of payment method type identifiers that the gateway has
|
|
662
|
-
* enabled for this consumer (e.g. `['apple_pay', 'google_pay', 'cashapp',
|
|
663
|
-
* 'klarna']`). Populated by the billing API after looking up the gateway's
|
|
664
|
-
* Payment Method Configurations. The SDK partitions this list against
|
|
665
|
-
* {@link STRIPE_EXPRESS_METHODS} to decide which methods render in the
|
|
666
|
-
* `ExpressCheckoutElement` row (Apple Pay / Google Pay / PayPal / Link /
|
|
667
|
-
* Amazon Pay / Klarna) vs the `PaymentElement` accordion (Cash App Pay /
|
|
668
|
-
* Affirm / iDEAL / Bancontact / …). `card` is never rendered by Stripe:
|
|
669
|
-
* starting with SDK 1.4.9, its presence explicitly advertises that the
|
|
670
|
-
* provider-neutral hosted card form can be recovered from
|
|
671
|
-
* `POST /v1/checkouts/sessions/{id}/vault/capture` when no embedded
|
|
672
|
-
* {@link CheckoutSession.vault} block is present. Absent on legacy backends.
|
|
673
|
-
* `SplitCardForm` uses this list to scope the retained wallet/APM surfaces.
|
|
674
|
-
* When a buyer selects one, the SDK requests a session-scoped intent for
|
|
675
|
-
* that explicit method. Card checkout uses the hosted vault.
|
|
676
|
-
*/
|
|
677
|
-
enabledPaymentMethods?: string[];
|
|
678
|
-
/**
|
|
679
|
-
* Per-method buyer-country gate (uppercase ISO 3166-1 alpha-2), keyed by the
|
|
680
|
-
* same method strings as {@link enabledPaymentMethods}. A method absent here
|
|
681
|
-
* has no country restriction. The SDK filters the rendered tile row by the
|
|
682
|
-
* buyer's *live* country (which can change via AVS after the session is
|
|
683
|
-
* created) against this map — so per-method country eligibility lives in one
|
|
684
|
-
* place (the backend) rather than a hardcoded SDK table. Absent on legacy
|
|
685
|
-
* backends (the SDK then falls back to its built-in table).
|
|
686
|
-
*/
|
|
687
|
-
enabledPaymentMethodCountries?: Record<string, string[]>;
|
|
688
|
-
/**
|
|
689
|
-
* PayPal object the backend selected for this checkout continuation — which
|
|
690
|
-
* PayPal JS flow the session needs. New backends advertise `'order'` or
|
|
691
|
-
* `'setup_token'` (legacy provider-managed subscriptions are expressed by
|
|
692
|
-
* omission, though `'subscription'` remains accepted for robustness). Absent
|
|
693
|
-
* → released fallback: `isSubscription ? 'subscription' : 'order'`. The
|
|
694
|
-
* backend suppresses this advertisement for `x-flo-sdk-version` readers
|
|
695
|
-
* older than 1.6.0 (header-less direct integrations always see it);
|
|
696
|
-
* advertisement only — routing follows the payment-method type the client
|
|
697
|
-
* requests. On `gateways.paypal`, {@link enabledPaymentMethods} may also
|
|
698
|
-
* carry an informational `'paypal_vaulted'` entry when the Flo-owned
|
|
699
|
-
* channel is available.
|
|
700
|
-
*/
|
|
701
|
-
providerObjectType?: PayPalProviderObjectType;
|
|
702
|
-
/**
|
|
703
|
-
* Backend-advertised approval presentation for a one-time PayPal Order.
|
|
704
|
-
* Return URLs and resume capabilities remain backend-owned.
|
|
705
|
-
*/
|
|
706
|
-
approvalPresentation?: PayPalApprovalPresentation;
|
|
707
|
-
}
|
|
708
|
-
/**
|
|
709
|
-
* Map of gateways attached to a session, keyed by gateway code. A session can
|
|
710
|
-
* advertise multiple gateways concurrently — e.g. `gateways.stripe` for card
|
|
711
|
-
* + wallets and `gateways.paypal` for direct PayPal rendering. A session
|
|
712
|
-
* created with the Worldpay capability may also carry
|
|
713
|
-
* `gateways.worldpayCorporateGateway` (TeamFloPay/backend#1563): a card
|
|
714
|
-
* gateway the billing API processes entirely server-side behind the hosted
|
|
715
|
-
* vault form, with no browser credentials or methods.
|
|
716
|
-
*/
|
|
717
|
-
interface CheckoutGateways {
|
|
718
|
-
stripe?: CheckoutGateway;
|
|
719
|
-
paypal?: CheckoutGateway;
|
|
720
|
-
[key: string]: CheckoutGateway | undefined;
|
|
721
|
-
}
|
|
722
|
-
/** Represents a FloPay checkout session. */
|
|
723
|
-
interface CheckoutSession {
|
|
724
|
-
id: string;
|
|
725
|
-
clientSecret: string;
|
|
726
|
-
mode: 'payment' | 'subscription' | 'setup';
|
|
727
|
-
status: 'open' | 'authorized' | 'complete' | 'expired';
|
|
728
|
-
amount: number;
|
|
729
|
-
currency: string;
|
|
730
|
-
/** Capture behavior persisted by the billing API. Omitted on legacy sessions. */
|
|
731
|
-
captureMethod?: CaptureMethod;
|
|
732
|
-
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
733
|
-
paymentId?: string;
|
|
734
|
-
/** Provider authorisation deadline. Present while an authorisation is capturable. */
|
|
735
|
-
authorizationExpiresAt?: string;
|
|
736
|
-
/** Stable failure outcome when the authorization lifecycle did not settle. */
|
|
737
|
-
failureOutcome?: CheckoutFailureOutcome;
|
|
738
|
-
lineItems?: LineItem[];
|
|
739
|
-
/**
|
|
740
|
-
* Buyer data attached to this checkout. Anonymous sessions keep this object
|
|
741
|
-
* for routing/address fields, but omit unresolved identity fields until the
|
|
742
|
-
* buyer is identified.
|
|
743
|
-
*/
|
|
744
|
-
customer?: Partial<Customer>;
|
|
745
|
-
/** Immutable client context returned by the FloPay checkout-session API. */
|
|
746
|
-
checkoutMetadata?: CheckoutMetadata;
|
|
747
|
-
metadata?: Record<string, string>;
|
|
748
|
-
checkoutMode?: CheckoutSessionMode;
|
|
749
|
-
/**
|
|
750
|
-
* Payment methods the billing API advertises on a setup session (backend#1846),
|
|
751
|
-
* exactly as received. Absent on older backends, which a card-only client may ignore.
|
|
752
|
-
*/
|
|
753
|
-
advertisedPaymentMethods?: AdvertisedPaymentMethod[];
|
|
754
|
-
/**
|
|
755
|
-
* The usage the billing API sets every Stripe attempt of this session up for
|
|
756
|
-
* (platform policy, sdk#430 / backend#1989), exactly as the purchase or setup
|
|
757
|
-
* read returns it. Absent on older backends. Stripe Elements declare it
|
|
758
|
-
* through `resolveSetupFutureUsage`; the SDK never chooses or coerces it.
|
|
759
|
-
*/
|
|
760
|
-
futureUse?: CardSetupFutureUse | null;
|
|
761
|
-
/**
|
|
762
|
-
* Methods the billing API cannot set up for future use, each with a reason,
|
|
763
|
-
* exactly as the read returns them (malformed entries dropped). A listed
|
|
764
|
-
* method declares no `setupFutureUsage` and stays payable one-off. Absent on
|
|
765
|
-
* older backends.
|
|
766
|
-
*/
|
|
767
|
-
futureUseUnsupported?: FutureUseUnsupportedMethod[];
|
|
768
|
-
/** Whether the backend has resolved and attached a buyer to this session. */
|
|
769
|
-
buyerIdentified?: boolean;
|
|
770
|
-
/**
|
|
771
|
-
* Optional embedded hosted vault capture credentials
|
|
772
|
-
* (TeamFloPay/backend#823). This remains the preferred fast path during the
|
|
773
|
-
* SDK 1.4.9 rollout: when present, the SDK injects
|
|
774
|
-
* {@link VaultCaptureBlock.html} without a recovery request. A Stripe
|
|
775
|
-
* gateway whose `enabledPaymentMethods` explicitly includes `card`, or an
|
|
776
|
-
* open session with a server-side card gateway
|
|
777
|
-
* (`gateways.worldpayCorporateGateway`), may omit this block; the SDK then
|
|
778
|
-
* lazily requests `POST /v1/checkouts/sessions/{id}/vault/capture` when Card
|
|
779
|
-
* is opened.
|
|
780
|
-
*/
|
|
781
|
-
vault?: VaultCaptureBlock;
|
|
782
|
-
/**
|
|
783
|
-
* Generic, provider-agnostic payment method identifier for a card already on
|
|
784
|
-
* file for the customer (TeamFloPay/backend#823). For the initial
|
|
785
|
-
* Stripe-behind-vault rollout this is the Stripe `pm_…` id, but the SDK
|
|
786
|
-
* treats it as an opaque card-method token. Present for returning customers
|
|
787
|
-
* so the SDK can skip the vault widget; `null`/absent otherwise.
|
|
788
|
-
*/
|
|
789
|
-
providerPaymentMethodId?: string | null;
|
|
790
|
-
/** Unified products array as returned by post-#760 backends. */
|
|
791
|
-
products?: CheckoutSessionProduct[];
|
|
792
|
-
successUrl?: string;
|
|
793
|
-
cancelUrl?: string;
|
|
794
|
-
coupons?: string[];
|
|
795
|
-
/**
|
|
796
|
-
* Pre-discount total in cart-currency major units (e.g. 24.95). Populated by
|
|
797
|
-
* billing API ≥ v1.1.2; `undefined` on older backends — readers must fall
|
|
798
|
-
* back to summing per-line `totalAmount`.
|
|
799
|
-
*/
|
|
800
|
-
subtotalAmount?: number;
|
|
801
|
-
/**
|
|
802
|
-
* Total reduction from applied coupons in cart-currency major units.
|
|
803
|
-
* Populated by billing API ≥ v1.1.2; `undefined` on older backends.
|
|
804
|
-
*/
|
|
805
|
-
discountAmount?: number;
|
|
806
|
-
/**
|
|
807
|
-
* Final charge amount in cart-currency major units (subtotal − discount,
|
|
808
|
-
* clamped ≥ 0). Populated by billing API ≥ v1.1.2; `undefined` on older
|
|
809
|
-
* backends — readers must fall back to summing per-line `overrideAmount`.
|
|
810
|
-
*/
|
|
811
|
-
totalAmount?: number;
|
|
812
|
-
createdAt?: string;
|
|
813
|
-
/**
|
|
814
|
-
* Per-gateway configuration. A session can advertise multiple concurrent
|
|
815
|
-
* gateways — read `gateways.stripe` for card/wallets, `gateways.paypal` for
|
|
816
|
-
* direct PayPal, and so on.
|
|
817
|
-
*/
|
|
818
|
-
gateways?: CheckoutGateways;
|
|
819
|
-
accountData?: {
|
|
820
|
-
/** Null until an anonymous checkout is attached to a buyer. */
|
|
821
|
-
userId: string | null;
|
|
822
|
-
/** Null until an anonymous checkout is attached to a buyer. */
|
|
823
|
-
email: string | null;
|
|
824
|
-
firstName: string | null;
|
|
825
|
-
lastName: string | null;
|
|
826
|
-
gender?: string | null;
|
|
827
|
-
city?: string | null;
|
|
828
|
-
state?: string | null;
|
|
829
|
-
country?: string | null;
|
|
830
|
-
zip?: string | null;
|
|
831
|
-
};
|
|
832
|
-
tagsData?: TagsData;
|
|
833
|
-
}
|
|
834
|
-
/** The result of a payment confirmation attempt. */
|
|
835
|
-
interface PaymentResult {
|
|
836
|
-
status: 'authorized' | 'succeeded' | 'processing' | 'requires_action' | 'failed';
|
|
837
|
-
/** FloPay payment transaction UUID, present for an authorised outcome. */
|
|
838
|
-
paymentId?: string;
|
|
839
|
-
/** Owning checkout session UUID, present for an authorised outcome. */
|
|
840
|
-
sessionId?: string;
|
|
841
|
-
/** Provider authorisation deadline, present while the hold is capturable. */
|
|
842
|
-
authorizationExpiresAt?: string;
|
|
843
|
-
paymentIntentId?: string;
|
|
844
|
-
paymentMethodId?: string;
|
|
845
|
-
checkoutMethod?: CheckoutButtonMethod;
|
|
846
|
-
error?: FloPayError;
|
|
847
|
-
}
|
|
848
|
-
/** Billing details passed to Stripe for AVS (Address Verification). */
|
|
849
|
-
interface BillingDetails {
|
|
850
|
-
email?: string;
|
|
851
|
-
name?: string;
|
|
852
|
-
address?: {
|
|
853
|
-
country?: string;
|
|
854
|
-
postal_code?: string;
|
|
855
|
-
city?: string;
|
|
856
|
-
line1?: string;
|
|
857
|
-
line2?: string;
|
|
858
|
-
state?: string;
|
|
859
|
-
};
|
|
860
|
-
}
|
|
861
|
-
/** Result from the Stripe-hosted PayPal confirmation or redirect-resume flow. */
|
|
862
|
-
interface PayPalPaymentResult {
|
|
863
|
-
status: 'succeeded' | 'processing' | 'requires_action' | 'requires_capture' | 'failed';
|
|
864
|
-
paymentIntentId?: string;
|
|
865
|
-
paymentMethodId?: string;
|
|
866
|
-
error?: FloPayError;
|
|
867
|
-
}
|
|
868
|
-
/** Non-card method families accepted by the public session intent endpoint. */
|
|
869
|
-
type NonCardPaymentMethodCategory = 'wallet' | 'apm';
|
|
870
|
-
/**
|
|
871
|
-
* Stable identity of one buyer authorization attempt (a v4 UUID).
|
|
872
|
-
*
|
|
873
|
-
* The backend folds this into the provider idempotency key, so reusing the same
|
|
874
|
-
* value makes a transport retry reuse the *same* provider intent, while a fresh
|
|
875
|
-
* value deliberately starts a new authorization. Optional on the SDK request:
|
|
876
|
-
* `PaymentAPI.createSessionIntent` generates one when omitted and only advanced
|
|
877
|
-
* callers that drive their own retries need to pass a stable value.
|
|
878
|
-
*/
|
|
879
|
-
interface SessionIntentAuthorizationAttempt {
|
|
880
|
-
authorizationAttemptId?: string;
|
|
881
|
-
}
|
|
882
|
-
/** Stripe wallet/APM request. Direct card is deliberately not representable. */
|
|
883
|
-
interface StripeSessionIntentRequest extends SessionIntentAuthorizationAttempt {
|
|
884
|
-
provider: 'stripe';
|
|
885
|
-
paymentMethodCategory: NonCardPaymentMethodCategory;
|
|
886
|
-
paymentMethodType: string;
|
|
887
|
-
paymentMethodId: string | null;
|
|
888
|
-
intentKind: 'payment' | 'setup';
|
|
889
|
-
}
|
|
890
|
-
/** Fields shared by every direct PayPal intent request channel. */
|
|
891
|
-
interface PayPalSessionIntentRequestBase extends SessionIntentAuthorizationAttempt {
|
|
892
|
-
provider: 'paypal';
|
|
893
|
-
paymentMethodCategory: 'wallet';
|
|
894
|
-
paymentMethodId: null;
|
|
895
|
-
}
|
|
896
|
-
/**
|
|
897
|
-
* Legacy provider-managed channel. `paymentMethodType: 'paypal'` keeps the
|
|
898
|
-
* released contract byte-identical: always `intentKind: 'payment'`, and the
|
|
899
|
-
* backend derives Order vs provider-managed Subscription from the session.
|
|
900
|
-
*/
|
|
901
|
-
interface PayPalLegacySessionIntentRequest extends PayPalSessionIntentRequestBase {
|
|
902
|
-
paymentMethodType: 'paypal';
|
|
903
|
-
intentKind: 'payment';
|
|
904
|
-
}
|
|
905
|
-
/**
|
|
906
|
-
* Flo-owned channel, payment continuation. `paymentMethodType:
|
|
907
|
-
* 'paypal_vaulted'` with `intentKind: 'payment'` requests a Flo-owned PayPal
|
|
908
|
-
* Order (advertised as `providerObjectType: 'order'`).
|
|
909
|
-
*/
|
|
910
|
-
interface PayPalVaultedPaymentSessionIntentRequest extends PayPalSessionIntentRequestBase {
|
|
911
|
-
paymentMethodType: 'paypal_vaulted';
|
|
912
|
-
intentKind: 'payment';
|
|
913
|
-
}
|
|
914
|
-
/**
|
|
915
|
-
* Flo-owned channel, setup continuation. `paymentMethodType: 'paypal_vaulted'`
|
|
916
|
-
* with `intentKind: 'setup'` requests a PayPal vault setup token for an
|
|
917
|
-
* item-free deferred Flo-owned start (advertised as `providerObjectType:
|
|
918
|
-
* 'setup_token'`).
|
|
919
|
-
*/
|
|
920
|
-
interface PayPalVaultedSetupSessionIntentRequest extends PayPalSessionIntentRequestBase {
|
|
921
|
-
paymentMethodType: 'paypal_vaulted';
|
|
922
|
-
intentKind: 'setup';
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
* Direct PayPal intent request. The payment-method type is the in-band channel
|
|
926
|
-
* selector: `'paypal'` keeps provider-managed semantics, `'paypal_vaulted'`
|
|
927
|
-
* opts the request into the Flo-owned channel. The union makes the invalid
|
|
928
|
-
* combination (`'paypal'` with `intentKind: 'setup'`) unrepresentable.
|
|
929
|
-
*/
|
|
930
|
-
type PayPalSessionIntentRequest = PayPalLegacySessionIntentRequest | PayPalVaultedPaymentSessionIntentRequest | PayPalVaultedSetupSessionIntentRequest;
|
|
931
|
-
type CreateSessionIntentRequest = StripeSessionIntentRequest | PayPalSessionIntentRequest;
|
|
932
|
-
interface StripeSessionIntent extends StripeSessionIntentRequest {
|
|
933
|
-
clientSecret: string;
|
|
934
|
-
providerObjectId: string;
|
|
935
|
-
}
|
|
936
|
-
interface PayPalSessionIntentResponse {
|
|
937
|
-
clientSecret: null;
|
|
938
|
-
providerObjectId: string;
|
|
939
|
-
}
|
|
940
|
-
/**
|
|
941
|
-
* Direct PayPal intent response. The response echoes the request fields and
|
|
942
|
-
* correlates the selected provider object with the requested channel so
|
|
943
|
-
* impossible wire responses are not representable to SDK consumers:
|
|
944
|
-
*
|
|
945
|
-
* - `'paypal'` + `'payment'` ↔ `providerObjectType: 'order' | 'subscription'`
|
|
946
|
-
* - `'paypal_vaulted'` + `'payment'` ↔ `providerObjectType: 'order'`
|
|
947
|
-
* - `'paypal_vaulted'` + `'setup'` ↔ `providerObjectType: 'setup_token'`
|
|
948
|
-
*/
|
|
949
|
-
type PayPalSessionIntent = (PayPalLegacySessionIntentRequest & PayPalSessionIntentResponse & {
|
|
950
|
-
providerObjectType: 'order' | 'subscription';
|
|
951
|
-
}) | (PayPalVaultedPaymentSessionIntentRequest & PayPalSessionIntentResponse & {
|
|
952
|
-
providerObjectType: 'order';
|
|
953
|
-
}) | (PayPalVaultedSetupSessionIntentRequest & PayPalSessionIntentResponse & {
|
|
954
|
-
providerObjectType: 'setup_token';
|
|
955
|
-
});
|
|
956
|
-
type SessionIntent = StripeSessionIntent | PayPalSessionIntent;
|
|
957
|
-
type SessionIntentDeclineRequest = {
|
|
958
|
-
provider: 'stripe';
|
|
959
|
-
paymentMethodCategory: NonCardPaymentMethodCategory;
|
|
960
|
-
paymentMethodType: string;
|
|
961
|
-
/** Provider classification code only; messages and identifiers are rejected. */
|
|
962
|
-
providerDeclineReason: string;
|
|
963
|
-
/** Correlates the decline to a Stripe PaymentIntent returned by Flo; never telemetry. */
|
|
964
|
-
providerIntentId?: string;
|
|
965
|
-
} | {
|
|
966
|
-
provider: 'paypal';
|
|
967
|
-
paymentMethodCategory: 'wallet';
|
|
968
|
-
paymentMethodType: 'paypal';
|
|
969
|
-
/** Provider classification code only; messages and identifiers are rejected. */
|
|
970
|
-
providerDeclineReason: string;
|
|
971
|
-
};
|
|
972
|
-
/** Top-level configuration for initializing FloPay. */
|
|
973
|
-
interface FloPayConfig {
|
|
974
|
-
publishableKey: string;
|
|
975
|
-
/** Billing API base URL (e.g. https://api.stage.flopay.com). */
|
|
976
|
-
billingApiUrl?: string;
|
|
977
|
-
/**
|
|
978
|
-
* Flo-owned privacy-safe operational telemetry. Enabled by default; set to
|
|
979
|
-
* `false` to opt out. This intentionally accepts no endpoint, tags, user
|
|
980
|
-
* context, messages, or custom metadata.
|
|
981
|
-
*/
|
|
982
|
-
telemetry?: boolean;
|
|
983
|
-
locale?: string;
|
|
984
|
-
appearance?: FloPayAppearance;
|
|
985
|
-
apiVersion?: string;
|
|
986
|
-
}
|
|
987
|
-
/**
|
|
988
|
-
* Abstraction layer for payment providers.
|
|
989
|
-
*
|
|
990
|
-
* Currently only Stripe is implemented (`StripeAdapter`). The interface
|
|
991
|
-
* ensures that adding new providers (Chargebee, Recurly, etc.) will not
|
|
992
|
-
* require changes in consumer code.
|
|
993
|
-
*/
|
|
994
|
-
interface PaymentProviderAdapter {
|
|
995
|
-
readonly name: string;
|
|
996
|
-
initialize(config: FloPayConfig): Promise<void>;
|
|
997
|
-
/** Get the raw underlying provider instance (e.g. Stripe object). */
|
|
998
|
-
getRawProvider(): unknown;
|
|
999
|
-
destroy(): void;
|
|
1000
|
-
}
|
|
1001
|
-
/**
|
|
1002
|
-
* Identifier for a card-capture backend that owns the hosted PCI card form.
|
|
1003
|
-
* The SDK models card collection as a generic card method so additional
|
|
1004
|
-
* vault/card providers can be added behind the same {@link CardCaptureAdapter}
|
|
1005
|
-
* without changing the React card form. `'pcivault'` is the first (and
|
|
1006
|
-
* currently only) implementation.
|
|
1007
|
-
*/
|
|
1008
|
-
type CardCaptureProviderId = 'pcivault';
|
|
1009
|
-
/**
|
|
1010
|
-
* Server-rendered hosted vault capture credentials (TeamFloPay/backend#823).
|
|
1011
|
-
*
|
|
1012
|
-
* Returned either as the optional embedded fast path on a card-capable
|
|
1013
|
-
* session create/read response or from the explicit
|
|
1014
|
-
* `POST /v1/checkouts/sessions/{id}/vault/capture` endpoint. `html` is a
|
|
1015
|
-
* self-contained, Flo-bundled hosted-form widget (PCIVault card fields, its own
|
|
1016
|
-
* submit button, status overlay, and — owned entirely by the backend — card
|
|
1017
|
-
* tokenization, PaymentIntent creation/confirmation, 3DS, and decline display).
|
|
1018
|
-
* The SDK injects `html` and steps back; PAN / CVC never enter the SDK runtime.
|
|
1019
|
-
*
|
|
1020
|
-
* `url` is the raw PCIVault submit endpoint the bundle POSTs to; it is surfaced
|
|
1021
|
-
* for diagnostics and is not used directly by the Model-A (inject-the-widget)
|
|
1022
|
-
* integration. The PCIVault submit *secret* is intentionally **not** part of
|
|
1023
|
-
* this type — it is server-only and must never cross onto the public session
|
|
1024
|
-
* surface (logs / telemetry / client inspection).
|
|
1025
|
-
*/
|
|
1026
|
-
interface VaultCaptureBlock {
|
|
1027
|
-
/** Self-contained hosted-form widget HTML the SDK injects into the card slot. */
|
|
1028
|
-
html?: string;
|
|
1029
|
-
/** PCIVault submit URL the hosted form POSTs the captured card to. */
|
|
1030
|
-
url?: string;
|
|
1031
|
-
/**
|
|
1032
|
-
* One-time integrity token minted by the backend and baked into the widget
|
|
1033
|
-
* bootstrap. When present the SDK threads it into
|
|
1034
|
-
* {@link CardCaptureMountOptions.messageToken} and rejects any terminal
|
|
1035
|
-
* `postMessage` outcome whose {@link VaultCaptureResultMessage.messageToken}
|
|
1036
|
-
* does not match — the primary defence against same-window forged outcomes
|
|
1037
|
-
* (TeamFloPay/backend#823). It also authenticates the host's submit-label
|
|
1038
|
-
* directive ({@link CardCaptureAdapter.setSubmitLabel}); embedded create,
|
|
1039
|
-
* read, and claim blocks carry it from billing API v1.9.35.
|
|
1040
|
-
*/
|
|
1041
|
-
messageToken?: string;
|
|
1042
|
-
/**
|
|
1043
|
-
* Exact origin the hosted widget posts its terminal outcomes from, when it
|
|
1044
|
-
* runs in a cross-origin frame. When present the SDK rejects messages from
|
|
1045
|
-
* any other origin, and it is the exact `postMessage` target of the
|
|
1046
|
-
* submit-label directive.
|
|
1047
|
-
*/
|
|
1048
|
-
expectedOrigin?: string;
|
|
1049
|
-
/**
|
|
1050
|
-
* Verification descriptor the backend adds when a human check is required
|
|
1051
|
-
* before card capture. The SDK never renders the widget or reads `siteKey`.
|
|
1052
|
-
*/
|
|
1053
|
-
verification?: {
|
|
1054
|
-
required: boolean;
|
|
1055
|
-
provider: 'turnstile';
|
|
1056
|
-
siteKey?: string;
|
|
1057
|
-
action?: string;
|
|
1058
|
-
cData?: string;
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* Lifecycle / outcome events emitted by a {@link CardCaptureAdapter}.
|
|
1063
|
-
*
|
|
1064
|
-
* Under the Model-A (backend-orchestrated) vault flow the hosted widget owns
|
|
1065
|
-
* the entire payment — capture, charge, and 3DS — so the SDK observes only:
|
|
1066
|
-
* - `ready` — the widget mounted and is accepting input.
|
|
1067
|
-
* - `complete`— the backend reported a successful (terminal) charge.
|
|
1068
|
-
* - `decline` — the backend reported a declined / failed charge.
|
|
1069
|
-
* - `error` — the widget failed to load, or an unexpected runtime error.
|
|
1070
|
-
*
|
|
1071
|
-
* `complete` / `decline` arrive via a `postMessage` from the hosted widget (see
|
|
1072
|
-
* {@link VaultCaptureResultMessage}); the backend is responsible for emitting
|
|
1073
|
-
* them. When it does not, the widget falls back to its own success redirect.
|
|
1074
|
-
*/
|
|
1075
|
-
type CardCaptureEventType = 'ready' | 'submitting' | 'complete' | 'decline' | 'error' | 'validation'
|
|
1076
|
-
/**
|
|
1077
|
-
* The buyer clicked the widget's submit button but the host had gated it
|
|
1078
|
-
* (see {@link CardCaptureAdapter.setSubmitGate}) — the widget blocked its own
|
|
1079
|
-
* charge so the host can surface its merchant-DOM validation (e.g. AVS) the
|
|
1080
|
-
* same way the widget surfaces inline card validation.
|
|
1081
|
-
*/
|
|
1082
|
-
| 'blocked'
|
|
1083
|
-
/**
|
|
1084
|
-
* The provider needs the buyer to complete an additional verification step
|
|
1085
|
-
* (e.g. Stripe 3DS-2 challenge) before the payment can settle. The widget
|
|
1086
|
-
* surfaces the provider-hosted challenge URL on the outcome event; the host
|
|
1087
|
-
* should:
|
|
1088
|
-
* 1. Hide its "processing" backdrop so the buyer can interact with the
|
|
1089
|
-
* challenge (the widget renders the iframe at the parent page level
|
|
1090
|
-
* so it isn't trapped inside the vault iframe).
|
|
1091
|
-
* 2. Render the challenge — the SDK's default vault adapter creates a
|
|
1092
|
-
* full-page overlay iframe pointing at `nextActionRedirectUrl`.
|
|
1093
|
-
* The next `complete` / `decline` / `error` fires after the buyer finishes
|
|
1094
|
-
* (or abandons) the challenge.
|
|
1095
|
-
*/
|
|
1096
|
-
| 'action_required'
|
|
1097
|
-
/**
|
|
1098
|
-
* The buyer closed the verification challenge without finishing it. This is
|
|
1099
|
-
* NOT an outcome: the hosted form keeps polling for the rest of its
|
|
1100
|
-
* authentication window, and a late `complete` / `decline` / `error` still
|
|
1101
|
-
* arrives — an out-of-band approval (e.g. the buyer's banking app) can
|
|
1102
|
-
* settle after the challenge window is gone. It exists so the host can drop
|
|
1103
|
-
* the processing backdrop it raised on `submitting` and leave the card form
|
|
1104
|
-
* usable again, instead of holding the buyer behind a modal for the rest of
|
|
1105
|
-
* that window.
|
|
1106
|
-
*/
|
|
1107
|
-
| 'challenge_dismissed';
|
|
1108
|
-
/** Payload for a {@link CardCaptureAdapter} outcome event. */
|
|
1109
|
-
interface CardCaptureOutcomeEvent {
|
|
1110
|
-
/** Owning checkout session id, for correlation. */
|
|
1111
|
-
sessionId?: string;
|
|
1112
|
-
/** Provider-neutral terminal result. Absent on legacy widget messages. */
|
|
1113
|
-
outcome?: 'authorized' | 'succeeded';
|
|
1114
|
-
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
1115
|
-
paymentId?: string;
|
|
1116
|
-
/** Provider authorisation deadline while the hold is capturable. */
|
|
1117
|
-
authorizationExpiresAt?: string;
|
|
1118
|
-
/** Stable provider-neutral failure for decline/error outcomes. */
|
|
1119
|
-
failureOutcome?: CheckoutFailureOutcome;
|
|
1120
|
-
/**
|
|
1121
|
-
* The processing gateway's reference on a terminal outcome, when available.
|
|
1122
|
-
* A Stripe intent id only when Stripe took the card; a server-side card
|
|
1123
|
-
* gateway (Worldpay) reports an opaque order reference instead.
|
|
1124
|
-
*/
|
|
1125
|
-
intentId?: string;
|
|
1126
|
-
/** Mapped decline reason on `decline` (backend `PaymentDeclineReason` enum). */
|
|
1127
|
-
declineReason?: string;
|
|
1128
|
-
/** Human-readable message for `decline` / `error`. */
|
|
1129
|
-
message?: string;
|
|
1130
|
-
/**
|
|
1131
|
-
* Provider-hosted next-action URL the buyer must complete on
|
|
1132
|
-
* `action_required` (e.g. Stripe 3DS-2 challenge page). Absent on every
|
|
1133
|
-
* other event type.
|
|
1134
|
-
*/
|
|
1135
|
-
nextActionRedirectUrl?: string;
|
|
1136
|
-
/** Display-only saved card produced by a successful setup, when supplied. */
|
|
1137
|
-
paymentMethod?: SavedCardDisplay;
|
|
1138
|
-
}
|
|
1139
|
-
/**
|
|
1140
|
-
* `window.postMessage` payload the hosted vault widget sends its embedding SDK
|
|
1141
|
-
* to report a terminal payment outcome.
|
|
1142
|
-
*
|
|
1143
|
-
* The widget HTML is injected **same-window** (see `PciVaultCardCapture`), so
|
|
1144
|
-
* `event.origin` for a genuine outcome is the merchant page's own origin and
|
|
1145
|
-
* the bare `source` string alone is forgeable by any other script on the page.
|
|
1146
|
-
* Authenticity therefore rests on, in order of strength:
|
|
1147
|
-
* 1. `messageToken` — an unguessable per-session token the backend bakes into
|
|
1148
|
-
* the widget bootstrap and echoes here; the SDK rejects terminal outcomes
|
|
1149
|
-
* that omit/mismatch it ({@link CardCaptureMountOptions.messageToken}).
|
|
1150
|
-
* 2. `sessionId` — money-affecting outcomes (`complete` / `decline`) must be
|
|
1151
|
-
* bound to the mounted session; the SDK rejects ones that are not.
|
|
1152
|
-
* 3. `expectedOrigin` — an optional strict origin gate for widgets that post
|
|
1153
|
-
* from a cross-origin frame ({@link CardCaptureMountOptions.expectedOrigin}).
|
|
1154
|
-
*/
|
|
1155
|
-
interface VaultCaptureResultMessage {
|
|
1156
|
-
source: 'flopay-vault';
|
|
1157
|
-
type: 'ready' | 'submitting' | 'complete' | 'decline' | 'error' | 'action_required';
|
|
1158
|
-
/**
|
|
1159
|
-
* Owning checkout session id. Always present for terminal outcomes
|
|
1160
|
-
* (`complete` / `decline`) — the SDK rejects money-affecting outcomes that
|
|
1161
|
-
* are not bound to the mounted session. May be absent on a pre-bootstrap
|
|
1162
|
-
* `ready` / load-`error` the widget emits before the session is wired.
|
|
1163
|
-
*/
|
|
1164
|
-
sessionId?: string;
|
|
1165
|
-
/**
|
|
1166
|
-
* Integrity token echoed from the widget bootstrap; must equal the value the
|
|
1167
|
-
* SDK was mounted with ({@link CardCaptureMountOptions.messageToken}). When
|
|
1168
|
-
* the SDK was given a token it rejects messages that omit or mismatch it.
|
|
1169
|
-
*/
|
|
1170
|
-
messageToken?: string;
|
|
1171
|
-
/** Provider-neutral terminal result. Absent on legacy widget messages. */
|
|
1172
|
-
outcome?: 'authorized' | 'succeeded';
|
|
1173
|
-
/** FloPay payment transaction UUID used by the merchant capture REST route. */
|
|
1174
|
-
paymentId?: string;
|
|
1175
|
-
/** Provider authorisation deadline while the hold is capturable. */
|
|
1176
|
-
authorizationExpiresAt?: string;
|
|
1177
|
-
/** Stable provider-neutral failure for decline/error outcomes. */
|
|
1178
|
-
failureOutcome?: CheckoutFailureOutcome;
|
|
1179
|
-
intentId?: string;
|
|
1180
|
-
declineReason?: string;
|
|
1181
|
-
message?: string;
|
|
1182
|
-
/**
|
|
1183
|
-
* Provider-hosted next-action URL the buyer must complete on
|
|
1184
|
-
* `type === 'action_required'` (e.g. Stripe 3DS-2 challenge page). The host
|
|
1185
|
-
* SDK renders the challenge at the parent page level so the buyer isn't
|
|
1186
|
-
* blocked by the SDK's processing backdrop.
|
|
1187
|
-
*/
|
|
1188
|
-
nextActionRedirectUrl?: string;
|
|
1189
|
-
/** Display-only saved card produced by a successful setup, when supplied. */
|
|
1190
|
-
paymentMethod?: SavedCardDisplay;
|
|
1191
|
-
}
|
|
1192
|
-
/** Options for mounting the hosted vault widget into a container element. */
|
|
1193
|
-
interface CardCaptureMountOptions {
|
|
1194
|
-
/**
|
|
1195
|
-
* Server-rendered hosted-form widget HTML (the vault capture block's `html`).
|
|
1196
|
-
* The adapter injects this and lets the bundled `<script>` bootstrap the
|
|
1197
|
-
* PCIVault form; the SDK does not own its fields or styling.
|
|
1198
|
-
*/
|
|
1199
|
-
html: string;
|
|
1200
|
-
/**
|
|
1201
|
-
* Per-session integrity token (the vault block's `messageToken`). When
|
|
1202
|
-
* supplied, the adapter rejects any `postMessage` outcome whose
|
|
1203
|
-
* {@link VaultCaptureResultMessage.messageToken} does not match — closing the
|
|
1204
|
-
* same-window forgery vector. Omit when the backend does not (yet) mint one.
|
|
1205
|
-
*/
|
|
1206
|
-
messageToken?: string;
|
|
1207
|
-
/**
|
|
1208
|
-
* Exact origin expected for terminal `postMessage` outcomes (the vault
|
|
1209
|
-
* block's `expectedOrigin`). When supplied, the adapter rejects messages from
|
|
1210
|
-
* any other origin. Omit to skip the origin gate (default).
|
|
1211
|
-
*/
|
|
1212
|
-
expectedOrigin?: string;
|
|
1213
|
-
/**
|
|
1214
|
-
* Merchant theme colors to apply to the hosted form. The SDK owns theming;
|
|
1215
|
-
* the adapter pushes these into the (cross-origin) widget so the card form
|
|
1216
|
-
* matches the surrounding checkout. Only provided keys are applied — the
|
|
1217
|
-
* backend ships neutral defaults for the rest. Re-pushable at runtime via
|
|
1218
|
-
* {@link CardCaptureAdapter.applyTheme} for live theme switches.
|
|
1219
|
-
*/
|
|
1220
|
-
theme?: VaultCardThemeColors;
|
|
1221
|
-
/**
|
|
1222
|
-
* Initial wording for the hosted card form's final submit button (see
|
|
1223
|
-
* {@link CardCaptureAdapter.setSubmitLabel} for live updates and the full
|
|
1224
|
-
* contract). `null` is the explicit reset to the session default. Omit it to
|
|
1225
|
-
* keep the label this adapter instance last received (replayed on `ready`);
|
|
1226
|
-
* nothing is sent if it was never given one.
|
|
1227
|
-
*/
|
|
1228
|
-
submitLabel?: string | null;
|
|
1229
|
-
/**
|
|
1230
|
-
* The mounted form sits behind the backend's production human check (the
|
|
1231
|
-
* vault block's `verification.required`). An `error` the frame posts before
|
|
1232
|
-
* the buyer submits is then the check's own state (failed, expired or
|
|
1233
|
-
* unavailable) rather than a broken card form: it still reaches `error`
|
|
1234
|
-
* listeners, but is not reported as a vault load failure.
|
|
1235
|
-
*/
|
|
1236
|
-
verificationRequired?: boolean;
|
|
1237
|
-
}
|
|
1238
|
-
/**
|
|
1239
|
-
* Merchant style values the SDK pushes into the hosted vault card form so it
|
|
1240
|
-
* matches the surrounding checkout fields. The form's own surface stays
|
|
1241
|
-
* transparent — these only drive the inputs, submit button, and overlay.
|
|
1242
|
-
*/
|
|
1243
|
-
interface VaultCardThemeColors {
|
|
1244
|
-
/** Submit button background. */
|
|
1245
|
-
primaryColor?: string;
|
|
1246
|
-
/** Submit button hover background. */
|
|
1247
|
-
primaryHoverColor?: string;
|
|
1248
|
-
/** Card input fill (the surrounding form surface stays transparent). */
|
|
1249
|
-
inputBackgroundColor?: string;
|
|
1250
|
-
/** Input + selected-value text color. */
|
|
1251
|
-
textColor?: string;
|
|
1252
|
-
/** Input border color. */
|
|
1253
|
-
borderColor?: string;
|
|
1254
|
-
/** Input placeholder color. */
|
|
1255
|
-
placeholderColor?: string;
|
|
1256
|
-
/** Error/invalid border + overlay color. */
|
|
1257
|
-
errorColor?: string;
|
|
1258
|
-
/** Success overlay color. */
|
|
1259
|
-
successColor?: string;
|
|
1260
|
-
/** Input font family. */
|
|
1261
|
-
fontFamily?: string;
|
|
1262
|
-
/** Input font size (e.g. `16px`). */
|
|
1263
|
-
fontSize?: string;
|
|
1264
|
-
/**
|
|
1265
|
-
* Input + placeholder font weight (e.g. `400`). Sent as a string so the
|
|
1266
|
-
* hosted widget's string-only theme applier picks it up. Mirrors the SDK's
|
|
1267
|
-
* `resolvedInputFontWeight` so the vault inputs match the AVS fields.
|
|
1268
|
-
*/
|
|
1269
|
-
fontWeight?: string;
|
|
1270
|
-
/** Outer corner radius for the grouped card inputs (e.g. `8px`). */
|
|
1271
|
-
borderRadius?: string;
|
|
1272
|
-
/**
|
|
1273
|
-
* Complete snapshot for the backend-hosted submit control (billing API
|
|
1274
|
-
* v1.9.6+). Additive: the flat keys above are still sent alongside it, so an
|
|
1275
|
-
* older hosted asset ignores the object and keeps its solid approximation
|
|
1276
|
-
* from `primaryColor` / `primaryHoverColor`. When present, the hosted asset
|
|
1277
|
-
* clears the previous expanded submit treatment before applying the valid
|
|
1278
|
-
* members, so omitted members never leak across live preset changes.
|
|
1279
|
-
*/
|
|
1280
|
-
submitButton?: VaultSubmitButtonTheme;
|
|
1281
|
-
}
|
|
1282
|
-
/**
|
|
1283
|
-
* Color forms the hosted asset accepts for expanded submit members:
|
|
1284
|
-
* `#RRGGBB`, integer-channel `rgb(r, g, b)`, or `rgba(r, g, b, a)` with alpha
|
|
1285
|
-
* `0..1`. Named colors, `var()`, `calc()`, URLs, and image functions are
|
|
1286
|
-
* rejected by the widget and must not be sent.
|
|
1287
|
-
*/
|
|
1288
|
-
type VaultThemeColor = string;
|
|
1289
|
-
/** Solid fill for the hosted submit control. */
|
|
1290
|
-
interface VaultSolidBackground {
|
|
1291
|
-
type: 'solid';
|
|
1292
|
-
color: VaultThemeColor;
|
|
1293
|
-
}
|
|
1294
|
-
/** One stop of a hosted submit gradient; `position` is a percentage `0..100`. */
|
|
1295
|
-
interface VaultGradientStop {
|
|
1296
|
-
color: VaultThemeColor;
|
|
1297
|
-
position: number;
|
|
1298
|
-
}
|
|
1299
|
-
/**
|
|
1300
|
-
* Linear-gradient fill for the hosted submit control: `angle` in degrees
|
|
1301
|
-
* (`0..360`) and two through five stops in non-decreasing position order.
|
|
1302
|
-
*/
|
|
1303
|
-
interface VaultLinearGradientBackground {
|
|
1304
|
-
type: 'linearGradient';
|
|
1305
|
-
angle: number;
|
|
1306
|
-
stops: VaultGradientStop[];
|
|
1307
|
-
}
|
|
1308
|
-
/** Structured hosted submit fill — a solid color or a bounded linear gradient. */
|
|
1309
|
-
type VaultSubmitBackground = VaultSolidBackground | VaultLinearGradientBackground;
|
|
1310
|
-
/** Bounded typography for the hosted submit label. */
|
|
1311
|
-
interface VaultSubmitTypography {
|
|
1312
|
-
/** One through four safe family tokens (letters, digits, spaces, hyphens; at most 32 characters each). */
|
|
1313
|
-
fontFamilies?: string[];
|
|
1314
|
-
/** Pixels, `10..32`. */
|
|
1315
|
-
fontSize?: number;
|
|
1316
|
-
/** Unitless integer, `100..900`. */
|
|
1317
|
-
fontWeight?: number;
|
|
1318
|
-
/** Em, `-0.1..0.5`. */
|
|
1319
|
-
letterSpacing?: number;
|
|
1320
|
-
/** Unitless, `0.8..2`. */
|
|
1321
|
-
lineHeight?: number;
|
|
1322
|
-
textTransform?: 'none' | 'uppercase' | 'lowercase' | 'capitalize';
|
|
1323
|
-
}
|
|
1324
|
-
/** Bounded padding for the hosted submit control, in pixels (`0..64`). */
|
|
1325
|
-
interface VaultSubmitSpacing {
|
|
1326
|
-
paddingBlock?: number;
|
|
1327
|
-
paddingInline?: number;
|
|
1328
|
-
}
|
|
1329
|
-
/** One structured `box-shadow` layer for the hosted submit control. */
|
|
1330
|
-
interface VaultShadowLayer {
|
|
1331
|
-
color: VaultThemeColor;
|
|
1332
|
-
inset: boolean;
|
|
1333
|
-
/** Pixels, `-64..64`. */
|
|
1334
|
-
offsetX: number;
|
|
1335
|
-
/** Pixels, `-64..64`. */
|
|
1336
|
-
offsetY: number;
|
|
1337
|
-
/** Pixels, `0..128`. */
|
|
1338
|
-
blur: number;
|
|
1339
|
-
/** Pixels, `-32..32`. */
|
|
1340
|
-
spread: number;
|
|
1341
|
-
}
|
|
1342
|
-
/**
|
|
1343
|
-
* Complete, bounded theme snapshot for the backend-hosted submit control
|
|
1344
|
-
* (`theme.submitButton` on the hosted form theme bridge, billing API v1.9.6+).
|
|
1345
|
-
* Every member is optional; the hosted asset ignores an invalid or out-of-range
|
|
1346
|
-
* member and keeps its legacy/neutral fallback, and theme input never blocks
|
|
1347
|
-
* card capture. Raw CSS is not part of this contract by design.
|
|
1348
|
-
*/
|
|
1349
|
-
interface VaultSubmitButtonTheme {
|
|
1350
|
-
/** Label color; the hosted default is white. */
|
|
1351
|
-
foregroundColor?: VaultThemeColor;
|
|
1352
|
-
/** Enabled fill. */
|
|
1353
|
-
background?: VaultSubmitBackground;
|
|
1354
|
-
/** Hover fill. */
|
|
1355
|
-
hoverBackground?: VaultSubmitBackground;
|
|
1356
|
-
/** Disabled fill (composited with {@link VaultSubmitButtonTheme.disabledOpacity}). */
|
|
1357
|
-
disabledBackground?: VaultSubmitBackground;
|
|
1358
|
-
typography?: VaultSubmitTypography;
|
|
1359
|
-
spacing?: VaultSubmitSpacing;
|
|
1360
|
-
/** Zero through four layers; an empty array renders no shadow. */
|
|
1361
|
-
shadow?: VaultShadowLayer[];
|
|
1362
|
-
/** Pixels, `0..9999`. */
|
|
1363
|
-
borderRadius?: number;
|
|
1364
|
-
/** Unitless, `0..1`; the hosted default is `0.5`. */
|
|
1365
|
-
disabledOpacity?: number;
|
|
1366
|
-
/** Pixels, `0..40`. */
|
|
1367
|
-
backdropBlur?: number;
|
|
1368
|
-
}
|
|
1369
|
-
/**
|
|
1370
|
-
* Abstraction for a hosted, PCI-scoped card capture widget. The React card
|
|
1371
|
-
* form depends only on this interface — never on Stripe element types — so the
|
|
1372
|
-
* card path stays decoupled from any specific card provider.
|
|
1373
|
-
*
|
|
1374
|
-
* Under the Model-A vault flow (TeamFloPay/backend#823) the widget is rendered
|
|
1375
|
-
* server-side and the backend orchestrates the whole charge (tokenize → create
|
|
1376
|
-
* + confirm PaymentIntent → 3DS → fulfilment). The SDK's only job is to inject
|
|
1377
|
-
* the widget HTML and relay its terminal `postMessage` outcome to the host
|
|
1378
|
-
* checkout. No Stripe.js is involved on the card path.
|
|
1379
|
-
*/
|
|
1380
|
-
interface CardCaptureAdapter {
|
|
1381
|
-
/** The card-capture backend backing this adapter. */
|
|
1382
|
-
readonly provider: CardCaptureProviderId;
|
|
1383
|
-
/** Inject the hosted widget HTML into `container` and bootstrap it. */
|
|
1384
|
-
mount(container: HTMLElement, options: CardCaptureMountOptions): Promise<void>;
|
|
1385
|
-
/** Subscribe to a lifecycle / outcome event. Returns an unsubscribe fn. */
|
|
1386
|
-
on(event: CardCaptureEventType, handler: (event: CardCaptureOutcomeEvent) => void): () => void;
|
|
1387
|
-
/**
|
|
1388
|
-
* Push merchant theme colors into the mounted widget (live). Lets the host
|
|
1389
|
-
* re-skin the card form on a runtime theme switch without a remount. `null`
|
|
1390
|
-
* is the explicit classic reset: the widget restores every historical
|
|
1391
|
-
* neutral value and the adapter retains the reset so a widget that becomes
|
|
1392
|
-
* ready later replays it. No-op before the widget is ready or if unsupported.
|
|
1393
|
-
*/
|
|
1394
|
-
applyTheme?(theme: VaultCardThemeColors | null): void;
|
|
1395
|
-
/**
|
|
1396
|
-
* Gate the widget's submit button from the host. When `blocked` is `true`,
|
|
1397
|
-
* the widget cancels its own submit on the next click and emits a `'blocked'`
|
|
1398
|
-
* event instead of `'submitting'` — letting the host validate merchant-DOM
|
|
1399
|
-
* fields (e.g. AVS) and surface errors uniformly before any charge. The
|
|
1400
|
-
* latest gate is re-applied when the widget (re)becomes ready. No-op if
|
|
1401
|
-
* unsupported.
|
|
1402
|
-
*/
|
|
1403
|
-
setSubmitGate?(blocked: boolean): void;
|
|
1404
|
-
/**
|
|
1405
|
-
* Push the card-field display/tab order into the widget (live), plus whether
|
|
1406
|
-
* the widget should move the cursor to its first field on load. `order` is a
|
|
1407
|
-
* permutation of the rows ({@link VaultCardFieldKey}); `null` restores the
|
|
1408
|
-
* default. `autoFocus` is `false` when the host renders AVS fields above the
|
|
1409
|
-
* widget (it focuses the first AVS field itself). Re-applied on `ready`.
|
|
1410
|
-
*/
|
|
1411
|
-
setCardFieldOrder?(order: VaultCardFieldKey[] | null, autoFocus: boolean): void;
|
|
1412
|
-
/**
|
|
1413
|
-
* Set the hosted card form's final submit wording (live, billing API
|
|
1414
|
-
* v1.9.35+). The text replaces the button label in place, so the widget is
|
|
1415
|
-
* not remounted and buyer-entered card data is kept. Pass the final,
|
|
1416
|
-
* already-localized plain text (e.g. `'Pay $10'`); the hosted form
|
|
1417
|
-
* normalizes it, renders it as inert text, and falls back to its session
|
|
1418
|
-
* default — `CONFIRM PAYMENT` for payments, `ADD CARD` for card setup — for
|
|
1419
|
-
* blank or invalid text. `null` is the explicit reset to that default.
|
|
1420
|
-
*
|
|
1421
|
-
* The latest value is retained and replayed every time the widget
|
|
1422
|
-
* (re)becomes ready. The directive is posted only to the vault block's exact
|
|
1423
|
-
* `expectedOrigin`, bound to the mounted session and `messageToken`; a
|
|
1424
|
-
* widget mounted without those fields keeps its default. No-op if
|
|
1425
|
-
* unsupported.
|
|
1426
|
-
*/
|
|
1427
|
-
setSubmitLabel?(label: string | null): void;
|
|
1428
|
-
/** Tear down the widget and release resources. */
|
|
1429
|
-
unmount(): void;
|
|
1430
|
-
}
|
|
1431
|
-
/**
|
|
1432
|
-
* The reorderable rows of the hosted vault card form. `'expiry'` is the combined
|
|
1433
|
-
* expiry + CVV row. The submit button always stays last.
|
|
1434
|
-
*/
|
|
1435
|
-
type VaultCardFieldKey = 'name' | 'number' | 'expiry';
|
|
1436
|
-
/** Supported upstream gateway codes. */
|
|
1437
|
-
type BillingProvider = 'stripe' | 'paypal';
|
|
1438
|
-
/** PayPal continuation object selected by the billing backend. */
|
|
1439
|
-
type PayPalProviderObjectType = 'order' | 'subscription' | 'setup_token';
|
|
1440
|
-
/** Backend-advertised non-popup approval modes for one-time PayPal Orders. */
|
|
1441
|
-
type PayPalApprovalPresentation = 'app_switch' | 'redirect';
|
|
1442
|
-
/** Token payload produced by client-side tokenization. */
|
|
1443
|
-
interface TokenizedBody {
|
|
1444
|
-
id?: string;
|
|
1445
|
-
type?: string;
|
|
1446
|
-
threeDSecureActionResultTokenId?: string;
|
|
1447
|
-
originalPaymentMethodId?: string;
|
|
1448
|
-
/**
|
|
1449
|
-
* @deprecated Use {@link TokenizedBody.gateway} + {@link TokenizedBody.paymentMethodType}.
|
|
1450
|
-
* Still populated by the SDK for PayPal compatibility as the boolean `true`,
|
|
1451
|
-
* never the string `"true"`. New integrations must route by `gateway` and
|
|
1452
|
-
* `paymentMethodType` instead.
|
|
1453
|
-
*/
|
|
1454
|
-
isPaypal?: boolean;
|
|
1455
|
-
/**
|
|
1456
|
-
* Upstream gateway that produced the token. `'stripe'` covers every Stripe
|
|
1457
|
-
* payment method (card / wallets / Cash App Pay / Klarna / …); `'paypal'`
|
|
1458
|
-
* is set when DirectPayPalButton produced the token via the PayPal JS SDK.
|
|
1459
|
-
* Backend should route `/process` by `(gateway, paymentMethodType)` instead
|
|
1460
|
-
* of branching on `isPaypal` once consumers have adopted the new fields.
|
|
1461
|
-
*/
|
|
1462
|
-
gateway?: BillingProvider | (string & {});
|
|
1463
|
-
/**
|
|
1464
|
-
* Concrete payment method type. For Stripe gateways this mirrors the Stripe
|
|
1465
|
-
* PaymentMethod.type value (`'card'`, `'apple_pay'`, `'google_pay'`,
|
|
1466
|
-
* `'cashapp'`, `'klarna'`, …). For PayPal it is the literal `'paypal'`.
|
|
1467
|
-
*/
|
|
1468
|
-
paymentMethodType?: string;
|
|
1469
|
-
}
|
|
1470
|
-
/** Structured checkout-processing error returned by the billing API. */
|
|
1471
|
-
interface CheckoutProcessError {
|
|
1472
|
-
type: string;
|
|
1473
|
-
/** Stable provider-neutral machine code supplied by the billing API. */
|
|
1474
|
-
code?: StoredPaymentMethodOutcomeCode;
|
|
1475
|
-
/** Stable provider-neutral failure outcome when supplied by the backend. */
|
|
1476
|
-
outcome?: CheckoutFailureOutcome;
|
|
1477
|
-
message?: string;
|
|
1478
|
-
transactionId?: string;
|
|
1479
|
-
/** Fresh PayPal Order/Subscription id used to resume Direct PayPal approval. */
|
|
1480
|
-
orderId?: string;
|
|
1481
|
-
threeDSecureToken?: string;
|
|
1482
|
-
paymentMethodId?: string;
|
|
1483
|
-
checkoutMethod?: CheckoutButtonMethod;
|
|
1484
|
-
advice?: string;
|
|
1485
|
-
gatewayErrorCode?: string;
|
|
1486
|
-
fields?: Array<{
|
|
1487
|
-
field: string;
|
|
1488
|
-
message: string;
|
|
1489
|
-
}>;
|
|
1490
|
-
/**
|
|
1491
|
-
* Provider-hosted next-action URL on `type === '3ds_required'` (e.g.
|
|
1492
|
-
* Stripe's hosted 3DS challenge page). Present on auto-checkout upsell
|
|
1493
|
-
* errors when the saved PM requires a fresh 3DS challenge — the SDK's
|
|
1494
|
-
* AutomaticPaymentButton mounts this URL in a full-page overlay iframe
|
|
1495
|
-
* so the buyer can authenticate without being demoted to a fresh
|
|
1496
|
-
* card-entry flow.
|
|
1497
|
-
*/
|
|
1498
|
-
nextActionRedirectUrl?: string;
|
|
1499
|
-
}
|
|
1500
|
-
/** Recoverable checkout-processing state returned when fulfillment is still in progress. */
|
|
1501
|
-
interface CheckoutProcessingPending {
|
|
1502
|
-
type: 'checkout_processing';
|
|
1503
|
-
sessionId: string;
|
|
1504
|
-
retryAfterMs: number;
|
|
1505
|
-
statusUrl?: string;
|
|
1506
|
-
sessionUrl?: string;
|
|
1507
|
-
}
|
|
1508
|
-
/** Checkout mode: tokenize client-side or redirect to hosted page. */
|
|
1509
|
-
type CheckoutModeKind = 'tokenize' | 'redirect';
|
|
1510
|
-
/**
|
|
1511
|
-
* Provider-agnostic normalized checkout session. Backend may attach multiple
|
|
1512
|
-
* gateways per session — read each from `data.<gatewayCode>`.
|
|
1513
|
-
*/
|
|
1514
|
-
interface NormalizedCheckoutSession {
|
|
1515
|
-
/** Gateway codes advertised by the backend for this session, for diagnostics. */
|
|
1516
|
-
providers: BillingProvider[];
|
|
1517
|
-
mode: CheckoutModeKind;
|
|
1518
|
-
autoProcessingError?: CheckoutProcessError;
|
|
1519
|
-
autoProcessingAttempted?: boolean;
|
|
1520
|
-
autoProcessingPending?: CheckoutProcessingPending;
|
|
1521
|
-
/** Immutable client context returned by the FloPay checkout-session API. */
|
|
1522
|
-
checkoutMetadata?: CheckoutMetadata;
|
|
1523
|
-
data: {
|
|
1524
|
-
hostedUrl?: string;
|
|
1525
|
-
clientToken?: string;
|
|
1526
|
-
session?: CheckoutSession;
|
|
1527
|
-
stripe?: {
|
|
1528
|
-
clientSecret?: string;
|
|
1529
|
-
publishableKey?: string;
|
|
1530
|
-
/**
|
|
1531
|
-
* Optional dedicated Stripe sub-account publishable key for rendering
|
|
1532
|
-
* PayPal via Stripe Elements. When present and distinct, the saved-PM
|
|
1533
|
-
* resume flow loads a separate FloPay instance for the PayPal PI.
|
|
1534
|
-
*/
|
|
1535
|
-
paypalPublishableKey?: string;
|
|
1536
|
-
environment?: GatewayEnvironment;
|
|
1537
|
-
/**
|
|
1538
|
-
* Mirrors {@link CheckoutGateway.enabledPaymentMethods}. Drives dynamic
|
|
1539
|
-
* `ExpressCheckoutElement` / `PaymentElement` rendering inside
|
|
1540
|
-
* `SplitCardForm` instead of the historic hardcoded Apple/Google/PayPal
|
|
1541
|
-
* set. Absent on backends that have not yet adopted the field.
|
|
1542
|
-
*/
|
|
1543
|
-
enabledPaymentMethods?: string[];
|
|
1544
|
-
/** Mirrors {@link CheckoutGateway.enabledPaymentMethodCountries}. */
|
|
1545
|
-
enabledPaymentMethodCountries?: Record<string, string[]>;
|
|
1546
|
-
};
|
|
1547
|
-
/**
|
|
1548
|
-
* Direct PayPal gateway configuration. Present only when the backend has
|
|
1549
|
-
* configured a dedicated PayPal gateway for the consumer; absent means the
|
|
1550
|
-
* Stripe-rendered PayPal fallback should be used (if Stripe is configured).
|
|
1551
|
-
*/
|
|
1552
|
-
paypal?: {
|
|
1553
|
-
publishableKey?: string;
|
|
1554
|
-
environment?: GatewayEnvironment;
|
|
1555
|
-
providerObjectType?: PayPalProviderObjectType;
|
|
1556
|
-
approvalPresentation?: PayPalApprovalPresentation;
|
|
1557
|
-
};
|
|
1558
|
-
};
|
|
1559
|
-
raw?: unknown;
|
|
1560
|
-
}
|
|
1561
|
-
/**
|
|
1562
|
-
* Two-phase result of a **detached** checkout-session create
|
|
1563
|
-
* (TeamFloPay/backend#1099).
|
|
1564
|
-
*
|
|
1565
|
-
* `shell` resolves first, from a create that ran no catalog validation and took
|
|
1566
|
-
* no buyer-identity advisory locks. It already carries the session id, nonce,
|
|
1567
|
-
* routed `gateways` and the hosted `vault` block, so the card form can mount
|
|
1568
|
-
* from it. It does **not** carry products, coupons, buyer identity or cart
|
|
1569
|
-
* totals — those arrive with `claimed`.
|
|
1570
|
-
*
|
|
1571
|
-
* `claimed` starts immediately and resolves when
|
|
1572
|
-
* `PATCH /v1/checkouts/sessions/{id}/claim` attaches the catalog. A draft with
|
|
1573
|
-
* email uses a combined catalog+buyer claim; an email-less draft omits
|
|
1574
|
-
* `accountData` and resolves with a fully-populated anonymous session whose
|
|
1575
|
-
* `buyerIdentified` marker is false. Nothing may be charged until it settles:
|
|
1576
|
-
* the billing API rejects process / intent / decline calls on an unclaimed
|
|
1577
|
-
* session with `409 checkout_session_data_attachment_required`, and its vault
|
|
1578
|
-
* webhook holds an unclaimed charge with a `503` until the claim lands.
|
|
1579
|
-
*/
|
|
1580
|
-
interface DetachedCheckoutSession {
|
|
1581
|
-
/** Lightweight shell — mountable card form, no cart or buyer data yet. */
|
|
1582
|
-
shell: NormalizedCheckoutSession;
|
|
1583
|
-
/** Session id of the shell, available before `claimed` settles. */
|
|
1584
|
-
sessionId: string;
|
|
1585
|
-
/** Session-bound checkout token, required by the claim and every later call. */
|
|
1586
|
-
nonce: string;
|
|
1587
|
-
/** Resolves with the catalog-attached session once the initial claim lands. */
|
|
1588
|
-
claimed: Promise<NormalizedCheckoutSession>;
|
|
1589
|
-
/**
|
|
1590
|
-
* Attach buyer identity collected after an email-less session's catalog was
|
|
1591
|
-
* attached. Sessions created with an email return `claimed` from this method.
|
|
1592
|
-
*
|
|
1593
|
-
* Once a claim has actually started, repeated calls return the same
|
|
1594
|
-
* replay-safe claim promise. A call rejected by *local* validation (e.g. a
|
|
1595
|
-
* missing or malformed email) does not consume the operation: it returns a
|
|
1596
|
-
* fresh rejected promise, so a later call with a valid email can still start
|
|
1597
|
-
* buyer attachment. Blank/null identity fields are omitted from the request.
|
|
1598
|
-
*/
|
|
1599
|
-
claim(account?: Partial<CheckoutAccount>): Promise<NormalizedCheckoutSession>;
|
|
1600
|
-
}
|
|
1601
|
-
/** A one-time purchase item for checkout session creation. */
|
|
1602
|
-
interface CheckoutItem {
|
|
1603
|
-
/**
|
|
1604
|
-
* Catalog code for the item — the preferred identifier. When omitted, the
|
|
1605
|
-
* deprecated `providerItemId` is used as a fallback.
|
|
1606
|
-
*/
|
|
1607
|
-
code?: string;
|
|
1608
|
-
/**
|
|
1609
|
-
* @deprecated Use {@link CheckoutItem.code}. Still accepted as a fallback
|
|
1610
|
-
* when `code` is not provided.
|
|
1611
|
-
*/
|
|
1612
|
-
providerItemId?: string;
|
|
1613
|
-
/**
|
|
1614
|
-
* Display-only name for the item. Takes priority over the deprecated
|
|
1615
|
-
* `providerItemName`. Backend resolves names from the catalog; pass this
|
|
1616
|
-
* to seed the client-side display cache for the post-redirect fetch.
|
|
1617
|
-
*/
|
|
1618
|
-
itemName?: string | null;
|
|
1619
|
-
/** @deprecated Use {@link CheckoutItem.itemName}. Still accepted as a fallback when `itemName` is not provided. */
|
|
1620
|
-
providerItemName?: string | null;
|
|
1621
|
-
/** Defaults to 1. */
|
|
1622
|
-
quantity?: number;
|
|
1623
|
-
/** Display-only. Backend resolves prices from the catalog; pass this to seed the client-side display cache so the UI can render the regular price after redirect. */
|
|
1624
|
-
totalAmount?: number;
|
|
1625
|
-
/** Display-only. Backend ignores this entirely; pass this to seed the client-side display cache so the UI can render the discounted price after redirect. */
|
|
1626
|
-
overrideAmount?: number | null;
|
|
1627
|
-
/** @deprecated Prefer the session-level `currency` on {@link CreateSessionParams}/{@link InlineSessionParams}. */
|
|
1628
|
-
currency?: string;
|
|
1629
|
-
/** Arbitrary key/value metadata forwarded to the backend. */
|
|
1630
|
-
metadata?: Record<string, unknown> | null;
|
|
1631
|
-
}
|
|
1632
|
-
/**
|
|
1633
|
-
* Unified product input for checkout session creation. Mirrors the backend's
|
|
1634
|
-
* `CreateCheckoutProductBodyDto` introduced in #760 — the SDK accepts this
|
|
1635
|
-
* shape on `CreateSessionParams.products`. Callers using the legacy
|
|
1636
|
-
* {@link CheckoutItem} / {@link CheckoutSubscription} shapes do not need to
|
|
1637
|
-
* migrate; the SDK folds them into this shape internally.
|
|
1638
|
-
*/
|
|
1639
|
-
interface CheckoutProduct {
|
|
1640
|
-
/**
|
|
1641
|
-
* @deprecated Optional and no longer needed — the backend resolves item vs
|
|
1642
|
-
* subscription from the catalog `code`. Pass it only to refine the
|
|
1643
|
-
* client-side optimistic display rendered before the session response loads
|
|
1644
|
-
* (subscriptions are listed first). Safe to omit.
|
|
1645
|
-
*/
|
|
1646
|
-
type?: CheckoutProductType;
|
|
1647
|
-
/** Catalog code — preferred identifier. */
|
|
1648
|
-
code?: string;
|
|
1649
|
-
/** @deprecated Falls back to {@link CheckoutProduct.code} for back-compat. */
|
|
1650
|
-
providerItemId?: string;
|
|
1651
|
-
/** @deprecated Falls back to {@link CheckoutProduct.code} for back-compat. */
|
|
1652
|
-
providerPlanId?: string;
|
|
1653
|
-
/** Display-only name for the product. */
|
|
1654
|
-
name?: string | null;
|
|
1655
|
-
/** @deprecated Use {@link CheckoutProduct.name}. */
|
|
1656
|
-
itemName?: string | null;
|
|
1657
|
-
/** @deprecated Use {@link CheckoutProduct.name}. */
|
|
1658
|
-
providerItemName?: string | null;
|
|
1659
|
-
/** @deprecated Use {@link CheckoutProduct.name}. */
|
|
1660
|
-
subscriptionName?: string | null;
|
|
1661
|
-
/** @deprecated Use {@link CheckoutProduct.name}. */
|
|
1662
|
-
providerPlanName?: string | null;
|
|
1663
|
-
/** Defaults to 1. */
|
|
1664
|
-
quantity?: number;
|
|
1665
|
-
/** Display-only. Backend resolves prices from the catalog. */
|
|
1666
|
-
totalAmount?: number;
|
|
1667
|
-
/** Display-only discount override. Backend ignores this entirely. */
|
|
1668
|
-
overrideAmount?: number | null;
|
|
1669
|
-
/** @deprecated Prefer the session-level `currency`. */
|
|
1670
|
-
currency?: string;
|
|
1671
|
-
metadata?: Record<string, unknown> | null;
|
|
1672
|
-
}
|
|
1673
|
-
/** A recurring subscription plan for checkout session creation. */
|
|
1674
|
-
interface CheckoutSubscription {
|
|
1675
|
-
/**
|
|
1676
|
-
* Catalog code for the plan — the preferred identifier. When omitted, the
|
|
1677
|
-
* deprecated `providerPlanId` is used as a fallback.
|
|
1678
|
-
*/
|
|
1679
|
-
code?: string;
|
|
1680
|
-
/**
|
|
1681
|
-
* @deprecated Use {@link CheckoutSubscription.code}. Still accepted as a
|
|
1682
|
-
* fallback when `code` is not provided.
|
|
1683
|
-
*/
|
|
1684
|
-
providerPlanId?: string;
|
|
1685
|
-
/**
|
|
1686
|
-
* Display-only name for the subscription plan. Takes priority over the
|
|
1687
|
-
* deprecated `providerPlanName`. Backend resolves names from the catalog;
|
|
1688
|
-
* pass this to seed the client-side display cache for the post-redirect fetch.
|
|
1689
|
-
*/
|
|
1690
|
-
subscriptionName?: string | null;
|
|
1691
|
-
/** @deprecated Use {@link CheckoutSubscription.subscriptionName}. Still accepted as a fallback when `subscriptionName` is not provided. */
|
|
1692
|
-
providerPlanName?: string | null;
|
|
1693
|
-
/** Defaults to 1. */
|
|
1694
|
-
quantity?: number;
|
|
1695
|
-
/** Display-only. Backend resolves prices from the catalog; pass this to seed the client-side display cache so the UI can render the regular price after redirect. */
|
|
1696
|
-
totalAmount?: number;
|
|
1697
|
-
/** Display-only. Backend ignores this entirely; pass this to seed the client-side display cache so the UI can render the discounted price after redirect. */
|
|
1698
|
-
overrideAmount?: number | null;
|
|
1699
|
-
/** @deprecated Prefer the session-level `currency` on {@link CreateSessionParams}/{@link InlineSessionParams}. */
|
|
1700
|
-
currency?: string;
|
|
1701
|
-
/** Arbitrary key/value metadata forwarded to the backend. */
|
|
1702
|
-
metadata?: Record<string, unknown> | null;
|
|
1703
|
-
}
|
|
1704
|
-
/** Buyer's account information for session creation. */
|
|
1705
|
-
interface CheckoutAccount {
|
|
1706
|
-
userId: string;
|
|
1707
|
-
firstName?: string;
|
|
1708
|
-
lastName?: string;
|
|
1709
|
-
email: string;
|
|
1710
|
-
country?: string | null;
|
|
1711
|
-
gender?: string | null;
|
|
1712
|
-
city?: string | null;
|
|
1713
|
-
state?: string | null;
|
|
1714
|
-
zip?: string | null;
|
|
1715
|
-
/** Street address (line 1). */
|
|
1716
|
-
addressLine1?: string | null;
|
|
1717
|
-
/** Apt, suite, unit (line 2). */
|
|
1718
|
-
addressLine2?: string | null;
|
|
1719
|
-
}
|
|
1720
|
-
/** Analytics / pixel tags forwarded to the checkout page. */
|
|
1721
|
-
interface TagsData {
|
|
1722
|
-
googleContainerId?: string | null;
|
|
1723
|
-
sessionId?: string | null;
|
|
1724
|
-
testEventCode?: string | null;
|
|
1725
|
-
}
|
|
1726
|
-
/**
|
|
1727
|
-
* Parameters for creating a checkout session via the billing API.
|
|
1728
|
-
* Mirrors the `CreateCheckoutSessionOptions` from clicktech-core-ui.
|
|
1729
|
-
*/
|
|
1730
|
-
interface CreateSessionParams {
|
|
1731
|
-
/** Base URL of the billing API, e.g. https://billing.clicktech.com */
|
|
1732
|
-
billingApiUrl: string;
|
|
1733
|
-
/** Base URL of the checkout frontend, e.g. https://checkout.clicktech.com */
|
|
1734
|
-
checkoutBaseUrl: string;
|
|
1735
|
-
/** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
|
|
1736
|
-
telemetry?: boolean;
|
|
1737
|
-
/** The client ID for the checkout session. */
|
|
1738
|
-
clientId: string;
|
|
1739
|
-
/**
|
|
1740
|
-
* Session-level ISO 4217 currency code. **Required** by post-#760
|
|
1741
|
-
* backends (`@IsNotEmpty`). The SDK resolves it from this field first,
|
|
1742
|
-
* then `items[0].currency`, then `subscriptions[0].currency`, then
|
|
1743
|
-
* `products[0].currency`. When none resolve, the SDK throws
|
|
1744
|
-
* `FloPayError('validation_error')` before issuing the HTTP request.
|
|
1745
|
-
*/
|
|
1746
|
-
currency?: string;
|
|
1747
|
-
/**
|
|
1748
|
-
* Unified products array. When supplied, it is sent verbatim and
|
|
1749
|
-
* {@link CreateSessionParams.items} / {@link CreateSessionParams.subscriptions}
|
|
1750
|
-
* are ignored. Otherwise the SDK folds the legacy fields into this shape
|
|
1751
|
-
* before POSTing to the backend.
|
|
1752
|
-
*/
|
|
1753
|
-
products?: CheckoutProduct[];
|
|
1754
|
-
/** One-time purchase items. Folded into `products[]` before send. */
|
|
1755
|
-
items?: CheckoutItem[];
|
|
1756
|
-
/** Recurring subscription plans. Folded into `products[]` before send. */
|
|
1757
|
-
subscriptions?: CheckoutSubscription[];
|
|
1758
|
-
/** Buyer's account information. */
|
|
1759
|
-
account: CheckoutAccount;
|
|
1760
|
-
/** URL to redirect to after successful payment. */
|
|
1761
|
-
successUrl: string;
|
|
1762
|
-
/** URL to redirect to if the user cancels. */
|
|
1763
|
-
cancelUrl: string;
|
|
1764
|
-
/**
|
|
1765
|
-
* Checkout mode sent to the billing API.
|
|
1766
|
-
* - 'confirm' – show a payment confirmation page (default)
|
|
1767
|
-
* - 'auto' – skip confirmation when a payment method is already on file
|
|
1768
|
-
* - 'full' – full checkout flow
|
|
1769
|
-
*/
|
|
1770
|
-
checkoutMode?: 'confirm' | 'auto' | 'full';
|
|
1771
|
-
/**
|
|
1772
|
-
* Payment capture behavior. Omit (or use `'automatic'`) to preserve
|
|
1773
|
-
* immediate capture; use `'manual'` to authorise funds for later capture.
|
|
1774
|
-
* Manual capture is not supported for subscription products.
|
|
1775
|
-
*/
|
|
1776
|
-
captureMethod?: CaptureMethod;
|
|
1777
|
-
/** Coupon codes to apply. */
|
|
1778
|
-
couponCodes?: string[];
|
|
1779
|
-
/** Non-sensitive client context preserved as an immutable checkout-lifecycle snapshot. */
|
|
1780
|
-
checkoutMetadata?: CheckoutMetadata | null;
|
|
1781
|
-
/** Pixel / analytics tags forwarded to the checkout page. */
|
|
1782
|
-
tagsData?: TagsData;
|
|
1783
|
-
/** Extra query params appended to the checkout redirect URL. */
|
|
1784
|
-
redirectParams?: Record<string, string>;
|
|
1785
|
-
/** Whether to set the checkout_data cookie. Defaults to true. */
|
|
1786
|
-
setCookie?: boolean;
|
|
1787
|
-
/** Request timeout in milliseconds. Defaults to 12000. */
|
|
1788
|
-
timeoutMs?: number;
|
|
1789
|
-
/** UTM and funnel tracking metadata. */
|
|
1790
|
-
utmMetadata?: Record<string, string | null | undefined>[];
|
|
1791
|
-
/**
|
|
1792
|
-
* Optional idempotency key identifying exactly **one** logical checkout
|
|
1793
|
-
* creation (TeamFloPay/backend#972). When supplied it is sent unchanged as
|
|
1794
|
-
* the `Idempotency-Key` header and reused across the SDK's transport retries,
|
|
1795
|
-
* so a timeout or lost response cannot mint a second session. Supply this to
|
|
1796
|
-
* keep the key stable across React remounts, multiple SDK instances, or
|
|
1797
|
-
* server retries you control; it **must not** be reused for a new purchase.
|
|
1798
|
-
* In browser flows (`@flopay/js` and `@flopay/react`), omitting the option
|
|
1799
|
-
* generates a fresh cryptographically random key for the SDK's retry loop.
|
|
1800
|
-
* `@flopay/node` has no internal retry loop, so omission sends no header and
|
|
1801
|
-
* the server integration owns key reuse across calls. Must be non-empty and
|
|
1802
|
-
* at most 255 characters when supplied.
|
|
1803
|
-
*/
|
|
1804
|
-
idempotencyKey?: string;
|
|
1805
|
-
}
|
|
1806
|
-
/**
|
|
1807
|
-
* Parameters for inline session creation via `FloPayCheckout.createSession`.
|
|
1808
|
-
* Subset of `CreateSessionParams` — no redirect fields needed since the
|
|
1809
|
-
* component handles the checkout flow inline.
|
|
1810
|
-
*/
|
|
1811
|
-
interface InlineSessionParams {
|
|
1812
|
-
/** The client ID for the checkout session. */
|
|
1813
|
-
clientId: string;
|
|
1814
|
-
/**
|
|
1815
|
-
* Session-level ISO 4217 currency code. **Required** by post-#760
|
|
1816
|
-
* backends (`@IsNotEmpty`). The SDK resolves it from this field first,
|
|
1817
|
-
* then `items[0].currency`, then `subscriptions[0].currency`, then
|
|
1818
|
-
* `products[0].currency`. When none resolve, the SDK throws
|
|
1819
|
-
* `FloPayError('validation_error')` before issuing the HTTP request.
|
|
1820
|
-
*/
|
|
1821
|
-
currency?: string;
|
|
1822
|
-
/**
|
|
1823
|
-
* Unified products array. When supplied, it is sent verbatim and
|
|
1824
|
-
* {@link InlineSessionParams.items} / {@link InlineSessionParams.subscriptions}
|
|
1825
|
-
* are ignored. Otherwise the SDK folds the legacy fields into this shape
|
|
1826
|
-
* before POSTing to the backend.
|
|
1827
|
-
*/
|
|
1828
|
-
products?: CheckoutProduct[];
|
|
1829
|
-
/** One-time purchase items. Folded into `products[]` before send. */
|
|
1830
|
-
items?: CheckoutItem[];
|
|
1831
|
-
/** Recurring subscription plans. Folded into `products[]` before send. */
|
|
1832
|
-
subscriptions?: CheckoutSubscription[];
|
|
1833
|
-
/** Buyer's account information. */
|
|
1834
|
-
account: CheckoutAccount;
|
|
1835
|
-
/** URL to redirect to after successful payment. */
|
|
1836
|
-
successUrl: string;
|
|
1837
|
-
/** URL to redirect to if the user cancels. */
|
|
1838
|
-
cancelUrl: string;
|
|
1839
|
-
/** Checkout mode: 'full' (default), 'auto', or 'confirm'. */
|
|
1840
|
-
checkoutMode?: 'full' | 'auto' | 'confirm';
|
|
1841
|
-
/**
|
|
1842
|
-
* Payment capture behavior. Omit (or use `'automatic'`) to preserve
|
|
1843
|
-
* immediate capture; use `'manual'` to authorise funds for later capture.
|
|
1844
|
-
* Manual capture is not supported for subscription products.
|
|
1845
|
-
*/
|
|
1846
|
-
captureMethod?: CaptureMethod;
|
|
1847
|
-
/** Optional saved/tokenized payment method for inline auto or confirm checkout. */
|
|
1848
|
-
tokenizedData?: TokenizedBody;
|
|
1849
|
-
/** Coupon codes to apply. */
|
|
1850
|
-
couponCodes?: string[];
|
|
1851
|
-
/** Non-sensitive client context preserved as an immutable checkout-lifecycle snapshot. */
|
|
1852
|
-
checkoutMetadata?: CheckoutMetadata | null;
|
|
1853
|
-
/** Pixel / analytics tags. */
|
|
1854
|
-
tagsData?: TagsData;
|
|
1855
|
-
/** UTM and funnel tracking metadata. */
|
|
1856
|
-
utmMetadata?: Record<string, string | null | undefined>[];
|
|
1857
|
-
/**
|
|
1858
|
-
* `timeoutMs` is the checkout-session request deadline in milliseconds and
|
|
1859
|
-
* defaults to 12000. During detached creation, the shell POST and initial catalogue claim PATCH
|
|
1860
|
-
* each receive this full budget independently. A one-shot create retains one
|
|
1861
|
-
* total deadline across its request, retries, and backoff.
|
|
1862
|
-
*/
|
|
1863
|
-
timeoutMs?: number;
|
|
1864
|
-
/**
|
|
1865
|
-
* Optional idempotency key identifying exactly **one** logical checkout
|
|
1866
|
-
* creation (TeamFloPay/backend#972). When supplied it is sent unchanged as
|
|
1867
|
-
* the `Idempotency-Key` header and reused across the SDK's transport retries.
|
|
1868
|
-
* Supply this to keep the key stable across React remounts, multiple SDK
|
|
1869
|
-
* instances, or server retries you control; it **must not** be reused for a
|
|
1870
|
-
* new purchase. When omitted, the SDK generates a fresh, cryptographically
|
|
1871
|
-
* random key per create. Must be non-empty and at most 255 characters.
|
|
1872
|
-
*/
|
|
1873
|
-
idempotencyKey?: string;
|
|
1874
|
-
/**
|
|
1875
|
-
* Opt out of **detached** session creation (TeamFloPay/backend#1099).
|
|
1876
|
-
*
|
|
1877
|
-
* Defaults to `true`: the SDK creates a lightweight session *shell* first
|
|
1878
|
-
* (`POST /v1/checkouts/sessions` with `deferDataAttachment: true`), mounts the
|
|
1879
|
-
* hosted card form from that response, then attaches buyer identity, address,
|
|
1880
|
-
* products and coupons in the background via
|
|
1881
|
-
* `PATCH /v1/checkouts/sessions/{id}/claim`. The shell create takes no
|
|
1882
|
-
* buyer-identity advisory locks and runs no catalog validation, so the card
|
|
1883
|
-
* form becomes interactive without waiting for either.
|
|
1884
|
-
*
|
|
1885
|
-
* Set to `false` to use the original one-shot create, which sends buyer and
|
|
1886
|
-
* catalog data in the single `POST` and returns the fully-populated session.
|
|
1887
|
-
* Behaviour is otherwise identical — the same session, callbacks and results.
|
|
1888
|
-
*
|
|
1889
|
-
* Detached creation requires `checkoutMode: 'full'` (the billing API rejects
|
|
1890
|
-
* `deferDataAttachment` for `auto` / `confirm`) and is skipped automatically
|
|
1891
|
-
* when {@link InlineSessionParams.tokenizedData} is supplied, since a
|
|
1892
|
-
* saved-payment session must carry its cart from the start.
|
|
1893
|
-
*/
|
|
1894
|
-
deferDataAttachment?: boolean;
|
|
1895
|
-
/** Whether AVS is enabled for this checkout. */
|
|
1896
|
-
avsCheck?: boolean;
|
|
1897
|
-
/** Checkout type: 'standard_checkout' or 'embedded_checkout'. */
|
|
1898
|
-
checkoutType?: string;
|
|
1899
|
-
/** Checkout layout: 'default_layout', 'buttons_layout', or 'custom_layout'. */
|
|
1900
|
-
checkoutLayout?: string;
|
|
1901
|
-
/** AVS field configuration for analytics. */
|
|
1902
|
-
avsConfig?: AVSFieldConfig;
|
|
1903
|
-
}
|
|
1904
|
-
/** Payment methods exposed by the React buttons layout callbacks. */
|
|
1905
|
-
type CheckoutButtonMethod = 'card' | 'paypal' | 'apple_pay' | 'google_pay';
|
|
1906
|
-
/**
|
|
1907
|
-
* Draft inline-session params used by `FloPayCheckout` before a real
|
|
1908
|
-
* checkout session has been created. Buttons-layout checkout can seed
|
|
1909
|
-
* placeholder account data up front; `onBeforeButtonClick` can still
|
|
1910
|
-
* update it before the selected payment button continues.
|
|
1911
|
-
*/
|
|
1912
|
-
interface InlineSessionDraft extends Omit<InlineSessionParams, 'account'> {
|
|
1913
|
-
account: Omit<CheckoutAccount, 'email'> & {
|
|
1914
|
-
email?: string;
|
|
1915
|
-
};
|
|
1916
|
-
}
|
|
1917
|
-
/**
|
|
1918
|
-
* Partial inline-session fields that can be returned from
|
|
1919
|
-
* `onBeforeButtonClick` and merged into the draft session params.
|
|
1920
|
-
*/
|
|
1921
|
-
interface InlineSessionPatch {
|
|
1922
|
-
account?: Partial<CheckoutAccount>;
|
|
1923
|
-
couponCodes?: string[];
|
|
1924
|
-
/** Replaces the draft checkout metadata as a whole value. */
|
|
1925
|
-
checkoutMetadata?: CheckoutMetadata | null;
|
|
1926
|
-
tagsData?: TagsData;
|
|
1927
|
-
utmMetadata?: Record<string, string | null | undefined>[];
|
|
1928
|
-
}
|
|
1929
|
-
/** Context passed to the `onBeforeButtonClick` callback for buttons-layout payment methods. */
|
|
1930
|
-
interface BeforeButtonClickEvent {
|
|
1931
|
-
method: CheckoutButtonMethod;
|
|
1932
|
-
sessionId?: string;
|
|
1933
|
-
createSession?: InlineSessionDraft;
|
|
1934
|
-
}
|
|
1935
|
-
/** Structured decline event emitted by the React checkout components. */
|
|
1936
|
-
interface DeclineEvent {
|
|
1937
|
-
method: CheckoutButtonMethod;
|
|
1938
|
-
message: string;
|
|
1939
|
-
code?: string;
|
|
1940
|
-
declineCode?: string;
|
|
1941
|
-
/**
|
|
1942
|
-
* The checkout session that was declined, when one exists: for matching the
|
|
1943
|
-
* decline to `payment.*` webhooks and the dashboard. Never the session nonce.
|
|
1944
|
-
*/
|
|
1945
|
-
sessionId?: string;
|
|
1946
|
-
}
|
|
1947
|
-
/**
|
|
1948
|
-
* The buyer closed or left PayPal without approving: reported once per click
|
|
1949
|
-
* attempt by the direct PayPal button and forwarded by `SplitCardForm` and
|
|
1950
|
-
* `FloPayCheckout` (`onCancel` in React, the `cancel` event in Vue). It is
|
|
1951
|
-
* never reported for an approval, a decline or a technical failure.
|
|
1952
|
-
*/
|
|
1953
|
-
interface FloPayPaymentCancelEvent {
|
|
1954
|
-
status: 'cancelled';
|
|
1955
|
-
/** The attempt's session: the click-time patched session, else the button's. */
|
|
1956
|
-
sessionId: string;
|
|
1957
|
-
provider: 'paypal';
|
|
1958
|
-
/** `paypal_vaulted` on the Flo-owned vaulted channel, `paypal` otherwise. */
|
|
1959
|
-
paymentMethodType: 'paypal' | 'paypal_vaulted';
|
|
1960
|
-
}
|
|
1961
|
-
/** Result from creating a checkout session. */
|
|
1962
|
-
type CheckoutSessionResult = {
|
|
1963
|
-
status: 201;
|
|
1964
|
-
redirectUrl: string;
|
|
1965
|
-
/**
|
|
1966
|
-
* Session-bound checkout token returned by the billing API alongside the
|
|
1967
|
-
* session UUID. Must be echoed back on every continuation request via the
|
|
1968
|
-
* `x-checkout-session-token` header — backend `TeamFloPay/backend#640`
|
|
1969
|
-
* matches this value against `checkout_session.nonce` to authorize the
|
|
1970
|
-
* call. Surfaced here so the redirect-style flow's caller can forward it
|
|
1971
|
-
* (e.g. into a hosted checkout page that hits continuation routes).
|
|
1972
|
-
*/
|
|
1973
|
-
nonce: string;
|
|
1974
|
-
} | {
|
|
1975
|
-
status: 204;
|
|
1976
|
-
} | {
|
|
1977
|
-
status: number;
|
|
1978
|
-
};
|
|
1979
|
-
/**
|
|
1980
|
-
* Data submitted when processing a payment (tokenized card/wallet data).
|
|
1981
|
-
* Mirrors checkout project's ProcessCheckoutBodyDto.
|
|
1982
|
-
*/
|
|
1983
|
-
interface ProcessPaymentParams {
|
|
1984
|
-
sessionId: string;
|
|
1985
|
-
/** Privacy-safe payment-method family used to attribute processing telemetry. */
|
|
1986
|
-
paymentMethodCategory?: TelemetryPaymentMethodCategory;
|
|
1987
|
-
/**
|
|
1988
|
-
* Session-bound checkout token returned from session creation. Forwarded as
|
|
1989
|
-
* the `x-checkout-session-token` header on every call to
|
|
1990
|
-
* `POST /v1/checkouts/sessions/:id/process`. Required by post-#640 backends —
|
|
1991
|
-
* `PaymentAPI.processPayment` throws `MissingCheckoutSessionToken` when this
|
|
1992
|
-
* is missing or empty so the 401 fails fast on the client instead of after
|
|
1993
|
-
* the network round trip. Typed as optional so callers do not need to coerce
|
|
1994
|
-
* `undefined` to `''` to satisfy the type — pass the value through verbatim
|
|
1995
|
-
* and let `processPayment` surface the missing-token error.
|
|
1996
|
-
*/
|
|
1997
|
-
nonce?: string;
|
|
1998
|
-
tokenizedData?: TokenizedBody;
|
|
1999
|
-
accountData: {
|
|
2000
|
-
userId: string;
|
|
2001
|
-
email: string;
|
|
2002
|
-
firstName?: string;
|
|
2003
|
-
lastName?: string;
|
|
2004
|
-
zip?: string;
|
|
2005
|
-
country?: string;
|
|
2006
|
-
city?: string;
|
|
2007
|
-
state?: string;
|
|
2008
|
-
addressLine1?: string;
|
|
2009
|
-
addressLine2?: string;
|
|
2010
|
-
};
|
|
2011
|
-
chv?: string;
|
|
2012
|
-
/** Current page URL for redirect-capable auth flows such as 3DS and PayPal. */
|
|
2013
|
-
returnUrl?: string;
|
|
2014
|
-
/** Whether AVS (Address Verification) was enabled for this checkout. */
|
|
2015
|
-
avsCheck?: boolean;
|
|
2016
|
-
/** Checkout type: 'standard_checkout' or 'embedded_checkout'. */
|
|
2017
|
-
checkoutType?: string;
|
|
2018
|
-
/** Checkout layout: 'default_layout', 'buttons_layout', or 'custom_layout'. */
|
|
2019
|
-
checkoutLayout?: string;
|
|
2020
|
-
/** AVS field configuration for analytics — which fields were shown. */
|
|
2021
|
-
avsConfig?: AVSFieldConfig;
|
|
2022
|
-
}
|
|
2023
|
-
/** Parameters for creating a customer. */
|
|
2024
|
-
interface CreateCustomerParams {
|
|
2025
|
-
email: string;
|
|
2026
|
-
name?: string;
|
|
2027
|
-
metadata?: Record<string, string>;
|
|
2028
|
-
}
|
|
2029
|
-
/** Parameters for updating a customer. */
|
|
2030
|
-
interface UpdateCustomerParams {
|
|
2031
|
-
email?: string;
|
|
2032
|
-
name?: string;
|
|
2033
|
-
metadata?: Record<string, string>;
|
|
2034
|
-
}
|
|
2035
|
-
/** A webhook event from FloPay. */
|
|
2036
|
-
interface WebhookEvent {
|
|
2037
|
-
id: string;
|
|
2038
|
-
type: string;
|
|
2039
|
-
data: Record<string, unknown>;
|
|
2040
|
-
created: number;
|
|
2041
|
-
}
|
|
2042
|
-
/** Currency information mapped to a country. */
|
|
2043
|
-
interface CurrencyInfo {
|
|
2044
|
-
currency: string;
|
|
2045
|
-
symbol: string;
|
|
2046
|
-
country: string;
|
|
2047
|
-
countryCode: string;
|
|
2048
|
-
/** 0 = no tax, 1 = tax (VAT) applies. */
|
|
2049
|
-
tax: number;
|
|
2050
|
-
}
|
|
2051
|
-
/** A country option for UI select elements. */
|
|
2052
|
-
interface CountryOption {
|
|
2053
|
-
code: string;
|
|
2054
|
-
name: string;
|
|
2055
|
-
flag: string;
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
|
-
/** The buyer-facing name of a checkout button method ("Card" for anything unknown). */
|
|
2059
|
-
declare function getButtonMethodLabel(method: CheckoutButtonMethod): string;
|
|
2060
|
-
/**
|
|
2061
|
-
* A value thrown by a merchant's before-click hook, as the `FloPayError` the
|
|
2062
|
-
* checkout shows and reports: a `FloPayError` is kept, an `Error` keeps its
|
|
2063
|
-
* message, anything else becomes "<Method> before-click hook failed.". All are
|
|
2064
|
-
* `validation_error`s unless the hook threw a `FloPayError` of its own.
|
|
2065
|
-
*/
|
|
2066
|
-
declare function normalizeBeforeButtonClickError(method: CheckoutButtonMethod, err: unknown): FloPayError;
|
|
2067
|
-
|
|
2068
|
-
/**
|
|
2069
|
-
* Whether a read session is safe to mount in a no-charge card-setup surface.
|
|
2070
|
-
* Both the explicit setup mode and the empty, zero-amount cart are required so
|
|
2071
|
-
* a purchase session can never be mistaken for a bare card form.
|
|
2072
|
-
*/
|
|
2073
|
-
declare function isCardSetupCheckoutSession(session: CheckoutSession): boolean;
|
|
2074
|
-
|
|
2075
|
-
/** The states of the processing / outcome modal a setup surface draws. */
|
|
2076
|
-
type ProcessingOverlayStatus = 'processing' | 'success' | 'error';
|
|
2077
|
-
/**
|
|
2078
|
-
* Visual treatment for the processing / outcome modal. Framework-free: the
|
|
2079
|
-
* panel is a plain style object, so every UI binding draws the same modal
|
|
2080
|
-
* from one derivation (TeamFloPay/sdk#410, CTO decision 1).
|
|
2081
|
-
*/
|
|
2082
|
-
interface ProcessingOverlayThemeColors {
|
|
2083
|
-
/** Panel surface (background, border, radius, shadow) plus base text color and font. */
|
|
2084
|
-
panel: Record<string, string | number>;
|
|
2085
|
-
spinnerTrackColor: string;
|
|
2086
|
-
spinnerAccentColor: string;
|
|
2087
|
-
labelColors: Record<ProcessingOverlayStatus, string>;
|
|
2088
|
-
/** Secondary copy: the success note and the failure message. */
|
|
2089
|
-
noteColor: string;
|
|
2090
|
-
}
|
|
2091
|
-
/**
|
|
2092
|
-
* The resolved look an overlay is drawn from: a preset bundle, or the
|
|
2093
|
-
* effective appearance and buttons layout once a stored theme's overrides are
|
|
2094
|
-
* merged over it. A `ThemeBundle` is one.
|
|
2095
|
-
*/
|
|
2096
|
-
interface CardSetupOverlaySource {
|
|
2097
|
-
appearance?: FloPayAppearance | undefined;
|
|
2098
|
-
buttonsLayout: ButtonsLayoutStyles;
|
|
2099
|
-
}
|
|
2100
|
-
/**
|
|
2101
|
-
* The card-setup processing / success / error modal for a named preset (or a
|
|
2102
|
-
* stored theme resolved over one): the panel reuses the credit-card pane
|
|
2103
|
-
* surface and typography; processing wears the primary on the spinner; success
|
|
2104
|
-
* and error keep semantic accents. A missing appearance reads as an empty one,
|
|
2105
|
-
* which resolves to the neutral light defaults.
|
|
2106
|
-
*/
|
|
2107
|
-
declare function computeCardSetupOverlayTheme({ appearance, buttonsLayout, }: CardSetupOverlaySource): ProcessingOverlayThemeColors;
|
|
2108
|
-
|
|
2109
|
-
/**
|
|
2110
|
-
* Surface treatment for the card-setup container — the same complete
|
|
2111
|
-
* `cardFormContainer` look the checkout's credit-card pane wears for a preset —
|
|
2112
|
-
* merged beneath the merchant's `containerStyle` with deterministic precedence:
|
|
2113
|
-
*
|
|
2114
|
-
* 1. Every `containerStyle` property wins over the preset value for the same
|
|
2115
|
-
* property.
|
|
2116
|
-
* 2. Declarations are applied preset-first, then `containerStyle` in the
|
|
2117
|
-
* merchant's own order, so a `containerStyle` longhand refines a preset
|
|
2118
|
-
* shorthand of the same family (`borderColor` recolors the preset `border`;
|
|
2119
|
-
* `paddingTop` adjusts one side) exactly as CSS cascades a later declaration.
|
|
2120
|
-
* 3. Background is the one family a longhand cannot refine: a color cannot
|
|
2121
|
-
* displace a preset gradient's image layer. Any `background*` member in
|
|
2122
|
-
* `containerStyle` therefore replaces the preset's background family
|
|
2123
|
-
* entirely, so a merchant color never shows a glass gradient through it.
|
|
2124
|
-
*
|
|
2125
|
-
* Raw `VaultCardThemeColors` supply no surface, and neither does `classic`
|
|
2126
|
-
* unless a stored `buttonsStyles.cardFormContainer` is given (sdk#447); without
|
|
2127
|
-
* a surface `containerStyle` applies alone — byte-for-byte the released behavior.
|
|
2128
|
-
*
|
|
2129
|
-
* Framework-free (any style-object type), so every UI binding merges the same
|
|
2130
|
-
* way (TeamFloPay/sdk#410, CTO decision 1).
|
|
2131
|
-
*/
|
|
2132
|
-
declare function mergeCardSetupSurface<Style extends object>(surface: Style | undefined, containerStyle: Style | undefined): Style | undefined;
|
|
2133
|
-
|
|
2134
|
-
/**
|
|
2135
|
-
* Merge a `buttonsStyles` override over a base buttons layout exactly as
|
|
2136
|
-
* `FloPayCheckout` (its `SplitCardForm`) does: top-level members replace the
|
|
2137
|
-
* base's, and each style group in {@link MERGED_BUTTONS_GROUPS} merges property
|
|
2138
|
-
* by property. A group that is not an object (malformed persisted data) is
|
|
2139
|
-
* ignored rather than spread, so it can never throw or leak junk keys.
|
|
2140
|
-
*/
|
|
2141
|
-
declare function mergeButtonsStyles(base: ButtonsLayoutStyles, override: ButtonsLayoutStyles | undefined): ButtonsLayoutStyles;
|
|
2142
|
-
/** Inputs for {@link resolveCardSetupTheme}: the `FloPayCardSetup` theming props. */
|
|
2143
|
-
interface CardSetupThemeSource {
|
|
2144
|
-
theme: ThemeId | VaultCardThemeColors;
|
|
2145
|
-
appearance?: FloPayAppearance | undefined;
|
|
2146
|
-
buttonsStyles?: ButtonsLayoutStyles | undefined;
|
|
2147
|
-
}
|
|
2148
|
-
/** Everything the card-setup surface paints, resolved from one stored theme. */
|
|
2149
|
-
interface CardSetupThemeResolution {
|
|
2150
|
-
/**
|
|
2151
|
-
* The hosted-widget directive: computed colors, raw colors passed through
|
|
2152
|
-
* untouched, or `null` — the explicit classic reset.
|
|
2153
|
-
*/
|
|
2154
|
-
vaultTheme: VaultCardThemeColors | null;
|
|
2155
|
-
/** The pane surface laid beneath the merchant's `containerStyle`, if any. */
|
|
2156
|
-
surface: Record<string, string | number> | undefined;
|
|
2157
|
-
/** The outcome overlay's theme; `undefined` keeps the neutral modal. */
|
|
2158
|
-
overlayTheme: ProcessingOverlayThemeColors | undefined;
|
|
2159
|
-
/**
|
|
2160
|
-
* The effective appearance (the override, else the preset's), for what a
|
|
2161
|
-
* setup surface draws beside the hosted form: Stripe Elements and the method
|
|
2162
|
-
* tiles. `undefined` for raw colors and for a bare `'classic'`.
|
|
2163
|
-
*/
|
|
2164
|
-
appearance: FloPayAppearance | undefined;
|
|
2165
|
-
/**
|
|
2166
|
-
* The effective buttons layout (`buttonsStyles` merged over the preset's), for
|
|
2167
|
-
* the wallet, PayPal and APM buttons and tiles. `undefined` for raw colors and
|
|
2168
|
-
* for a bare `'classic'`.
|
|
2169
|
-
*/
|
|
2170
|
-
buttonsLayout: ButtonsLayoutStyles | undefined;
|
|
2171
|
-
}
|
|
2172
|
-
/**
|
|
2173
|
-
* Resolve the card-setup theming props the same way `FloPayCheckout` resolves
|
|
2174
|
-
* its own, so one stored theme (`themePreset` → `theme`, plus `appearance` and
|
|
2175
|
-
* `buttonsStyles`) renders the hosted card form identically on both surfaces:
|
|
2176
|
-
*
|
|
2177
|
-
* - An `appearance` override replaces the preset's appearance outright.
|
|
2178
|
-
* - `buttonsStyles` merges over the preset's buttons layout
|
|
2179
|
-
* ({@link mergeButtonsStyles}).
|
|
2180
|
-
* - `'classic'` only means "no bundle base": overrides still apply over the
|
|
2181
|
-
* default (empty) layout, and with none it keeps the historic `null` reset,
|
|
2182
|
-
* no surface and the neutral overlay.
|
|
2183
|
-
* - Raw `VaultCardThemeColors` pass through untouched; overrides are ignored.
|
|
2184
|
-
* - Empty override groups count as absent; an unknown preset id resolves to
|
|
2185
|
-
* `modern-light`.
|
|
2186
|
-
*
|
|
2187
|
-
* The effective appearance and layout drive every output: the hosted field
|
|
2188
|
-
* colors and font, the hosted submit snapshot, the container surface and the
|
|
2189
|
-
* outcome overlay, and they are returned as is for the Stripe Elements and the
|
|
2190
|
-
* method buttons `FloPayPaymentMethodSetup` draws beside the hosted form
|
|
2191
|
-
* (sdk#461).
|
|
2192
|
-
*/
|
|
2193
|
-
declare function resolveCardSetupTheme({ theme, appearance, buttonsStyles, }: CardSetupThemeSource): CardSetupThemeResolution;
|
|
2194
|
-
|
|
2195
|
-
/**
|
|
2196
|
-
* The PayPal gateway fields the direct PayPal button needs: the session's
|
|
2197
|
-
* `gateways.paypal`, or the normalized `data.paypal` copy of it.
|
|
2198
|
-
*/
|
|
2199
|
-
interface DirectPayPalGatewaySource {
|
|
2200
|
-
/** The PayPal client id. */
|
|
2201
|
-
publishableKey?: string | null;
|
|
2202
|
-
environment?: GatewayEnvironment;
|
|
2203
|
-
providerObjectType?: PayPalProviderObjectType;
|
|
2204
|
-
approvalPresentation?: PayPalApprovalPresentation;
|
|
2205
|
-
}
|
|
2206
|
-
/** What the checkout hands its card form as `directPaypal`. */
|
|
2207
|
-
interface DirectPayPalConfig {
|
|
2208
|
-
clientId: string;
|
|
2209
|
-
environment?: GatewayEnvironment;
|
|
2210
|
-
providerObjectType?: PayPalProviderObjectType;
|
|
2211
|
-
approvalPresentation?: PayPalApprovalPresentation;
|
|
2212
|
-
existingOrderId?: string;
|
|
2213
|
-
}
|
|
2214
|
-
/**
|
|
2215
|
-
* The direct PayPal config for a session's PayPal gateway: its
|
|
2216
|
-
* `publishableKey` is the PayPal client id, and `existingOrderId` is an order
|
|
2217
|
-
* to resume instead of creating one. `undefined` when the gateway has no
|
|
2218
|
-
* client id.
|
|
2219
|
-
*/
|
|
2220
|
-
declare function resolveDirectPaypalConfig(paypal: DirectPayPalGatewaySource | null | undefined, existingOrderId?: string): DirectPayPalConfig | undefined;
|
|
2221
|
-
/**
|
|
2222
|
-
* The buyer-country gate on the Stripe methods outside the wallet row (iDEAL,
|
|
2223
|
-
* Bancontact, …). The buyer's live country (the AVS select, else the static
|
|
2224
|
-
* `country`) is matched against `enabledPaymentMethodCountries`: a method
|
|
2225
|
-
* without an entry, or with an empty list, has no gate. Without the map, the
|
|
2226
|
-
* built-in country table ({@link filterStripeMethodsByCountry}) decides. With
|
|
2227
|
-
* no country, nothing is filtered and `methods` is returned as it is.
|
|
2228
|
-
*/
|
|
2229
|
-
declare function filterStripeMethodsByCountryGate(methods: string[], country: string | null | undefined, enabledPaymentMethodCountries: Record<string, string[]> | undefined): string[];
|
|
2230
|
-
/**
|
|
2231
|
-
* Whether the session can route cards to a gateway the billing API processes
|
|
2232
|
-
* entirely server-side behind the hosted vault form — today the Worldpay
|
|
2233
|
-
* Corporate Gateway (TeamFloPay/backend#1563). Such a gateway has no browser
|
|
2234
|
-
* runtime or credentials, and its payment references are not Stripe objects.
|
|
2235
|
-
*/
|
|
2236
|
-
declare function hasServerSideCardGateway(session: CheckoutSession | null | undefined): boolean;
|
|
2237
|
-
/**
|
|
2238
|
-
* Whether an open session can recover its hosted card form from
|
|
2239
|
-
* `/vault/capture` when the read omitted the embedded block. A server-side
|
|
2240
|
-
* card gateway is the explicit card capability; a terminal session has no
|
|
2241
|
-
* form left to recover.
|
|
2242
|
-
*/
|
|
2243
|
-
declare function canRecoverHostedCardForm(session: CheckoutSession | null | undefined): boolean;
|
|
2244
|
-
|
|
2245
|
-
/** Returns whether a checkout deliberately stops after placing an authorization hold. */
|
|
2246
|
-
declare function isAuthorizationOnlySession(session?: {
|
|
2247
|
-
captureMethod?: CaptureMethod;
|
|
2248
|
-
} | null): boolean;
|
|
2249
|
-
/**
|
|
2250
|
-
* Returns whether an outcome represents money settled for the active checkout.
|
|
2251
|
-
*
|
|
2252
|
-
* `requires_capture` remains successful for legacy automatic/PayPal flows, but
|
|
2253
|
-
* can never be treated as settled for a manual-capture session.
|
|
2254
|
-
*/
|
|
2255
|
-
declare function isMoneySettledOutcome(outcome?: string | null, captureMethod?: CaptureMethod): boolean;
|
|
2256
|
-
/** Collapses provider/backend reason strings into the SDK's closed failure vocabulary. */
|
|
2257
|
-
declare function normalizeCheckoutFailureOutcome(value: unknown): CheckoutFailureOutcome | undefined;
|
|
2258
|
-
|
|
2259
|
-
interface CaptureMethodEligibilityParams {
|
|
2260
|
-
captureMethod?: CaptureMethod;
|
|
2261
|
-
products?: readonly CheckoutProduct[];
|
|
2262
|
-
items?: readonly CheckoutItem[];
|
|
2263
|
-
subscriptions?: readonly CheckoutSubscription[];
|
|
2264
|
-
}
|
|
2265
|
-
/**
|
|
2266
|
-
* Reject authorisation-only checkout carts that contain a subscription.
|
|
2267
|
-
*
|
|
2268
|
-
* The backend remains authoritative; this shared preflight keeps every SDK
|
|
2269
|
-
* creation style from mounting or redirecting to a checkout that cannot
|
|
2270
|
-
* support manual capture.
|
|
2271
|
-
*
|
|
2272
|
-
* Subscription detection in the unified `products` shape is best-effort:
|
|
2273
|
-
* `CheckoutProduct.type` is optional, so catalog-backed subscriptions that
|
|
2274
|
-
* omit it are resolved and rejected by the authoritative backend validation.
|
|
2275
|
-
*/
|
|
2276
|
-
declare function assertCaptureMethodEligible(params: CaptureMethodEligibilityParams): void;
|
|
2277
|
-
/**
|
|
2278
|
-
* Whether a session may be created through the **detached** shell + claim flow
|
|
2279
|
-
* (TeamFloPay/backend#1099).
|
|
2280
|
-
*
|
|
2281
|
-
* Detached creation is the default, but it is not universally available:
|
|
2282
|
-
*
|
|
2283
|
-
* - The billing API accepts `deferDataAttachment` only for Full checkouts
|
|
2284
|
-
* (`IsDeferredCheckoutMode`), so `auto` and `confirm` are excluded.
|
|
2285
|
-
* - A saved-payment session (`tokenizedData`) can be charged the moment it
|
|
2286
|
-
* exists, so it must carry its cart from the start.
|
|
2287
|
-
* - `deferDataAttachment: false` is the caller's explicit opt-out.
|
|
2288
|
-
*
|
|
2289
|
-
* This only decides how the SDK creates the session (detached shell or not).
|
|
2290
|
-
* Which gateway processes the card is the billing API's decision, made from
|
|
2291
|
-
* the merchant's configured gateways; the SDK never declares or filters it.
|
|
2292
|
-
*/
|
|
2293
|
-
declare function isDetachedSessionEligible(params: InlineSessionDraft): boolean;
|
|
2294
|
-
/**
|
|
2295
|
-
* Resolve the session-level currency, honoring the documented fallback:
|
|
2296
|
-
* `session.currency ?? items[*].currency ?? subscriptions[*].currency ?? products[*].currency`.
|
|
2297
|
-
*
|
|
2298
|
-
* Returns the first non-blank currency found, or `null` when nothing is set.
|
|
2299
|
-
* Empty and whitespace-only strings are treated as unset so they do not
|
|
2300
|
-
* bypass the fallback chain.
|
|
2301
|
-
*
|
|
2302
|
-
* Post-#760 backends reject session-create requests without a session-level
|
|
2303
|
-
* currency (`@IsNotEmpty`); callers should throw a validation error when
|
|
2304
|
-
* this returns `null` rather than silently defaulting.
|
|
2305
|
-
*/
|
|
2306
|
-
declare function resolveSessionCurrency(sessionCurrency: string | undefined, items?: ReadonlyArray<{
|
|
2307
|
-
currency?: string;
|
|
2308
|
-
}> | undefined, subscriptions?: ReadonlyArray<{
|
|
2309
|
-
currency?: string;
|
|
2310
|
-
}> | undefined, products?: ReadonlyArray<{
|
|
2311
|
-
currency?: string;
|
|
2312
|
-
}> | undefined): string | null;
|
|
2313
|
-
/**
|
|
2314
|
-
* Fold legacy `items` + `subscriptions` arrays into the unified `products[]`
|
|
2315
|
-
* shape introduced by backend #760. Items become `type: 'item'`,
|
|
2316
|
-
* subscriptions become `type: 'subscription'`. The relative order is
|
|
2317
|
-
* subscriptions-first then items, matching the order the previous payload
|
|
2318
|
-
* builders emitted on the wire.
|
|
2319
|
-
*/
|
|
2320
|
-
declare function foldIntoProducts(items: readonly CheckoutItem[] | undefined, subscriptions: readonly CheckoutSubscription[] | undefined): CheckoutProduct[];
|
|
2321
|
-
/**
|
|
2322
|
-
* Build the request payload for a single product in the unified shape
|
|
2323
|
-
* introduced by backend #760. Emits `type`, `code`, `name`, `quantity`,
|
|
2324
|
-
* `totalAmount`, `overrideAmount`, `currency`, and optional `metadata`.
|
|
2325
|
-
*/
|
|
2326
|
-
declare function buildProductPayload(product: CheckoutProduct, sessionCurrency: string): Record<string, unknown>;
|
|
2327
|
-
/**
|
|
2328
|
-
* Build the request payload for a single item.
|
|
2329
|
-
*
|
|
2330
|
-
* @deprecated Use {@link buildProductPayload} with {@link foldIntoProducts}.
|
|
2331
|
-
* Retained until the next major so external callers building the legacy
|
|
2332
|
-
* `items[]` payload manually keep working.
|
|
2333
|
-
*/
|
|
2334
|
-
declare function buildItemPayload(item: CheckoutItem, sessionCurrency: string): Record<string, unknown>;
|
|
2335
|
-
/**
|
|
2336
|
-
* Build the request payload for a single subscription.
|
|
2337
|
-
*
|
|
2338
|
-
* @deprecated Use {@link buildProductPayload} with {@link foldIntoProducts}.
|
|
2339
|
-
* Retained until the next major so external callers building the legacy
|
|
2340
|
-
* `subscriptions[]` payload manually keep working.
|
|
2341
|
-
*/
|
|
2342
|
-
declare function buildSubscriptionPayload(subscription: CheckoutSubscription, sessionCurrency: string): Record<string, unknown>;
|
|
2343
|
-
|
|
2344
|
-
/**
|
|
2345
|
-
* The `/process` request a checkout form sends when it continues a tokenized
|
|
2346
|
-
* payment itself (React's `SplitCardForm` `processPaymentInternal`, moved here
|
|
2347
|
-
* so every UI binding sends the same billing fields and analytics metadata).
|
|
2348
|
-
*/
|
|
2349
|
-
/** The billing inputs a checkout form holds when it posts `/process`. */
|
|
2350
|
-
interface CheckoutProcessAvsInput {
|
|
2351
|
-
/** The resolved AVS config (`resolveAVSConfig(enableAVS)`), or none when AVS is off. */
|
|
2352
|
-
avsConfig: AVSFieldConfig | null | undefined;
|
|
2353
|
-
/** The buyer's selected billing country (ISO 3166-1 alpha-2). */
|
|
2354
|
-
country: string;
|
|
2355
|
-
zip?: string | null;
|
|
2356
|
-
city?: string | null;
|
|
2357
|
-
state?: string | null;
|
|
2358
|
-
addressLine1?: string | null;
|
|
2359
|
-
addressLine2?: string | null;
|
|
2360
|
-
}
|
|
2361
|
-
/** The analytics metadata a checkout form adds to its `/process` request. */
|
|
2362
|
-
interface CheckoutProcessMetadataInput extends CheckoutProcessAvsInput {
|
|
2363
|
-
/** The form's `chv` prop, forwarded as is. */
|
|
2364
|
-
chv?: string;
|
|
2365
|
-
/** Whether AVS was enabled (the form's `avsCheck` prop). Sent as `false` when not set. */
|
|
2366
|
-
avsCheck?: boolean;
|
|
2367
|
-
/** `standard_checkout` or `embedded_checkout`. */
|
|
2368
|
-
checkoutType?: string;
|
|
2369
|
-
/** `default_layout`, `buttons_layout` or `custom_layout`. */
|
|
2370
|
-
checkoutLayout?: string;
|
|
2371
|
-
}
|
|
2372
|
-
type ProcessAccountAddress = Pick<ProcessPaymentParams['accountData'], 'country' | 'zip' | 'city' | 'state' | 'addressLine1' | 'addressLine2'>;
|
|
2373
|
-
/**
|
|
2374
|
-
* The address part of `/process`'s `accountData`: nothing without AVS.
|
|
2375
|
-
* With AVS, the country and each field that is visible for that country and
|
|
2376
|
-
* filled. When line 1 is collected but the state is hidden, the state is
|
|
2377
|
-
* derived from the postcode (US/CA) so the provider's AVS still gets one.
|
|
2378
|
-
*/
|
|
2379
|
-
declare function buildProcessPaymentAvsAccount(input: CheckoutProcessAvsInput): ProcessAccountAddress;
|
|
2380
|
-
/**
|
|
2381
|
-
* Which AVS fields were actually shown for the buyer's country, for
|
|
2382
|
-
* analytics. Country-scoped rules (e.g. `['US', 'CA']`) are flattened to
|
|
2383
|
-
* booleans. `undefined` without AVS.
|
|
2384
|
-
*/
|
|
2385
|
-
declare function buildProcessPaymentAvsExposure(avsConfig: AVSFieldConfig | null | undefined, country: string): AVSFieldConfig | undefined;
|
|
2386
|
-
/**
|
|
2387
|
-
* The checkout analytics metadata on `/process`, in the order the released
|
|
2388
|
-
* form sends it: `chv`, `avsCheck` (`false` when not set), `checkoutType`,
|
|
2389
|
-
* `checkoutLayout` and the AVS exposure.
|
|
2390
|
-
*/
|
|
2391
|
-
declare function buildCheckoutProcessMetadata(input: CheckoutProcessMetadataInput): Pick<ProcessPaymentParams, 'chv' | 'avsCheck' | 'checkoutType' | 'checkoutLayout' | 'avsConfig'>;
|
|
2392
|
-
/** How the checkout is logged: React's `resolveCheckoutLogLayout`. */
|
|
2393
|
-
type CheckoutLogLayout = 'default_layout' | 'buttons_layout' | 'custom_layout';
|
|
2394
|
-
/**
|
|
2395
|
-
* The checkout layout a `FloPayCheckout` reports: `custom_layout` when the
|
|
2396
|
-
* merchant renders its own layout, else the built-in form's layout.
|
|
2397
|
-
*/
|
|
2398
|
-
declare function resolveCheckoutLogLayout(hasCustomLayout: boolean, layout: 'default' | 'buttons' | undefined): CheckoutLogLayout;
|
|
2399
|
-
|
|
2400
|
-
/** FloPay environment — determines which billing API URL is used. */
|
|
2401
|
-
type FloPayEnvironment = 'staging' | 'production' | 'local';
|
|
2402
|
-
/**
|
|
2403
|
-
* Configure the FloPay SDK globally. Call once at app startup.
|
|
2404
|
-
*
|
|
2405
|
-
* The environment determines which billing API URL is used for all
|
|
2406
|
-
* FloPay operations (session creation, payment processing, etc.).
|
|
2407
|
-
*
|
|
2408
|
-
* @example
|
|
2409
|
-
* ```ts
|
|
2410
|
-
* import { configureFlopay } from '@flopay/shared';
|
|
2411
|
-
*
|
|
2412
|
-
* // In production
|
|
2413
|
-
* configureFlopay({ environment: 'production' });
|
|
2414
|
-
*
|
|
2415
|
-
* // In staging/development
|
|
2416
|
-
* configureFlopay({ environment: 'staging' });
|
|
2417
|
-
* ```
|
|
2418
|
-
*
|
|
2419
|
-
* Alternatively, set the `NEXT_PUBLIC_FLOPAY_ENV` environment variable
|
|
2420
|
-
* to `'staging'` or `'production'` — the SDK reads it automatically.
|
|
2421
|
-
*/
|
|
2422
|
-
declare function configureFlopay(config: {
|
|
2423
|
-
environment: FloPayEnvironment;
|
|
2424
|
-
}): void;
|
|
2425
|
-
/** Get the billing API URL for the currently configured environment. */
|
|
2426
|
-
declare function getConfiguredBillingApiUrl(): string;
|
|
2427
|
-
/** Get the current configured environment. */
|
|
2428
|
-
declare function getFloPayEnvironment(): FloPayEnvironment;
|
|
2429
|
-
|
|
2430
|
-
/** Current SDK version. */
|
|
2431
|
-
declare const SDK_VERSION = "1.14.4";
|
|
2432
|
-
/**
|
|
2433
|
-
* HTTP header the SDK sends on checkout-session create/read requests so the
|
|
2434
|
-
* backend can observe compatibility. Version 1.4.9 is the first release that
|
|
2435
|
-
* can discover hosted card capture from an explicit Stripe `card` capability
|
|
2436
|
-
* and recover the widget lazily when `session.vault` is omitted. The backend
|
|
2437
|
-
* also uses this value to suppress the Flo-owned PayPal advertisement fields
|
|
2438
|
-
* (`gateways.paypal.providerObjectType` and the `paypal_vaulted` entry in
|
|
2439
|
-
* `enabledPaymentMethods`) for readers older than 1.6.0 — advertisement only,
|
|
2440
|
-
* never request routing.
|
|
2441
|
-
*
|
|
2442
|
-
* @see SDK_VERSION — the value sent in this header.
|
|
2443
|
-
*/
|
|
2444
|
-
declare const FLO_SDK_VERSION_HEADER = "x-flo-sdk-version";
|
|
2445
|
-
/** Generic SDK response-shape negotiation header; never a gateway selector. */
|
|
2446
|
-
declare const FLO_SDK_CAPABILITIES_HEADER = "x-flo-sdk-capabilities";
|
|
2447
|
-
/** Opts Auto session creation into the billing API's asynchronous `202` envelope. */
|
|
2448
|
-
declare const ASYNC_AUTO_CHECKOUT_CAPABILITY = "async-auto-checkout-v1";
|
|
2449
|
-
/** Shared buyer-interaction window for saved-card and hosted-vault 3DS challenges. */
|
|
2450
|
-
declare const THREE_DS_CHALLENGE_WINDOW_MS = 300000;
|
|
2451
|
-
/**
|
|
2452
|
-
* In-band payment-method CHANNEL for Flo-owned PayPal continuations.
|
|
2453
|
-
*
|
|
2454
|
-
* The payment-method type sent to `POST /v1/checkouts/sessions/{id}/intents`
|
|
2455
|
-
* is the channel selector: requesting `paypal_vaulted` opts a single request
|
|
2456
|
-
* into the Flo-owned channel (an Order for `intentKind: 'payment'`, a vault
|
|
2457
|
-
* setup token for `intentKind: 'setup'`), while the legacy `paypal` type keeps
|
|
2458
|
-
* the released provider-managed semantics byte-identical — even when the
|
|
2459
|
-
* backend feature flag is on. Sessions advertise availability via
|
|
2460
|
-
* `gateways.paypal.providerObjectType` and an informational `paypal_vaulted`
|
|
2461
|
-
* entry in `gateways.paypal.enabledPaymentMethods`; there is no capability
|
|
2462
|
-
* header and no version-gated routing.
|
|
2463
|
-
*/
|
|
2464
|
-
declare const PAYPAL_VAULTED_PAYMENT_METHOD_TYPE = "paypal_vaulted";
|
|
2465
|
-
/** Stable provider-neutral saved-method outcome published by the billing API. */
|
|
2466
|
-
declare const STORED_PAYMENT_METHOD_UNSUPPORTED_CODE = "stored_payment_method_unsupported";
|
|
2467
|
-
/** Buyer-safe recovery copy paired with {@link STORED_PAYMENT_METHOD_UNSUPPORTED_CODE}. */
|
|
2468
|
-
declare const STORED_PAYMENT_METHOD_UNSUPPORTED_MESSAGE = "This saved payment method can\u2019t be used for this payment. Choose another payment method.";
|
|
2469
|
-
/**
|
|
2470
|
-
* Buyer-facing copy for `checkout_processing_timeout`. The SDK could not confirm
|
|
2471
|
-
* the outcome in time and the payment may still complete, so the buyer must
|
|
2472
|
-
* never be invited to pay again (TeamFloPay/sdk#395).
|
|
2473
|
-
*/
|
|
2474
|
-
declare const CHECKOUT_PROCESSING_TIMEOUT_MESSAGE = "We\u2019re still confirming your payment. Please don\u2019t pay again.";
|
|
2475
|
-
/** Billing API URL for staging environment. */
|
|
2476
|
-
declare const BILLING_API_URL_STAGING = "https://api.stage.flopay.com";
|
|
2477
|
-
/** Billing API URL for production environment. */
|
|
2478
|
-
declare const BILLING_API_URL_PRODUCTION = "https://api.flopay.com";
|
|
2479
|
-
/**
|
|
2480
|
-
* Default FloPay API base URL (used by @flopay/node). Alias for staging.
|
|
2481
|
-
*
|
|
2482
|
-
* @alias
|
|
2483
|
-
*/
|
|
2484
|
-
declare const DEFAULT_API_BASE_URL = "https://api.stage.flopay.com";
|
|
2485
|
-
/**
|
|
2486
|
-
* Default billing API base URL. Alias for staging — prefer `resolveBillingApiUrl()`.
|
|
2487
|
-
*
|
|
2488
|
-
* @alias
|
|
2489
|
-
*/
|
|
2490
|
-
declare const BILLING_API_URL = "https://api.stage.flopay.com";
|
|
2491
|
-
/**
|
|
2492
|
-
* Resolve the billing API URL from available configuration.
|
|
2493
|
-
*
|
|
2494
|
-
* Priority:
|
|
2495
|
-
* 1. Explicit `billingApiUrl` (prop/param override)
|
|
2496
|
-
* 2. `NEXT_PUBLIC_FLOPAY_ENV` environment variable (`'staging'` | `'production'`)
|
|
2497
|
-
* 3. `configureFlopay()` global environment setting
|
|
2498
|
-
* 4. Fallback: staging URL
|
|
2499
|
-
*
|
|
2500
|
-
* @example
|
|
2501
|
-
* ```ts
|
|
2502
|
-
* import { resolveBillingApiUrl } from '@flopay/shared';
|
|
2503
|
-
*
|
|
2504
|
-
* // Reads from env var or configureFlopay() — no args needed
|
|
2505
|
-
* const url = resolveBillingApiUrl();
|
|
2506
|
-
*
|
|
2507
|
-
* // Explicit override takes priority
|
|
2508
|
-
* const url = resolveBillingApiUrl('https://custom.example.com');
|
|
2509
|
-
* ```
|
|
2510
|
-
*/
|
|
2511
|
-
declare function resolveBillingApiUrl(billingApiUrl?: string): string;
|
|
2512
|
-
/** Default API version header value. */
|
|
2513
|
-
declare const DEFAULT_API_VERSION = "2024-01-01";
|
|
2514
|
-
/** The default appearance applied when no custom appearance is provided. */
|
|
2515
|
-
declare const DEFAULT_APPEARANCE: FloPayAppearance;
|
|
2516
|
-
/** Flat theme — minimal borders and shadows. */
|
|
2517
|
-
declare const FLAT_APPEARANCE: FloPayAppearance;
|
|
2518
|
-
/** Night theme — dark background. */
|
|
2519
|
-
declare const NIGHT_APPEARANCE: FloPayAppearance;
|
|
2520
|
-
/** Modern light — clean & airy: Inter, soft shadows, generous spacing, 12px radius. */
|
|
2521
|
-
declare const MODERN_LIGHT_APPEARANCE: FloPayAppearance;
|
|
2522
|
-
/** Modern dark — clean & airy on a deep-blue surface, 12px radius. */
|
|
2523
|
-
declare const MODERN_DARK_APPEARANCE: FloPayAppearance;
|
|
2524
|
-
/** Bold light — vibrant: saturated primary, gradient submit, heavier weights. */
|
|
2525
|
-
declare const BOLD_LIGHT_APPEARANCE: FloPayAppearance;
|
|
2526
|
-
/** Bold dark — saturated deep-blue surface, gradient submit. */
|
|
2527
|
-
declare const BOLD_DARK_APPEARANCE: FloPayAppearance;
|
|
2528
|
-
/** Glass light — translucent surfaces with backdrop blur over a pastel blue gradient. */
|
|
2529
|
-
declare const GLASS_LIGHT_APPEARANCE: FloPayAppearance;
|
|
2530
|
-
/** Glass dark — translucent surfaces with backdrop blur over a deep-blue gradient. */
|
|
2531
|
-
declare const GLASS_DARK_APPEARANCE: FloPayAppearance;
|
|
2532
|
-
/** Default buttons layout — white card button, neutral borders. */
|
|
2533
|
-
declare const BUTTONS_LAYOUT_DEFAULT: ButtonsLayoutStyles;
|
|
2534
|
-
/** Minimal buttons layout — borderless, subtle hover. */
|
|
2535
|
-
declare const BUTTONS_LAYOUT_MINIMAL: ButtonsLayoutStyles;
|
|
2536
|
-
/** Rounded buttons layout — large border radius, soft shadows. */
|
|
2537
|
-
declare const BUTTONS_LAYOUT_ROUNDED: ButtonsLayoutStyles;
|
|
2538
|
-
/** Dark buttons layout — dark backgrounds, light text. */
|
|
2539
|
-
declare const BUTTONS_LAYOUT_DARK: ButtonsLayoutStyles;
|
|
2540
|
-
/** Modern light — soft surface, 14px radius, FloPay-blue submit with subtle shadow. */
|
|
2541
|
-
declare const BUTTONS_LAYOUT_MODERN_LIGHT: ButtonsLayoutStyles;
|
|
2542
|
-
/** Modern dark — deep surface, 14px radius, sky-blue submit. */
|
|
2543
|
-
declare const BUTTONS_LAYOUT_MODERN_DARK: ButtonsLayoutStyles;
|
|
2544
|
-
/** Bold light — blue-tint backdrop, primary-bordered card, gradient pill submit. */
|
|
2545
|
-
declare const BUTTONS_LAYOUT_BOLD_LIGHT: ButtonsLayoutStyles;
|
|
2546
|
-
/** Bold dark — saturated deep-blue surface, accented borders, gradient pill submit. */
|
|
2547
|
-
declare const BUTTONS_LAYOUT_BOLD_DARK: ButtonsLayoutStyles;
|
|
2548
|
-
/** Glass light — translucent surfaces with backdrop blur over a pastel blue gradient. */
|
|
2549
|
-
declare const BUTTONS_LAYOUT_GLASS_LIGHT: ButtonsLayoutStyles;
|
|
2550
|
-
/** Glass dark — translucent surfaces with backdrop blur over a deep-blue gradient. */
|
|
2551
|
-
declare const BUTTONS_LAYOUT_GLASS_DARK: ButtonsLayoutStyles;
|
|
2552
|
-
/** Resolve a buttons layout theme name to its style preset. */
|
|
2553
|
-
declare function resolveButtonsLayoutTheme(theme?: ButtonsLayoutTheme): ButtonsLayoutStyles;
|
|
2554
|
-
/**
|
|
2555
|
-
* First-class theme bundles. Each entry pairs a `FloPayAppearance` (for Stripe
|
|
2556
|
-
* Elements) with a `ButtonsLayoutStyles` (for the FloPay wrapper) so the look
|
|
2557
|
-
* is coherent across both halves. Consumers can pick by id without having to
|
|
2558
|
-
* import the two halves separately.
|
|
2559
|
-
*
|
|
2560
|
-
* @example
|
|
2561
|
-
* ```tsx
|
|
2562
|
-
* import { THEMES } from '@flopay/shared';
|
|
2563
|
-
*
|
|
2564
|
-
* const { appearance, buttonsLayout } = THEMES['glass-dark'];
|
|
2565
|
-
* <FloPayCheckout appearance={appearance} buttonsLayoutStyles={buttonsLayout} />
|
|
2566
|
-
* ```
|
|
2567
|
-
*/
|
|
2568
|
-
declare const THEMES: Record<ThemeBundleId, ThemeBundle>;
|
|
2569
|
-
/**
|
|
2570
|
-
* Resolve a {@link ThemeId} to its {@link ThemeBundle}, or `undefined` for
|
|
2571
|
-
* `'classic'` / a missing id (the historic FloPay look with no bundle applied).
|
|
2572
|
-
*
|
|
2573
|
-
* Used by FloPay React components when consumers pass the high-level `theme`
|
|
2574
|
-
* prop instead of supplying `appearance` + `buttonsStyles` manually. Explicit
|
|
2575
|
-
* `appearance` / `buttonsStyles` props still override the resolved bundle.
|
|
2576
|
-
*/
|
|
2577
|
-
declare function resolveTheme(id?: ThemeId | null): ThemeBundle | undefined;
|
|
2578
|
-
/**
|
|
2579
|
-
* Map Stripe wire identifiers (`apple_pay`, `google_pay`, `amazon_pay`) to the
|
|
2580
|
-
* camelCase keys that `ExpressCheckoutElement`'s `paymentMethods` options
|
|
2581
|
-
* map expects. Everything not in this map is already camelCase compatible.
|
|
2582
|
-
*/
|
|
2583
|
-
declare function stripeExpressMethodToOptionKey(method: string): string;
|
|
2584
|
-
/**
|
|
2585
|
-
* Per-method metadata for every Stripe payment-method type the SDK
|
|
2586
|
-
* recognises. One source of truth instead of half a dozen disjoint maps —
|
|
2587
|
-
* `STRIPE_METHOD_CURRENCIES`, `STRIPE_METHOD_AMOUNT_LIMITS`, the React
|
|
2588
|
-
* package's display-name table, and the inline-form heuristic all derive
|
|
2589
|
-
* from entries here.
|
|
2590
|
-
*
|
|
2591
|
-
* Source: Stripe payment-method support matrices at
|
|
2592
|
-
* <https://docs.stripe.com/payments/payment-methods/integration-options>.
|
|
2593
|
-
* Update entries when Stripe ships a new currency / amount limit / method
|
|
2594
|
-
* — the SDK falls back to safe defaults for any wire identifier not listed.
|
|
2595
|
-
*/
|
|
2596
|
-
interface StripeMethodEntry {
|
|
2597
|
-
/**
|
|
2598
|
-
* Human-readable label, used by consumers for "Pay with X" buttons and
|
|
2599
|
-
* other UI surfaces that need the brand name.
|
|
2600
|
-
*/
|
|
2601
|
-
displayName: string;
|
|
2602
|
-
/**
|
|
2603
|
-
* Lowercase ISO-4217 currency codes Stripe accepts for this method. The
|
|
2604
|
-
* sentinel `'*'` means "currency-agnostic" — only the universal big-button
|
|
2605
|
-
* wallets (Apple Pay / Google Pay) use this today.
|
|
2606
|
-
*/
|
|
2607
|
-
currencies: readonly string[];
|
|
2608
|
-
/**
|
|
2609
|
-
* Uppercase ISO 3166-1 alpha-2 codes for the buyer countries Stripe makes
|
|
2610
|
-
* this method available to (matched against the session customer's
|
|
2611
|
-
* country). Many local APMs are country-gated independently of currency —
|
|
2612
|
-
* Bancontact is Belgium-only, EPS Austria-only, iDEAL Netherlands-only,
|
|
2613
|
-
* SEPA Debit the whole SEPA zone — so a EUR cart still must not offer
|
|
2614
|
-
* Bancontact to a Dutch buyer.
|
|
2615
|
-
*
|
|
2616
|
-
* **Omit** for methods with no meaningful country restriction (the global
|
|
2617
|
-
* wallets, Alipay, Klarna, …) — a missing list means "no country gate", so
|
|
2618
|
-
* the method passes {@link filterStripeMethodsByCountry} for every buyer.
|
|
2619
|
-
*/
|
|
2620
|
-
countries?: readonly string[];
|
|
2621
|
-
/**
|
|
2622
|
-
* Per-currency amount min/max in the smallest currency unit (cents for USD,
|
|
2623
|
-
* pence for GBP, etc.). Omit when there is no notable limit. Stripe's
|
|
2624
|
-
* `/v1/elements/sessions` rejects the whole accordion when an entry is in
|
|
2625
|
-
* `paymentMethodTypes` and the deferred-intent amount falls outside its
|
|
2626
|
-
* advertised range, so filtering here matches Stripe's reality.
|
|
2627
|
-
*/
|
|
2628
|
-
amounts?: Record<string, {
|
|
2629
|
-
min?: number;
|
|
2630
|
-
max?: number;
|
|
2631
|
-
}>;
|
|
2632
|
-
/**
|
|
2633
|
-
* True when this method renders inside Stripe's `ExpressCheckoutElement`
|
|
2634
|
-
* (apple_pay, google_pay, paypal, link, amazon_pay, klarna). Everything
|
|
2635
|
-
* else lives in the `PaymentElement` accordion.
|
|
2636
|
-
*/
|
|
2637
|
-
express?: boolean;
|
|
2638
|
-
/**
|
|
2639
|
-
* When `false`, the SDK auto-submits the moment the buyer clicks the
|
|
2640
|
-
* method card — the buyer is taken straight to Stripe's authorization UI
|
|
2641
|
-
* (popup / redirect) without an intermediate confirm step. Only set this
|
|
2642
|
-
* for *pure* redirect-only methods that have no inline data collection
|
|
2643
|
-
* (Cash App, Affirm).
|
|
2644
|
-
*
|
|
2645
|
-
* **Default `true`**: render an explicit "Pay with X" button at the
|
|
2646
|
-
* bottom of the accordion. Safer-by-default — any new/unknown APM, or
|
|
2647
|
-
* any method whose Stripe UI changes to add inline inputs, will surface
|
|
2648
|
-
* a deliberate confirm action instead of silently auto-submitting on a
|
|
2649
|
-
* stray keystroke. Bancontact / Giropay are theoretically redirect-only
|
|
2650
|
-
* but ship with a Name input by default, so they stay on the default
|
|
2651
|
-
* (button) path.
|
|
2652
|
-
*/
|
|
2653
|
-
needsExplicitConfirm?: boolean;
|
|
2654
|
-
/**
|
|
2655
|
-
* Per-mode brand styling for the method tile button. The SDK looks up
|
|
2656
|
-
* `theme.dark` when the active FloPay theme is one of the `*-dark`
|
|
2657
|
-
* bundles, otherwise `theme.light` (also used for `classic`, since
|
|
2658
|
-
* brand assets are designed primarily against light surfaces).
|
|
2659
|
-
*
|
|
2660
|
-
* Entries are optional — methods without a `theme` fall back to the
|
|
2661
|
-
* neutral tile styling derived from the theme's `buttonsStyles.cardButton`
|
|
2662
|
-
* + `derivePrimaryTileStyle`. Consumers can override per-tile via
|
|
2663
|
-
* `buttonAppearance` on the inner component.
|
|
2664
|
-
*/
|
|
2665
|
-
theme?: {
|
|
2666
|
-
light?: StripeMethodThemeVariant;
|
|
2667
|
-
dark?: StripeMethodThemeVariant;
|
|
2668
|
-
};
|
|
2669
|
-
}
|
|
2670
|
-
/**
|
|
2671
|
-
* Per-mode visual treatment for a Stripe method tile button. Applies brand
|
|
2672
|
-
* colors and (optionally) an inline mark so each APM tile reads
|
|
2673
|
-
* unmistakably as itself.
|
|
2674
|
-
*
|
|
2675
|
-
* `logoSvg` is an inline SVG string rendered at ~22px tall inside the
|
|
2676
|
-
* button before the label. The SDK ships a small generic placeholder mark
|
|
2677
|
-
* per method (a colored disc + initial) authored as original geometry —
|
|
2678
|
-
* **not** a reproduction of any official trademarked logo. Consumers who
|
|
2679
|
-
* have rights to a brand's artwork can replace these per-entry by
|
|
2680
|
-
* overriding the matrix in their own deployment.
|
|
2681
|
-
*/
|
|
2682
|
-
interface StripeMethodThemeVariant {
|
|
2683
|
-
backgroundColor?: string;
|
|
2684
|
-
borderColor?: string;
|
|
2685
|
-
textColor?: string;
|
|
2686
|
-
/**
|
|
2687
|
-
* Inline SVG markup, e.g. `'<svg viewBox="0 0 24 24">…</svg>'`. Trusted
|
|
2688
|
-
* by the renderer (mounted via `dangerouslySetInnerHTML`) — only edit
|
|
2689
|
-
* via this matrix or a controlled override; never wire user input here.
|
|
2690
|
-
*/
|
|
2691
|
-
logoSvg?: string;
|
|
2692
|
-
}
|
|
2693
|
-
declare const STRIPE_METHOD_MATRIX: Record<string, StripeMethodEntry>;
|
|
2694
|
-
/**
|
|
2695
|
-
* Whether a method's `logoSvg` is a vendored real brand logo (from
|
|
2696
|
-
* `fetch:logos`) rather than the SDK's generated placeholder mark. Tile
|
|
2697
|
-
* buttons use this to size the gap between logo and label: the real logos
|
|
2698
|
-
* are self-contained cards that read as a separate mark (8px gap), whereas
|
|
2699
|
-
* the generated placeholder monogram reads as part of the label (0px gap).
|
|
2700
|
-
*/
|
|
2701
|
-
declare function hasVendoredStripeMethodLogo(type: string | null | undefined): boolean;
|
|
2702
|
-
/**
|
|
2703
|
-
* Stripe payment method types that render as native big buttons in the
|
|
2704
|
-
* `ExpressCheckoutElement`. Everything else falls into the `PaymentElement`
|
|
2705
|
-
* accordion. Derived from {@link STRIPE_METHOD_MATRIX} entries flagged
|
|
2706
|
-
* `express: true` — insertion order in the matrix dictates the wallet-row
|
|
2707
|
-
* ordering (apple_pay → google_pay → paypal → link → amazon_pay → klarna).
|
|
2708
|
-
*/
|
|
2709
|
-
declare const STRIPE_EXPRESS_METHODS: readonly string[];
|
|
2710
|
-
/**
|
|
2711
|
-
* Stripe payment-method → supported-currencies map. Derived from
|
|
2712
|
-
* {@link STRIPE_METHOD_MATRIX} — kept as a separate export for callers that
|
|
2713
|
-
* just want the currency list without the rest of the entry.
|
|
2714
|
-
*
|
|
2715
|
-
* Stripe rejects the entire `PaymentElement` mount with an `IntegrationError`
|
|
2716
|
-
* when `paymentMethodTypes` contains a method that doesn't support the session
|
|
2717
|
-
* currency (e.g. `bancontact` on a USD session). The SDK drops those methods
|
|
2718
|
-
* before forwarding them to Stripe so a single mis-matched method doesn't
|
|
2719
|
-
* blank out the whole accordion.
|
|
2720
|
-
*
|
|
2721
|
-
* Unknown methods (anything not in the matrix) pass through unchanged so a
|
|
2722
|
-
* brand-new Stripe APM keeps working until the matrix is refreshed.
|
|
2723
|
-
*/
|
|
2724
|
-
declare const STRIPE_METHOD_CURRENCIES: Record<string, readonly string[]>;
|
|
2725
|
-
/**
|
|
2726
|
-
* Stripe payment-method → supported-buyer-countries map (uppercase ISO
|
|
2727
|
-
* 3166-1 alpha-2). Derived from {@link STRIPE_METHOD_MATRIX}; only methods
|
|
2728
|
-
* that declared a `countries` list appear here. Methods absent from this map
|
|
2729
|
-
* have no country gate and are offered to every buyer (subject to the
|
|
2730
|
-
* currency / amount filters).
|
|
2731
|
-
*
|
|
2732
|
-
* Local APMs like Bancontact (BE), EPS (AT) and iDEAL (NL) are available
|
|
2733
|
-
* only to buyers in their home country even on a EUR cart, so the SDK drops
|
|
2734
|
-
* them when the session customer's country doesn't match — mirroring what
|
|
2735
|
-
* Stripe's `PaymentElement` would do from the buyer's locale anyway.
|
|
2736
|
-
*/
|
|
2737
|
-
declare const STRIPE_METHOD_COUNTRIES: Record<string, readonly string[]>;
|
|
2738
|
-
/**
|
|
2739
|
-
* Display-name lookup. Falls back to a title-cased version of the wire id
|
|
2740
|
-
* (e.g. `au_becs_debit` → `Au Becs Debit`) for methods not in the matrix so
|
|
2741
|
-
* a brand-new APM still produces a legible label until the matrix catches up.
|
|
2742
|
-
*/
|
|
2743
|
-
declare function getStripeMethodDisplayName(type: string | null | undefined): string;
|
|
2744
|
-
/**
|
|
2745
|
-
* Whether the SDK should render an explicit "Pay with X" button for this
|
|
2746
|
-
* method rather than auto-submitting on click. Defaults to `true` (safer for
|
|
2747
|
-
* unknown methods) — only methods explicitly flagged `needsExplicitConfirm:
|
|
2748
|
-
* false` in the matrix (Cash App, Affirm) auto-submit.
|
|
2749
|
-
*/
|
|
2750
|
-
declare function needsStripeMethodExplicitConfirm(type: string | null | undefined): boolean;
|
|
2751
|
-
/**
|
|
2752
|
-
* Resolve the per-mode brand styling for a method tile button, given the
|
|
2753
|
-
* active FloPay theme id. Returns `null` when the method has no `theme`
|
|
2754
|
-
* entry in the matrix — callers fall back to the neutral tile styling
|
|
2755
|
-
* derived from `buttonsStyles.cardButton`.
|
|
2756
|
-
*
|
|
2757
|
-
* Theme-id → variant rule:
|
|
2758
|
-
* - `*-dark` themes get `theme.dark` (then `theme.light` as fallback).
|
|
2759
|
-
* - Everything else (`classic`, `*-light`, undefined) gets `theme.light`.
|
|
2760
|
-
*/
|
|
2761
|
-
declare function resolveStripeMethodBrandVariant(type: string | null | undefined, themeId: ThemeId | null | undefined): StripeMethodThemeVariant | null;
|
|
2762
|
-
/**
|
|
2763
|
-
* Filter a Stripe payment-method wire-identifier list down to those that
|
|
2764
|
-
* support the supplied ISO-4217 currency code. Unknown methods (anything not
|
|
2765
|
-
* in {@link STRIPE_METHOD_CURRENCIES}) pass through unchanged so a brand-new
|
|
2766
|
-
* Stripe APM keeps working until the SDK ships an updated map.
|
|
2767
|
-
*
|
|
2768
|
-
* The currency comparison is case-insensitive (`USD` and `usd` both match).
|
|
2769
|
-
* An empty / missing currency disables filtering entirely (returns the input
|
|
2770
|
-
* list as-is) — callers that don't know the currency are still better off
|
|
2771
|
-
* letting Stripe fail loudly than dropping everything to silence.
|
|
2772
|
-
*/
|
|
2773
|
-
declare function filterStripeMethodsByCurrency(methods: readonly string[] | undefined, currency: string | undefined): string[];
|
|
2774
|
-
/**
|
|
2775
|
-
* Filter a Stripe payment-method wire-identifier list down to those available
|
|
2776
|
-
* to the supplied buyer country (ISO 3166-1 alpha-2). Methods with no country
|
|
2777
|
-
* gate in {@link STRIPE_METHOD_COUNTRIES} — the global wallets, Alipay,
|
|
2778
|
-
* Klarna, unknown methods — pass through unchanged.
|
|
2779
|
-
*
|
|
2780
|
-
* The country comparison is case-insensitive (`be` and `BE` both match). An
|
|
2781
|
-
* empty / missing country disables filtering entirely (returns the input list
|
|
2782
|
-
* as-is) — when the session doesn't know the buyer's country we'd rather let
|
|
2783
|
-
* Stripe make the final call than drop every country-gated method.
|
|
2784
|
-
*/
|
|
2785
|
-
declare function filterStripeMethodsByCountry(methods: readonly string[] | undefined, country: string | undefined): string[];
|
|
2786
|
-
/**
|
|
2787
|
-
* Per-method amount limits (in the smallest currency unit, e.g. cents for USD)
|
|
2788
|
-
* keyed by Stripe wire identifier and then currency code. Derived from
|
|
2789
|
-
* {@link STRIPE_METHOD_MATRIX} — kept as a separate export for callers that
|
|
2790
|
-
* just want the amount limits without the rest of the entry.
|
|
2791
|
-
*
|
|
2792
|
-
* Stripe's `/v1/elements/sessions` endpoint hard-400's when
|
|
2793
|
-
* `paymentMethodTypes` contains a method whose per-currency minimum or
|
|
2794
|
-
* maximum is violated by the deferred-intent amount — and a single rejected
|
|
2795
|
-
* method blanks out the entire `PaymentElement` accordion ("Frame not
|
|
2796
|
-
* initialized" / empty `<div class="">` shell). Filtering here matches
|
|
2797
|
-
* Stripe's reality so an incompatible amount silently drops the offending
|
|
2798
|
-
* method instead of poisoning the whole mount.
|
|
2799
|
-
*/
|
|
2800
|
-
declare const STRIPE_METHOD_AMOUNT_LIMITS: Record<string, Record<string, {
|
|
2801
|
-
min?: number;
|
|
2802
|
-
max?: number;
|
|
2803
|
-
}>>;
|
|
2804
|
-
/**
|
|
2805
|
-
* Filter a Stripe payment-method wire-identifier list down to those whose
|
|
2806
|
-
* per-currency amount range accepts {@link amountInMinorUnits}. Unknown methods
|
|
2807
|
-
* (anything not in {@link STRIPE_METHOD_AMOUNT_LIMITS}) pass through unchanged
|
|
2808
|
-
* so a brand-new Stripe APM keeps working without an SDK update.
|
|
2809
|
-
*
|
|
2810
|
-
* Currency comparison is case-insensitive. Missing currency / amount disables
|
|
2811
|
-
* filtering — callers that don't know the cart yet should pass through the
|
|
2812
|
-
* full list rather than silently dropping everything.
|
|
2813
|
-
*/
|
|
2814
|
-
declare function filterStripeMethodsByAmount(methods: readonly string[] | undefined, currency: string | undefined, amountInMinorUnits: number | undefined): string[];
|
|
2815
|
-
/**
|
|
2816
|
-
* Partition the backend's `enabledPaymentMethods` list into the two SDK
|
|
2817
|
-
* regions inside `SplitCardForm`:
|
|
2818
|
-
*
|
|
2819
|
-
* - `expressMethods` — intersected with {@link STRIPE_EXPRESS_METHODS} so
|
|
2820
|
-
* only `ExpressCheckoutElement`-supported methods land in the big-button
|
|
2821
|
-
* row.
|
|
2822
|
-
* - `paymentElementMethods` — every remaining method (Cash App Pay, Affirm,
|
|
2823
|
-
* iDEAL, Bancontact, SEPA debit, …) for the `PaymentElement` accordion.
|
|
2824
|
-
*
|
|
2825
|
-
* `card` is dropped from both lists — the card path stays on the split
|
|
2826
|
-
* fields. When `options.excludePaypal` is `true`, the SDK is rendering
|
|
2827
|
-
* `DirectPayPalButton` separately and PayPal is also pulled out of the
|
|
2828
|
-
* express list to avoid double-rendering.
|
|
2829
|
-
*/
|
|
2830
|
-
declare function partitionStripeMethods(enabledPaymentMethods: readonly string[] | undefined, options?: {
|
|
2831
|
-
excludePaypal?: boolean;
|
|
2832
|
-
}): {
|
|
2833
|
-
expressMethods: string[];
|
|
2834
|
-
paymentElementMethods: string[];
|
|
2835
|
-
};
|
|
2836
|
-
declare const SUPPORTED_CARD_BRANDS: readonly ["visa", "mastercard", "mastercard_debit", "amex", "discover"];
|
|
2837
|
-
/** Country code to currency information mapping. */
|
|
2838
|
-
declare const CURRENCY_MAP: Record<string, CurrencyInfo>;
|
|
2839
|
-
/** Default currency info when country is unknown. */
|
|
2840
|
-
declare const DEFAULT_CURRENCY: CurrencyInfo;
|
|
2841
|
-
/** Returns the correct postal code label for a country code (ISO 3166-1 alpha-2). */
|
|
2842
|
-
declare function getPostalCodeLabel(countryCode: string): string;
|
|
2843
|
-
/** All countries for dropdown select, priority countries first. */
|
|
2844
|
-
declare const COUNTRY_OPTIONS: CountryOption[];
|
|
2845
|
-
/** Look up a country option by ISO 3166-1 alpha-2 code. */
|
|
2846
|
-
declare function getCountryByCode(code: string): CountryOption | undefined;
|
|
2847
|
-
/**
|
|
2848
|
-
* Normalize `enableAVS` to a resolved config object.
|
|
2849
|
-
* - `false` / `undefined` → `null` (AVS disabled)
|
|
2850
|
-
* - `true` → default config (country + postal_code)
|
|
2851
|
-
* - `AVSFieldConfig` → returned as-is
|
|
2852
|
-
*/
|
|
2853
|
-
declare function resolveAVSConfig(enableAVS?: boolean | AVSFieldConfig): AVSFieldConfig | null;
|
|
2854
|
-
/**
|
|
2855
|
-
* Check if an AVS field should be visible for the given country.
|
|
2856
|
-
* - `undefined` / `false` → hidden
|
|
2857
|
-
* - `true` → visible for all countries
|
|
2858
|
-
* - `string[]` (non-empty) → visible only for listed country codes
|
|
2859
|
-
* - `[]` (empty) → visible for no countries; use `true` to show everywhere.
|
|
2860
|
-
* A UI that wants "clear the country list = show everywhere" must normalize
|
|
2861
|
-
* the cleared list to `true` before persisting — preserves the historical
|
|
2862
|
-
* `[]` = "off" semantics so existing configs don't start rendering AVS
|
|
2863
|
-
* globally.
|
|
2864
|
-
*/
|
|
2865
|
-
declare function isAVSFieldVisible(field: boolean | string[] | undefined, country: string): boolean;
|
|
2866
|
-
/** Returns true if any AVS field is meaningfully configured (at least one field is truthy). */
|
|
2867
|
-
declare function isAVSEnabled(enableAVS?: boolean | AVSFieldConfig): boolean;
|
|
2868
|
-
interface StateOption {
|
|
2869
|
-
code: string;
|
|
2870
|
-
name: string;
|
|
2871
|
-
}
|
|
2872
|
-
declare const US_STATES: StateOption[];
|
|
2873
|
-
declare const CA_PROVINCES: StateOption[];
|
|
2874
|
-
/**
|
|
2875
|
-
* Get state/province options for a country.
|
|
2876
|
-
* Returns a list for US and CA, or `null` for countries where a free-text input is appropriate.
|
|
2877
|
-
*/
|
|
2878
|
-
declare function getStateOptions(country: string): StateOption[] | null;
|
|
2879
|
-
/** Returns the appropriate label for the state/province field based on country. */
|
|
2880
|
-
declare function getStateLabel(countryCode: string): string;
|
|
2881
|
-
|
|
2882
|
-
/** A single line item formatted for display in the checkout UI. */
|
|
2883
|
-
interface DisplayLineItem {
|
|
2884
|
-
name: string;
|
|
2885
|
-
quantity: number;
|
|
2886
|
-
/** Price per unit in the session's currency (major units, e.g. 24.95). */
|
|
2887
|
-
price: number;
|
|
2888
|
-
/** Original price per unit before any discount (major units). */
|
|
2889
|
-
originalPrice: number;
|
|
2890
|
-
}
|
|
2891
|
-
/** Computed display data for rendering an order summary. */
|
|
2892
|
-
interface CheckoutDisplayData {
|
|
2893
|
-
/** Individual items/subscriptions with names, prices, and quantities. */
|
|
2894
|
-
items: DisplayLineItem[];
|
|
2895
|
-
/** ISO 4217 currency code (uppercase). */
|
|
2896
|
-
currency: string;
|
|
2897
|
-
/** Total amount due after discounts (major units, e.g. 24.95). */
|
|
2898
|
-
total: number;
|
|
2899
|
-
/** Sum of original prices before discounts (major units). */
|
|
2900
|
-
originalTotal: number;
|
|
2901
|
-
/** Total savings (originalTotal - total), clamped to >= 0. */
|
|
2902
|
-
totalSave: number;
|
|
2903
|
-
/** Discount percentage (0–100). */
|
|
2904
|
-
discountPercent: number;
|
|
2905
|
-
/**
|
|
2906
|
-
* Coupon discount reported by the backend (cart-currency major units),
|
|
2907
|
-
* when available. Populated from `session.discountAmount` (billing
|
|
2908
|
-
* API ≥ v1.1.2); `undefined` on older backends. Use this to render an
|
|
2909
|
-
* explicit "coupon" line without recomputing per-item math.
|
|
2910
|
-
*/
|
|
2911
|
-
couponDiscount?: number;
|
|
2912
|
-
}
|
|
2913
|
-
/** Options for {@link buildCheckoutDisplayData}. */
|
|
2914
|
-
interface BuildCheckoutDisplayDataOptions {
|
|
2915
|
-
/**
|
|
2916
|
-
* When `true`, items are hidden from the order summary if the session also
|
|
2917
|
-
* contains subscriptions (matches the legacy checkout/CheckoutModal
|
|
2918
|
-
* behavior). Defaults to `false` — items are always shown.
|
|
2919
|
-
*/
|
|
2920
|
-
hideBundledItems?: boolean;
|
|
2921
|
-
}
|
|
2922
|
-
/**
|
|
2923
|
-
* Builds display data from a `CheckoutSession` for rendering an order summary.
|
|
2924
|
-
*
|
|
2925
|
-
* - Subscriptions are always shown
|
|
2926
|
-
* - Items are shown by default; pass `{ hideBundledItems: true }` to suppress
|
|
2927
|
-
* them when the session also contains subscriptions (legacy behavior)
|
|
2928
|
-
* - `overrideAmount` (when not null/undefined) is the discounted price
|
|
2929
|
-
* - Plan name "4-WEEK PLAN" with price <= 1 is renamed to "7-DAY TRIAL: FULL ACCESS"
|
|
2930
|
-
* - Discount percentage and savings are computed from the difference
|
|
2931
|
-
*
|
|
2932
|
-
* All amounts are in **major currency units** (dollars, not cents).
|
|
2933
|
-
*
|
|
2934
|
-
* @example
|
|
2935
|
-
* ```ts
|
|
2936
|
-
* import { buildCheckoutDisplayData } from '@flopay/shared';
|
|
2937
|
-
*
|
|
2938
|
-
* const display = buildCheckoutDisplayData(session);
|
|
2939
|
-
* // display.items → [{ name: 'Starter', price: 24.95, originalPrice: 24.95, quantity: 1 }]
|
|
2940
|
-
* // display.total → 24.95
|
|
2941
|
-
* // display.currency → 'EUR'
|
|
2942
|
-
* ```
|
|
2943
|
-
*/
|
|
2944
|
-
declare function buildCheckoutDisplayData(session: CheckoutSession, options?: BuildCheckoutDisplayDataOptions): CheckoutDisplayData;
|
|
2945
|
-
|
|
2946
|
-
/** Return true only for a non-blank email accepted by the backend validator. */
|
|
2947
|
-
declare function isValidEmail(email: string | null | undefined): email is string;
|
|
2948
|
-
|
|
2949
|
-
declare const EXTERNAL_METHOD_CALLBACK_GRACE_MS = 600;
|
|
2950
|
-
interface ExternalMethodFailureContext {
|
|
2951
|
-
inAppBrowser: boolean;
|
|
2952
|
-
handoffObserved: boolean;
|
|
2953
|
-
/** May corroborate a recognized signal, but never determines classification. */
|
|
2954
|
-
elapsedMs?: number;
|
|
2955
|
-
}
|
|
2956
|
-
interface ExternalMethodFailureClassification {
|
|
2957
|
-
errorCode: 'POPUP_BLOCKED' | 'PROVIDER_RUNTIME_FAILED';
|
|
2958
|
-
popupBlocked: boolean;
|
|
2959
|
-
providerDeclined: boolean;
|
|
2960
|
-
terminalReason: TelemetryTerminalReason;
|
|
2961
|
-
}
|
|
2962
|
-
/** One buyer-copy contract shared by wallets and both PayPal integrations. */
|
|
2963
|
-
declare function buildExternalMethodRecoveryMessage(displayName: string, popupBlocked: boolean, inAppBrowser: boolean): string;
|
|
2964
|
-
declare function sanitizeExternalFailureCode(value: unknown): string | undefined;
|
|
2965
|
-
declare function getProviderErrorCode(err: unknown): string | undefined;
|
|
2966
|
-
declare function getProviderDeclineCode(err: unknown): string | undefined;
|
|
2967
|
-
declare function isProviderDecline(err: unknown): boolean;
|
|
2968
|
-
declare function isPayPalAcknowledgementDeadWindow(err: unknown): boolean;
|
|
2969
|
-
/** Classifies only bounded, positive evidence; time by itself is never evidence. */
|
|
2970
|
-
declare function classifyExternalMethodFailure(err: unknown, context: ExternalMethodFailureContext): ExternalMethodFailureClassification;
|
|
2971
|
-
declare function isPopupBlockedError(err: unknown): boolean;
|
|
2972
|
-
|
|
2973
|
-
/**
|
|
2974
|
-
* The buyer-facing copy for a raw failure message: a known backend message is
|
|
2975
|
-
* replaced, anything else is returned unchanged (`undefined` for a non-string).
|
|
2976
|
-
*/
|
|
2977
|
-
declare function applyFriendlyMessageOverride(message: string | undefined | null): string | undefined;
|
|
2978
|
-
|
|
2979
|
-
/**
|
|
2980
|
-
* The Stripe Elements group asking for a usage. It only selects which of
|
|
2981
|
-
* today's values a legacy read (one without `futureUse`) keeps.
|
|
2982
|
-
*/
|
|
2983
|
-
type FutureUseSurface = 'wallet' | 'paypal' | 'inline_apm' | 'setup';
|
|
2984
|
-
/** The session fields the platform future-use policy is read from. */
|
|
2985
|
-
type FutureUseSessionFields = Pick<CheckoutSession, 'futureUse' | 'futureUseUnsupported'>;
|
|
2986
|
-
/**
|
|
2987
|
-
* The one place every Stripe Elements group gets its `setupFutureUsage`.
|
|
2988
|
-
*
|
|
2989
|
-
* Future use is platform policy, decided by the billing API. When the session
|
|
2990
|
-
* read carries `futureUse`, the group declares exactly that value, unless one
|
|
2991
|
-
* of the methods it collects is listed in `futureUseUnsupported`, in which
|
|
2992
|
-
* case it declares none (the method stays payable one-off). The SDK never
|
|
2993
|
-
* coerces or defaults the read's value.
|
|
2994
|
-
*
|
|
2995
|
-
* A legacy read (no known `futureUse`) keeps each group's historic value:
|
|
2996
|
-
* wallets and PayPal `off_session`, inline APMs their historic list, and the
|
|
2997
|
-
* setup surface nothing.
|
|
2998
|
-
*
|
|
2999
|
-
* @returns the usage to declare, or `undefined` to declare none.
|
|
3000
|
-
*/
|
|
3001
|
-
declare function resolveSetupFutureUsage(session: FutureUseSessionFields | null | undefined, methods: string | readonly string[], surface: FutureUseSurface): CardSetupFutureUse | undefined;
|
|
3002
|
-
|
|
3003
|
-
/**
|
|
3004
|
-
* HTTP header the SDK sends to make checkout-session creation idempotent
|
|
3005
|
-
* (TeamFloPay/backend#972, paired SDK issue TeamFloPay/sdk#133).
|
|
3006
|
-
*
|
|
3007
|
-
* The backend treats the header as **optional**: when it is absent the legacy,
|
|
3008
|
-
* non-idempotent creation path runs unchanged. When present, every transport
|
|
3009
|
-
* retry of the same logical create reuses the same key so a timeout or lost
|
|
3010
|
-
* response cannot mint a second checkout session.
|
|
3011
|
-
*/
|
|
3012
|
-
declare const IDEMPOTENCY_KEY_HEADER = "Idempotency-Key";
|
|
3013
|
-
/**
|
|
3014
|
-
* Maximum length of an idempotency key accepted by the billing API
|
|
3015
|
-
* (TeamFloPay/backend#972). Mirrors the widely-used 255-character ceiling;
|
|
3016
|
-
* automatically generated keys stay well under it.
|
|
3017
|
-
*/
|
|
3018
|
-
declare const MAX_IDEMPOTENCY_KEY_LENGTH = 255;
|
|
3019
|
-
/**
|
|
3020
|
-
* Backend `code` (TeamFloPay/backend#972) returned when a checkout-create
|
|
3021
|
-
* replay arrives while the first request carrying the same key is still being
|
|
3022
|
-
* processed. It is a **retryable** in-progress response: the caller should
|
|
3023
|
-
* retry with the *same* key after a short backoff, never with a new key. This
|
|
3024
|
-
* is distinct from a payload-conflict (`409`), which is non-retryable.
|
|
3025
|
-
*
|
|
3026
|
-
* Mirrors a backend-defined code the same way the coupon error codes
|
|
3027
|
-
* (`CouponLimitExceeded`, `CouponCurrencyUnsupported`) mirror billing v1.1.2.
|
|
3028
|
-
*/
|
|
3029
|
-
declare const IDEMPOTENCY_IN_PROGRESS_CODE = "IdempotencyKeyInProgress";
|
|
3030
|
-
/**
|
|
3031
|
-
* Generate a cryptographically random, high-entropy idempotency key.
|
|
3032
|
-
*
|
|
3033
|
-
* Prefers `crypto.randomUUID()` and falls back to 16 random bytes from
|
|
3034
|
-
* `crypto.getRandomValues`. Returns `undefined` when no cryptographically
|
|
3035
|
-
* secure RNG is available so the caller falls back to the legacy unkeyed path
|
|
3036
|
-
* rather than emitting a weak or predictable key.
|
|
3037
|
-
*
|
|
3038
|
-
* The key is never derived from request data, customer identity, or time, so
|
|
3039
|
-
* two independent operations never collide by construction.
|
|
3040
|
-
*/
|
|
3041
|
-
declare function generateIdempotencyKey(): string | undefined;
|
|
3042
|
-
/**
|
|
3043
|
-
* Resolve the idempotency key for one logical checkout-create operation.
|
|
3044
|
-
*
|
|
3045
|
-
* - A merchant-supplied key is validated (non-empty, within
|
|
3046
|
-
* {@link MAX_IDEMPOTENCY_KEY_LENGTH}) and returned **unchanged** so it can be
|
|
3047
|
-
* preserved across React remounts, multiple SDK instances, or server retries
|
|
3048
|
-
* the merchant controls.
|
|
3049
|
-
* - Otherwise a fresh cryptographically random key is generated. When no secure
|
|
3050
|
-
* RNG is available this returns `undefined` and the caller omits the header,
|
|
3051
|
-
* preserving the legacy path.
|
|
3052
|
-
*
|
|
3053
|
-
* @throws FloPayError('validation_error') when a supplied key is empty,
|
|
3054
|
-
* whitespace-only, or exceeds the length limit. The offending value is never
|
|
3055
|
-
* included in the error message.
|
|
3056
|
-
*/
|
|
3057
|
-
declare function resolveIdempotencyKey(supplied?: string): string | undefined;
|
|
3058
|
-
|
|
3059
|
-
interface CachedInlineSession {
|
|
3060
|
-
canonicalIdentity?: string;
|
|
3061
|
-
sid: string;
|
|
3062
|
-
nonce?: string;
|
|
3063
|
-
}
|
|
3064
|
-
interface CachedInlineIdempotencyKey {
|
|
3065
|
-
canonicalIdentity?: string;
|
|
3066
|
-
idempotencyKey: string;
|
|
3067
|
-
}
|
|
3068
|
-
declare function readCachedInlineSession(cacheKey: string, canonicalIdentity: string): CachedInlineSession | null;
|
|
3069
|
-
declare function readCachedInlineIdempotencyKey(cacheKey: string, canonicalIdentity: string): CachedInlineIdempotencyKey | null;
|
|
3070
|
-
declare function clearCachedInlineSession(cacheKey: string, canonicalIdentity: string): void;
|
|
3071
|
-
declare function clearCachedInlineCheckout(cacheKey: string, canonicalIdentity: string): void;
|
|
3072
|
-
declare function persistCachedInlineSession(cacheKey: string, canonicalIdentity: string, sid: string, nonce?: string): void;
|
|
3073
|
-
declare function persistCachedInlineIdempotencyKey(cacheKey: string, canonicalIdentity: string, idempotencyKey: string): void;
|
|
3074
|
-
declare function serializeCreateParams(params: InlineSessionDraft | undefined, includeRequestContext?: boolean): string;
|
|
3075
|
-
declare function hashCreateParams(params: InlineSessionDraft | undefined, includeRequestContext?: boolean): string;
|
|
3076
|
-
declare function legacyCachedSessionMatchesDraft(session: CheckoutSession | undefined, params: InlineSessionDraft): boolean;
|
|
3077
|
-
|
|
3078
|
-
/** Schema version for the privacy-safe instrument callback contract. */
|
|
3079
|
-
declare const FLO_INSTRUMENT_SCHEMA_VERSION: 1;
|
|
3080
|
-
/**
|
|
3081
|
-
* Complete catalog of checkout signals exposed to merchant applications.
|
|
3082
|
-
* Error phases are separate catalog entries so consumers can verify parity
|
|
3083
|
-
* with each arm of their checkout analytics funnel.
|
|
3084
|
-
*/
|
|
3085
|
-
declare const FLO_INSTRUMENT_CATALOG: readonly [{
|
|
3086
|
-
readonly name: "checkout_mount";
|
|
3087
|
-
}, {
|
|
3088
|
-
readonly name: "sdk_loaded";
|
|
3089
|
-
}, {
|
|
3090
|
-
readonly name: "form_rendered";
|
|
3091
|
-
}, {
|
|
3092
|
-
readonly name: "card_expanded";
|
|
3093
|
-
}, {
|
|
3094
|
-
readonly name: "tokenize";
|
|
3095
|
-
}, {
|
|
3096
|
-
readonly name: "process_attempt";
|
|
3097
|
-
}, {
|
|
3098
|
-
readonly name: "3ds_challenge";
|
|
3099
|
-
}, {
|
|
3100
|
-
readonly name: "checkout_error";
|
|
3101
|
-
readonly phase: "session_create";
|
|
3102
|
-
}, {
|
|
3103
|
-
readonly name: "checkout_error";
|
|
3104
|
-
readonly phase: "sdk_load";
|
|
3105
|
-
}, {
|
|
3106
|
-
readonly name: "checkout_error";
|
|
3107
|
-
readonly phase: "process";
|
|
3108
|
-
}, {
|
|
3109
|
-
readonly name: "checkout_error";
|
|
3110
|
-
readonly phase: "wallets";
|
|
3111
|
-
}];
|
|
3112
|
-
type FloInstrumentLifecycleName = Exclude<(typeof FLO_INSTRUMENT_CATALOG)[number]['name'], 'checkout_error'>;
|
|
3113
|
-
type FloInstrumentErrorPhase = Extract<(typeof FLO_INSTRUMENT_CATALOG)[number], {
|
|
3114
|
-
name: 'checkout_error';
|
|
3115
|
-
}>['phase'];
|
|
3116
|
-
interface FloInstrumentCommonFields {
|
|
3117
|
-
schemaVersion: typeof FLO_INSTRUMENT_SCHEMA_VERSION;
|
|
3118
|
-
/** Gateway selected for this transition, when the checkout has selected one. */
|
|
3119
|
-
gateway?: BillingProvider;
|
|
3120
|
-
}
|
|
3121
|
-
type FloInstrumentEvent = (FloInstrumentCommonFields & {
|
|
3122
|
-
name: FloInstrumentLifecycleName;
|
|
3123
|
-
}) | (FloInstrumentCommonFields & {
|
|
3124
|
-
name: 'checkout_error';
|
|
3125
|
-
phase: FloInstrumentErrorPhase;
|
|
3126
|
-
});
|
|
3127
|
-
|
|
3128
|
-
/**
|
|
3129
|
-
* Invoke merchant-owned code without allowing its failure to alter checkout.
|
|
3130
|
-
* Failures stay local to the merchant console and are never sent as Flo
|
|
3131
|
-
* telemetry because the SDK cannot act on merchant implementation errors.
|
|
3132
|
-
* Every UI binding (`@flopay/react`, `@flopay/vue`) calls merchant callbacks
|
|
3133
|
-
* through this one invoker.
|
|
3134
|
-
*/
|
|
3135
|
-
declare function invokeMerchantCallback(callback: (() => unknown) | undefined): void;
|
|
3136
|
-
/** An internal observation a UI binding may project onto the merchant instrument feed. */
|
|
3137
|
-
type FloInstrumentSource = {
|
|
3138
|
-
class: 'lifecycle';
|
|
3139
|
-
name: TelemetryLogName;
|
|
3140
|
-
provider?: TelemetryProviderInput;
|
|
3141
|
-
} | {
|
|
3142
|
-
class: 'technical_error';
|
|
3143
|
-
errorCode: TelemetryErrorCode;
|
|
3144
|
-
requestCategory?: TelemetryRequestCategory;
|
|
3145
|
-
provider?: TelemetryProviderInput;
|
|
3146
|
-
} | {
|
|
3147
|
-
class: 'card_surface';
|
|
3148
|
-
provider?: TelemetryProviderInput;
|
|
3149
|
-
};
|
|
3150
|
-
/** Project the closed internal taxonomy onto the smaller merchant-safe v1 contract. */
|
|
3151
|
-
declare function projectFloInstrument(source: FloInstrumentSource): FloInstrumentEvent | null;
|
|
3152
|
-
/** Instruments a checkout emits at most once per checkout identity. */
|
|
3153
|
-
declare const FLO_INSTRUMENT_ONCE_NAMES: ReadonlySet<FloInstrumentEvent['name']>;
|
|
3154
|
-
|
|
3155
|
-
/** One advertised Stripe wallet/APM, with the account the backend chose for it. */
|
|
3156
|
-
interface StripeSetupAdvertisement {
|
|
3157
|
-
/** The Stripe payment method type (`apple_pay`, `sepa_debit`, ...). */
|
|
3158
|
-
method: string;
|
|
3159
|
-
/** This entry's own publishable key: the backend can pick an account per method. */
|
|
3160
|
-
publishableKey: string;
|
|
3161
|
-
/** The setup session's own currency, from the read. Never guessed. */
|
|
3162
|
-
currency: string;
|
|
3163
|
-
}
|
|
3164
|
-
/** Direct PayPal vault flow a setup session advertises. */
|
|
3165
|
-
interface PayPalSetupAdvertisement {
|
|
3166
|
-
clientId: string;
|
|
3167
|
-
environment?: string;
|
|
3168
|
-
}
|
|
3169
|
-
/**
|
|
3170
|
-
* The methods a setup session advertises. The SDK renders exactly these: no
|
|
3171
|
-
* gateway selection, filtering or inference happens on the client.
|
|
3172
|
-
*/
|
|
3173
|
-
interface PaymentMethodSetupAdvertisement {
|
|
3174
|
-
/** The hosted vault card widget (a `card` entry, or no advertisement at all). */
|
|
3175
|
-
card: boolean;
|
|
3176
|
-
/** Stripe wallets/APMs in advertised order. */
|
|
3177
|
-
stripe: StripeSetupAdvertisement[];
|
|
3178
|
-
paypal: PayPalSetupAdvertisement | null;
|
|
3179
|
-
/** The setup session's own currency from the read, or `null` when it carries none. */
|
|
3180
|
-
currency: string | null;
|
|
3181
|
-
/**
|
|
3182
|
-
* Stripe wallets/APMs the session advertises that are not rendered only
|
|
3183
|
-
* because the read carries no currency, so a session that offers nothing
|
|
3184
|
-
* else can say why instead of claiming it advertises nothing.
|
|
3185
|
-
*/
|
|
3186
|
-
skippedForMissingCurrency: string[];
|
|
3187
|
-
}
|
|
3188
|
-
/**
|
|
3189
|
-
* Read the advertisement from a normalized setup session. Only the session's
|
|
3190
|
-
* `advertisedPaymentMethods` decides it (backend docs/card-setup.md,
|
|
3191
|
-
* "Advertised payment methods"); the purchase-checkout gateway block is never
|
|
3192
|
-
* read, since it lists nothing on a setup session.
|
|
3193
|
-
*
|
|
3194
|
-
* - Field absent (an older backend): the card only, exactly as `FloPayCardSetup`.
|
|
3195
|
-
* - `family: "card"`: the hosted vault card widget.
|
|
3196
|
-
* - `family: "wallet"` / `"apm"` with `providerType: "stripe"`: that Stripe
|
|
3197
|
-
* method, with the entry's own publishable key. Skipped when the read carries
|
|
3198
|
-
* no currency, and listed in `skippedForMissingCurrency`.
|
|
3199
|
-
* - `family: "paypal"` (`paypal_vaulted`): the PayPal vault flow, with the
|
|
3200
|
-
* entry's key as the client id and its environment. It owns `paypal`, so a
|
|
3201
|
-
* Stripe-rendered `paypal` entry is not drawn a second time.
|
|
3202
|
-
* - Anything else is skipped, never thrown on. The first entry for a
|
|
3203
|
-
* `paymentMethodType` wins.
|
|
3204
|
-
*/
|
|
3205
|
-
declare function readSetupAdvertisement(normalized: NormalizedCheckoutSession): PaymentMethodSetupAdvertisement;
|
|
3206
|
-
/** The marker of every method the advertisement renders, card first. */
|
|
3207
|
-
declare function advertisedMethodKeys(advertisement: PaymentMethodSetupAdvertisement): string[];
|
|
3208
|
-
/** Whether the advertisement offers anything to render. */
|
|
3209
|
-
declare function advertisesAnyMethod(advertisement: PaymentMethodSetupAdvertisement): boolean;
|
|
3210
|
-
/** The session-intent category for an advertised Stripe method. */
|
|
3211
|
-
declare function stripeMethodCategory(method: string): 'wallet' | 'apm';
|
|
3212
|
-
/** Which wording the outcome overlay uses: card wording only for the card widget. */
|
|
3213
|
-
type SetupOverlayWording = 'card' | 'payment_method';
|
|
3214
|
-
/** Processing / success / failure overlay labels for a setup outcome. */
|
|
3215
|
-
declare function setupOverlayLabels(wording: SetupOverlayWording): {
|
|
3216
|
-
processingLabel: string;
|
|
3217
|
-
successLabel: string;
|
|
3218
|
-
errorLabel: string;
|
|
3219
|
-
};
|
|
3220
|
-
|
|
3221
|
-
/**
|
|
3222
|
-
* The buyer identity an express surface attaches to the checkout: the
|
|
3223
|
-
* session-patch `account` shape (email and names, plus any other account
|
|
3224
|
-
* fields the click-time patch carried).
|
|
3225
|
-
*/
|
|
3226
|
-
type PayPalBuyerIdentity = NonNullable<InlineSessionPatch['account']>;
|
|
3227
|
-
/**
|
|
3228
|
-
* Trims the names and drops empty ones. Express continuations use empty name
|
|
3229
|
-
* markers to clear hydrated fallbacks through JSON checkpoints
|
|
3230
|
-
* (`preserveMissingNames`); the final process payload strips them again.
|
|
3231
|
-
*/
|
|
3232
|
-
declare function compactBuyerIdentity(identity: PayPalBuyerIdentity, preserveMissingNames?: boolean): PayPalBuyerIdentity;
|
|
3233
|
-
/** Splits a full name at the first whitespace run; a card-holder placeholder is no name. */
|
|
3234
|
-
declare function splitFullName(name: string | null | undefined): {
|
|
3235
|
-
firstName?: string;
|
|
3236
|
-
lastName?: string;
|
|
3237
|
-
};
|
|
3238
|
-
/** The payer PayPal reports for an approved order (`actions.order.get()`). */
|
|
3239
|
-
declare function readPayPalPayerIdentity(details: unknown): PayPalBuyerIdentity;
|
|
3240
|
-
/**
|
|
3241
|
-
* The buyer identity a PayPal approval starts from: the click-time account
|
|
3242
|
-
* patch wins, then the host's `email` and `billingName`, then the session's
|
|
3243
|
-
* customer.
|
|
3244
|
-
*/
|
|
3245
|
-
declare function resolvePayPalApprovalIdentity(input: {
|
|
3246
|
-
accountPatch?: InlineSessionPatch['account'] | null;
|
|
3247
|
-
email?: string | null;
|
|
3248
|
-
billingName?: string | null;
|
|
3249
|
-
session?: CheckoutSession | null;
|
|
3250
|
-
}): PayPalBuyerIdentity;
|
|
3251
|
-
/** Whether the approval still lacks a valid email or any name, so PayPal's payer is read. */
|
|
3252
|
-
declare function needsPayPalPayerDetails(identity: PayPalBuyerIdentity): boolean;
|
|
3253
|
-
/** Fills the approval identity's gaps from PayPal's order details; PayPal's payer wins per field. */
|
|
3254
|
-
declare function mergePayPalPayerIdentity(identity: PayPalBuyerIdentity, details: unknown): PayPalBuyerIdentity;
|
|
3255
|
-
/**
|
|
3256
|
-
* Whether a PayPal approval must collect the buyer's email itself: no valid
|
|
3257
|
-
* email is known from the host or the session.
|
|
3258
|
-
*/
|
|
3259
|
-
declare function paypalProviderIdentityRequired(email: string | null | undefined, session: CheckoutSession | null | undefined): boolean;
|
|
3260
|
-
/**
|
|
3261
|
-
* Chooses a PayPal presentation without ever hiding PayPal. Deterministic
|
|
3262
|
-
* non-popup modes are limited to one-time Orders in an in-app browser and
|
|
3263
|
-
* require the backend's advertisement.
|
|
3264
|
-
*/
|
|
3265
|
-
declare function resolvePayPalPresentationMode(environment: PayPalBrowserEnvironment, advertisedCapability: TelemetryPresentationMode | undefined, providerObjectType: PayPalProviderObjectType): TelemetryPresentationMode;
|
|
3266
|
-
|
|
3267
|
-
/**
|
|
3268
|
-
* Whether the configured PayPal object rides the Flo-owned `paypal_vaulted`
|
|
3269
|
-
* channel. An explicitly configured `order` or `setup_token` (the session's
|
|
3270
|
-
* advertisement, or the deprecated prop as a fallback) does. A legacy session
|
|
3271
|
-
* with neither, and an advertised provider-managed `subscription`, keep the
|
|
3272
|
-
* released `paypal` requests byte-identical.
|
|
3273
|
-
*/
|
|
3274
|
-
declare function usesPayPalVaultedChannel(configuredObjectType: PayPalProviderObjectType | undefined): boolean;
|
|
3275
|
-
/**
|
|
3276
|
-
* The `/intents` request body for a direct PayPal button. The payment-method
|
|
3277
|
-
* type is the in-band channel selector: the Flo-owned channel asks for
|
|
3278
|
-
* `paypal_vaulted` (with `intentKind: 'setup'` for a vault setup token); the
|
|
3279
|
-
* legacy channel asks for `paypal` with `intentKind: 'payment'`.
|
|
3280
|
-
*/
|
|
3281
|
-
declare function buildPayPalSessionIntentRequest(configuredObjectType: PayPalProviderObjectType | undefined): PayPalSessionIntentRequest;
|
|
3282
|
-
/**
|
|
3283
|
-
* The tokenized body for PayPal's approval token. A vault setup token and an
|
|
3284
|
-
* advertised order carry the Flo-owned channel so the backend can continue on
|
|
3285
|
-
* it; the legacy fallback keeps the released body byte-identical.
|
|
3286
|
-
*/
|
|
3287
|
-
declare function buildPayPalTokenizedBody(token: string, configuredObjectType: PayPalProviderObjectType | undefined): TokenizedBody;
|
|
3288
|
-
/**
|
|
3289
|
-
* The merchant-facing event for a buyer who closed or left PayPal without
|
|
3290
|
-
* approving. The session is the attempt's (the click-time patch's, else the
|
|
3291
|
-
* button's) and the payment-method type follows the same channel rule as the
|
|
3292
|
-
* attempt's `/intents` request.
|
|
3293
|
-
*/
|
|
3294
|
-
declare function buildPayPalCancelEvent(sessionId: string, configuredObjectType: PayPalProviderObjectType | undefined): FloPayPaymentCancelEvent;
|
|
3295
|
-
/** What a direct PayPal button knows when it completes an approval itself. */
|
|
3296
|
-
interface PayPalProcessPaymentInput {
|
|
3297
|
-
/** The approval's tokenized body ({@link buildPayPalTokenizedBody}). */
|
|
3298
|
-
body: TokenizedBody;
|
|
3299
|
-
/** The session the attempt runs on (the click-time patch's, else the button's). */
|
|
3300
|
-
sessionId: string;
|
|
3301
|
-
/** The checkout session token for the attempt. */
|
|
3302
|
-
nonce: string | undefined;
|
|
3303
|
-
/** The click-time account patch from `runBeforeButtonClick`. */
|
|
3304
|
-
accountPatch?: InlineSessionPatch['account'];
|
|
3305
|
-
/** The checkout session, for the buyer's identity and address. */
|
|
3306
|
-
session?: CheckoutSession | null;
|
|
3307
|
-
/** The button's `email` prop. */
|
|
3308
|
-
email?: string;
|
|
3309
|
-
}
|
|
3310
|
-
/**
|
|
3311
|
-
* The `/process` call a direct PayPal button makes when no host takes the
|
|
3312
|
-
* tokenized body: the click-time account patch wins, then the session's
|
|
3313
|
-
* customer, then its account data. Returns the (vestigial) user id argument
|
|
3314
|
-
* and the request, in the field order the released button sends.
|
|
3315
|
-
*/
|
|
3316
|
-
declare function buildPayPalProcessPaymentRequest(input: PayPalProcessPaymentInput): {
|
|
3317
|
-
userId: string;
|
|
3318
|
-
params: ProcessPaymentParams;
|
|
3319
|
-
};
|
|
3320
|
-
/**
|
|
3321
|
-
* The buyer-facing message for a failed PayPal payment: the raw message (or
|
|
3322
|
-
* the generic fallback) through the shared friendly-message override.
|
|
3323
|
-
*/
|
|
3324
|
-
declare function friendlyPayPalFailureMessage(rawMessage: string | undefined): string;
|
|
3325
|
-
/** A rejected PayPal `/process` response body, read for the buyer message and the decline codes. */
|
|
3326
|
-
declare function describePayPalProcessFailure(json: Record<string, unknown> | null): {
|
|
3327
|
-
message: string;
|
|
3328
|
-
code: string | undefined;
|
|
3329
|
-
declineCode: string | undefined;
|
|
3330
|
-
};
|
|
3331
|
-
/**
|
|
3332
|
-
* The `providerDeclineReason` a PayPal decline reports to `/intents/decline`:
|
|
3333
|
-
* the provider's decline code, then its error code, then the generic reason.
|
|
3334
|
-
*/
|
|
3335
|
-
declare function resolvePayPalDeclineReason(error: unknown): string;
|
|
3336
|
-
/**
|
|
3337
|
-
* Zoid (PayPal's iframe framework) reports its own teardown through `onError`:
|
|
3338
|
-
* "zoid destroyed all components", a closed window, a removed container. Those
|
|
3339
|
-
* are page navigation or unmounting, not payment errors, so no binding shows
|
|
3340
|
-
* them to the buyer.
|
|
3341
|
-
*/
|
|
3342
|
-
declare function isPayPalTeardownMessage(message: string | undefined): boolean;
|
|
3343
|
-
|
|
3344
|
-
/** Privacy-bounded browser context shared by PayPal presentation and telemetry. */
|
|
3345
|
-
interface PayPalBrowserEnvironment {
|
|
3346
|
-
inAppBrowser: boolean;
|
|
3347
|
-
appFamily: TelemetryAppFamily;
|
|
3348
|
-
popupCapability: TelemetryPopupCapability;
|
|
3349
|
-
}
|
|
3350
|
-
/**
|
|
3351
|
-
* Classifies an in-app browser without retaining or returning its user agent.
|
|
3352
|
-
*
|
|
3353
|
-
* Static UA evidence cannot prove that a popup will open, so capability stays
|
|
3354
|
-
* `unknown`; runtime lifecycle evidence is reported separately.
|
|
3355
|
-
*/
|
|
3356
|
-
declare function detectPayPalEnvironment(userAgent?: string): PayPalBrowserEnvironment;
|
|
3357
|
-
|
|
3358
|
-
/**
|
|
3359
|
-
* Postal-code → state derivation for AVS.
|
|
3360
|
-
*
|
|
3361
|
-
* Used when the form configuration shows `address_line_1` but hides the
|
|
3362
|
-
* `state` input — we still want to populate `billing_details.address.state`
|
|
3363
|
-
* so Stripe Radar gets a richer address signal. Currently supports US and CA;
|
|
3364
|
-
* other countries return `null` (caller should fall back to omitting state).
|
|
3365
|
-
*/
|
|
3366
|
-
/**
|
|
3367
|
-
* Resolve a state / province code from a postal code for the given country.
|
|
3368
|
-
*
|
|
3369
|
-
* - US: 5-digit ZIP → 2-letter USPS state code (uses 3-digit prefix table).
|
|
3370
|
-
* - CA: A1A 1A1 → 2-letter ISO 3166-2:CA province code (first-letter mapping).
|
|
3371
|
-
* - All other countries: `null`.
|
|
3372
|
-
*
|
|
3373
|
-
* Returns `null` when the postal code is malformed or falls in an unmapped
|
|
3374
|
-
* range. Callers should treat `null` as "skip — don't derive".
|
|
3375
|
-
*/
|
|
3376
|
-
declare function getStateFromPostalCode(country: string, postalCode: string): string | null;
|
|
3377
|
-
|
|
3378
|
-
/**
|
|
3379
|
-
* True when `validator` has an authoritative postcode pattern for the country
|
|
3380
|
-
* (normalized to ISO 3166-1 alpha-2 via {@link normalizeCountryToIso2}).
|
|
3381
|
-
* Supported countries validate the postcode format; unsupported / no-postcode /
|
|
3382
|
-
* unresolvable countries fail open. Note the 2-letter passthrough means `UK`
|
|
3383
|
-
* (an unsupported `validator` locale) returns `false` here — matching the
|
|
3384
|
-
* backend; use the full name `United Kingdom` for `GB` semantics.
|
|
3385
|
-
*/
|
|
3386
|
-
declare function isPostalCodeSupported(country: string): boolean;
|
|
3387
|
-
/**
|
|
3388
|
-
* Validate a postcode against the country's expected format. A faithful mirror
|
|
3389
|
-
* of the backend's `isPostalCodeValidForCountry`, so the SDK never blocks a
|
|
3390
|
-
* value the server would accept, nor opens the submit gate on one it would
|
|
3391
|
-
* reject. Fail-open (returns `true`) in exactly the backend's three cases:
|
|
3392
|
-
*
|
|
3393
|
-
* - `postalCode` is blank / whitespace-only;
|
|
3394
|
-
* - the country can't be normalized to an ISO-2 locale;
|
|
3395
|
-
* - the ISO-2 locale isn't one `validator` recognises.
|
|
3396
|
-
*
|
|
3397
|
-
* Otherwise returns `validator`'s `isPostalCode(zip.trim(), locale)`. Callers
|
|
3398
|
-
* that distinguish "required" (empty) from "malformed" (bad format) must check
|
|
3399
|
-
* emptiness themselves — an empty value fails open here, as it does server-side.
|
|
3400
|
-
*/
|
|
3401
|
-
declare function isValidPostalCode(country: string, postalCode: string): boolean;
|
|
3402
|
-
/**
|
|
3403
|
-
* The example postcode the backend would embed in its 400 message for the
|
|
3404
|
-
* country (e.g. US `12345 or 12345-6789`, GB `SW1A 1AA`, CA `A1A 1A1`), or
|
|
3405
|
-
* `undefined` when there is none (unresolvable country, or a supported country
|
|
3406
|
-
* absent from {@link POSTAL_CODE_EXAMPLES}).
|
|
3407
|
-
*/
|
|
3408
|
-
declare function getPostalCodeExample(country: string): string | undefined;
|
|
3409
|
-
|
|
3410
|
-
/** The submit-button style fields a themed tile copies (any CSS-like record). */
|
|
3411
|
-
interface PrimaryTileSubmitStyle {
|
|
3412
|
-
color?: unknown;
|
|
3413
|
-
border?: unknown;
|
|
3414
|
-
borderRadius?: unknown;
|
|
3415
|
-
boxShadow?: unknown;
|
|
3416
|
-
}
|
|
3417
|
-
/** Inputs for {@link derivePrimaryTileStyle}. */
|
|
3418
|
-
interface PrimaryTileStyleSource {
|
|
3419
|
-
themeBundle: ThemeBundle | null | undefined;
|
|
3420
|
-
resolvedPrimaryColor: string;
|
|
3421
|
-
resolvedBorderRadius: string;
|
|
3422
|
-
submitButtonStyle?: PrimaryTileSubmitStyle | undefined;
|
|
3423
|
-
/**
|
|
3424
|
-
* Raw `appearance.colorPrimary` (undefined when the merchant didn't set one).
|
|
3425
|
-
* When present it forces a primary-filled tile even with no theme bundle
|
|
3426
|
-
* (the `classic` preset), so an explicit `colorPrimary` override always wins
|
|
3427
|
-
* over the historic white tile.
|
|
3428
|
-
*/
|
|
3429
|
-
explicitPrimaryColor?: string | undefined;
|
|
3430
|
-
}
|
|
3431
|
-
/** The colour and shape of a primary tile. */
|
|
3432
|
-
interface PrimaryTileStyle {
|
|
3433
|
-
backgroundColor: string;
|
|
3434
|
-
color: string;
|
|
3435
|
-
border: string;
|
|
3436
|
-
borderRadius: string | number;
|
|
3437
|
-
boxShadow?: string | undefined;
|
|
3438
|
-
}
|
|
3439
|
-
/**
|
|
3440
|
-
* Base colours for a primary tile (the buttons-layout card tile and the
|
|
3441
|
-
* one-click button):
|
|
3442
|
-
*
|
|
3443
|
-
* - `'classic'` / no theme: white background, grey border — historic look
|
|
3444
|
-
* that lines up with the wallet ECE row's flat tiles.
|
|
3445
|
-
* - Any theme bundle (`modern-*`, `bold-*`, `glass-*`): `colorPrimary`
|
|
3446
|
-
* (`resolvedPrimaryColor` — already merged with any `appearance` override)
|
|
3447
|
-
* drives the `backgroundColor`, exactly like the "Confirm Payment" submit
|
|
3448
|
-
* CTA, so all three flo buttons (submit, card, auto-pay) share one fill and
|
|
3449
|
-
* a per-checkout `colorPrimary` override re-skins every one of them. The
|
|
3450
|
-
* bundle's `submitButton` still supplies `color` / `border` / `borderRadius`
|
|
3451
|
-
* / `boxShadow` so typography + shape stay on-theme. Hover (`colorPrimaryHover`)
|
|
3452
|
-
* is applied by each button's mouse-enter / mouse-leave at the call site.
|
|
3453
|
-
*/
|
|
3454
|
-
declare function derivePrimaryTileStyle(opts: PrimaryTileStyleSource): PrimaryTileStyle;
|
|
3455
|
-
|
|
3456
|
-
declare function markSessionRecentlyCompleted(sessionId: string | null | undefined): void;
|
|
3457
|
-
declare function wasSessionRecentlyCompleted(sessionId: string | null | undefined): boolean;
|
|
3458
|
-
|
|
3459
|
-
interface SentryStackFrameLike {
|
|
3460
|
-
in_app?: boolean;
|
|
3461
|
-
filename?: string;
|
|
3462
|
-
abs_path?: string;
|
|
3463
|
-
module?: string;
|
|
3464
|
-
}
|
|
3465
|
-
interface SentryEventLike {
|
|
3466
|
-
exception?: {
|
|
3467
|
-
values?: Array<{
|
|
3468
|
-
stacktrace?: {
|
|
3469
|
-
frames?: SentryStackFrameLike[];
|
|
3470
|
-
};
|
|
3471
|
-
}>;
|
|
3472
|
-
};
|
|
3473
|
-
}
|
|
3474
|
-
/**
|
|
3475
|
-
* Drops errors whose complete exception stack contains recognized hosted
|
|
3476
|
-
* third-party code and no resolvable first-party frame. All other events are
|
|
3477
|
-
* returned by identity.
|
|
3478
|
-
*/
|
|
3479
|
-
declare function dropThirdPartyOnlyError<T extends SentryEventLike>(event: T): T | null;
|
|
3480
|
-
|
|
3481
|
-
/**
|
|
3482
|
-
* A `FloPayAppearance` whose `theme` has been normalized to the set Stripe's
|
|
3483
|
-
* Appearance API accepts, so it can be handed straight to Stripe Elements
|
|
3484
|
-
* without tripping Stripe.js's `Invalid value … provided to "theme"` warning.
|
|
3485
|
-
*/
|
|
3486
|
-
interface StripeSafeAppearance {
|
|
3487
|
-
theme: 'stripe' | 'night' | 'flat';
|
|
3488
|
-
variables?: FloPayThemeVariables;
|
|
3489
|
-
rules?: Record<string, Record<string, string>>;
|
|
3490
|
-
}
|
|
3491
|
-
/** Maps FloPay's public appearance token to Stripe's accepted theme set. */
|
|
3492
|
-
declare function toStripeAppearanceTheme(theme: 'default' | 'flat' | 'night' | 'none' | undefined): 'stripe' | 'night' | 'flat';
|
|
3493
|
-
/**
|
|
3494
|
-
* Normalizes a FloPay appearance before a UI binding passes it to Stripe
|
|
3495
|
-
* Elements. Lives here, free of Stripe.js, so the Stripe-free entries and
|
|
3496
|
-
* every UI binding share one mapping (TeamFloPay/sdk#410, CTO decision 1).
|
|
3497
|
-
*/
|
|
3498
|
-
declare function toStripeAppearance(appearance: FloPayAppearance): StripeSafeAppearance;
|
|
3499
|
-
|
|
3500
|
-
/**
|
|
3501
|
-
* Selects the safe Stripe-routed PayPal surface for the active checkout mount
|
|
3502
|
-
* from the merchant's `walletPresentation` preference. An in-app browser, a
|
|
3503
|
-
* pop-up the browser blocked, or `prefer_redirect` gives the full-page
|
|
3504
|
-
* redirect; anything else keeps the pop-up. Moved from @flopay/react's
|
|
3505
|
-
* `in-app-browser.ts` so @flopay/vue resolves `walletPresentation` the same way.
|
|
3506
|
-
*/
|
|
3507
|
-
declare function resolveStripePayPalPresentation(environment: PayPalBrowserEnvironment, preference: WalletPresentation, popupCapability?: TelemetryPopupCapability): 'popup' | 'redirect';
|
|
3508
|
-
/**
|
|
3509
|
-
* Storage key carrying the effective session / nonce / account patch across a
|
|
3510
|
-
* Stripe-routed PayPal redirect, so the return can `/process` against the same
|
|
3511
|
-
* session PayPal authorized (an inline-session bootstrap inside the click gate
|
|
3512
|
-
* would otherwise be lost when the page reloads after the PayPal round-trip).
|
|
3513
|
-
*/
|
|
3514
|
-
declare const STRIPE_PAYPAL_RESUME_KEY = "flopay_paypal_resume";
|
|
3515
|
-
/** The query parameters Stripe appends to the return URL after a redirect. */
|
|
3516
|
-
declare const STRIPE_REDIRECT_PARAMS: readonly ["payment_intent", "payment_intent_client_secret", "redirect_status"];
|
|
3517
|
-
interface StripePayPalResumeContinuation<TAccount = unknown> {
|
|
3518
|
-
clientSecret?: string;
|
|
3519
|
-
sessionId?: string;
|
|
3520
|
-
nonce?: string;
|
|
3521
|
-
accountPatch?: TAccount;
|
|
3522
|
-
}
|
|
3523
|
-
/** `[payment_intent, payment_intent_client_secret, redirect_status]` from the current URL. */
|
|
3524
|
-
declare function readStripeRedirectParams(): [string | null, string | null, string | null];
|
|
3525
|
-
/** The current URL without Stripe's redirect parameters (the PayPal `return_url`). */
|
|
3526
|
-
declare function stripeRedirectReturnUrl(): string;
|
|
3527
|
-
/**
|
|
3528
|
-
* The saved continuation, only when it belongs to `clientSecret`, so a stale
|
|
3529
|
-
* payload from a prior attempt can't replay against a different PaymentIntent.
|
|
3530
|
-
*/
|
|
3531
|
-
declare function readMatchingStripePayPalContinuation<TAccount = unknown>(clientSecret: string | null): StripePayPalResumeContinuation<TAccount> | null;
|
|
3532
|
-
/** Whether this page load is the return of a Stripe-routed PayPal redirect this browser started. */
|
|
3533
|
-
declare function hasMatchingStripePayPalReturn(): boolean;
|
|
3534
|
-
/**
|
|
3535
|
-
* Saves the continuation, or removes it when called without one. Returns
|
|
3536
|
-
* whether storage accepted the change (a redirect must not start without it).
|
|
3537
|
-
*/
|
|
3538
|
-
declare function writeStripePayPalContinuation(continuation?: StripePayPalResumeContinuation): boolean;
|
|
3539
|
-
/** Consumes the continuation and strips Stripe's redirect parameters from the URL. */
|
|
3540
|
-
declare function clearStripePayPalReturn(): void;
|
|
3541
|
-
|
|
3542
|
-
interface ClassifiedTelemetryFailure {
|
|
3543
|
-
errorCode: TelemetryErrorCode;
|
|
3544
|
-
statusClass: TelemetryStatusClass;
|
|
3545
|
-
failureCategory?: TelemetryFailureCategory;
|
|
3546
|
-
}
|
|
3547
|
-
/**
|
|
3548
|
-
* Classify the bounded billing response contract without reading free-form
|
|
3549
|
-
* messages, error codes, or provider payloads.
|
|
3550
|
-
*/
|
|
3551
|
-
declare function classifyPaymentRejection(status: number, payload: unknown): Extract<TelemetryExpectedOutcome, 'payment_declined' | 'validation_rejected'> | undefined;
|
|
3552
|
-
/** Classify only SDK-owned error structure; never inspect messages or payloads. */
|
|
3553
|
-
declare function classifyTelemetryFailure(error: unknown, fallbackCode: TelemetryErrorCode, fallbackStatusClass?: TelemetryStatusClass): ClassifiedTelemetryFailure;
|
|
3554
|
-
declare function telemetryStatusClass(status: number | undefined, fallbackStatusClass?: TelemetryStatusClass): TelemetryStatusClass;
|
|
3555
|
-
|
|
3556
|
-
/**
|
|
3557
|
-
* RFC 4122 v4 UUID shape (case-insensitive). Mirrors the backend's `@IsUUID()`
|
|
3558
|
-
* acceptance for the fields the SDK fills, e.g. the session-intent
|
|
3559
|
-
* `authorizationAttemptId`.
|
|
3560
|
-
*/
|
|
3561
|
-
declare const UUID_V4: RegExp;
|
|
3562
|
-
/** True when `value` is a v4 UUID string. */
|
|
3563
|
-
declare function isUuidV4(value: unknown): value is string;
|
|
3564
|
-
/**
|
|
3565
|
-
* Generate a cryptographically-random v4 UUID.
|
|
3566
|
-
*
|
|
3567
|
-
* Prefers `crypto.randomUUID()`, falls back to `crypto.getRandomValues`, and
|
|
3568
|
-
* only as a last resort to `Math.random`, so the SDK still produces a
|
|
3569
|
-
* well-formed UUID in environments without a secure RNG. Unlike
|
|
3570
|
-
* {@link generateIdempotencyKey} this never returns `undefined` or a non-UUID
|
|
3571
|
-
* string, because callers send it to backend fields validated as `@IsUUID()`
|
|
3572
|
-
* (a weak or missing value there is a hard `400`, not a silent downgrade).
|
|
3573
|
-
*/
|
|
3574
|
-
declare function randomUuidV4(): string;
|
|
3575
|
-
|
|
3576
|
-
/**
|
|
3577
|
-
* Look up currency information by ISO 3166-1 alpha-2 country code.
|
|
3578
|
-
* Falls back to USD when the country is not in the map.
|
|
3579
|
-
*/
|
|
3580
|
-
declare function getCurrencyByCountry(countryCode: string): CurrencyInfo;
|
|
3581
|
-
/** Returns `true` if the string looks like a Stripe publishable key. */
|
|
3582
|
-
declare function isValidPublishableKey(key: string): boolean;
|
|
3583
|
-
/** Returns `true` if the string looks like a Stripe secret key. */
|
|
3584
|
-
declare function isValidSecretKey(key: string): boolean;
|
|
3585
|
-
/**
|
|
3586
|
-
* Returns `true` when the client secret belongs to a SetupIntent (`seti_…`).
|
|
3587
|
-
* Trial-only / $0 checkouts confirm and retrieve a SetupIntent instead of a
|
|
3588
|
-
* PaymentIntent, so callers must route those to `confirmCardSetup` /
|
|
3589
|
-
* `retrieveSetupIntent` rather than the PaymentIntent equivalents.
|
|
3590
|
-
*/
|
|
3591
|
-
declare function isSetupIntentClientSecret(clientSecret: string | null | undefined): boolean;
|
|
3592
|
-
/** Treat the checkout's normalized fallback cardholder sentinel as absent. */
|
|
3593
|
-
declare function isCardHolderNamePlaceholder(...nameParts: Array<string | null | undefined>): boolean;
|
|
3594
|
-
|
|
3595
|
-
/**
|
|
3596
|
-
* Darken a `#rrggbb` color by `amount` (0–1) — used to derive a flo-button hover
|
|
3597
|
-
* shade from the primary when the theme doesn't supply an explicit
|
|
3598
|
-
* `colorPrimaryHover`. Returns the input unchanged for non-hex values.
|
|
3599
|
-
*/
|
|
3600
|
-
declare function darkenHex(hex: string, amount?: number): string;
|
|
3601
|
-
/** Pass through CSS font-weight values; anything else resolves to undefined. */
|
|
3602
|
-
declare function toCssWeight(value: string | number | undefined): string | number | undefined;
|
|
3603
|
-
/** Inputs for {@link computeVaultCardThemeColors}. */
|
|
3604
|
-
interface VaultThemeSource {
|
|
3605
|
-
/** Stripe-side appearance (a theme bundle's, or the merchant's override). */
|
|
3606
|
-
appearance?: FloPayAppearance | undefined;
|
|
3607
|
-
/** Resolved buttons-layout styles (bundle + merchant overrides merged). */
|
|
3608
|
-
buttonsStyles: ButtonsLayoutStyles;
|
|
3609
|
-
/** Surrounding layout — affects the neutral border fallback. */
|
|
3610
|
-
layout?: 'default' | 'buttons';
|
|
3611
|
-
}
|
|
3612
|
-
/**
|
|
3613
|
-
* Colors pushed into the hosted vault widget so the backend-rendered card form
|
|
3614
|
-
* matches the merchant's theme. The SDK owns *all* theming here — every value
|
|
3615
|
-
* resolves from the theme bundle / appearance overrides (same precedence the
|
|
3616
|
-
* SDK uses for its merchant-hosted AVS inputs); the backend ships only neutral
|
|
3617
|
-
* fallbacks for when a var is absent. Shared by `SplitCardForm` (checkout) and
|
|
3618
|
-
* `FloPayCardSetup` (no-charge card setup) so one `theme` value renders the
|
|
3619
|
-
* same hosted card form everywhere.
|
|
3620
|
-
*/
|
|
3621
|
-
declare function computeVaultCardThemeColors({ appearance, buttonsStyles, layout, }: VaultThemeSource): VaultCardThemeColors;
|
|
3622
|
-
|
|
3623
|
-
/**
|
|
3624
|
-
* Production card-capture verification (TeamFloPay/backend#1920, sdk#414).
|
|
3625
|
-
*
|
|
3626
|
-
* While the backend enforces a human check before card capture, a vault block
|
|
3627
|
-
* may arrive as a verification descriptor (`verification.required`) instead of
|
|
3628
|
-
* a ready-to-inject `html` shell, and `POST …/vault/capture` answers
|
|
3629
|
-
* `403 verification_required`. Both are a mountable state: the SDK mounts the
|
|
3630
|
-
* billing API's hosted, credential-free form route, which runs the check inside
|
|
3631
|
-
* the card area and then loads the credentialed card form in the same frame.
|
|
3632
|
-
* The SDK never renders the challenge and never reads the descriptor's site
|
|
3633
|
-
* key, action or `cData`.
|
|
3634
|
-
*/
|
|
3635
|
-
/** Path of the billing API's gated hosted card-form route. */
|
|
3636
|
-
declare const VAULT_CAPTURE_FORM_PATH = "/v1/vault/capture/form";
|
|
3637
|
-
/** True when the vault block says a human check guards card capture. */
|
|
3638
|
-
declare function isVaultVerificationRequired(block: VaultCaptureBlock | null | undefined): boolean;
|
|
3639
|
-
/**
|
|
3640
|
-
* True when the SDK can mount a card form from this block: either the shell
|
|
3641
|
-
* `html` the backend rendered, or a verification descriptor the SDK builds the
|
|
3642
|
-
* shell for. A block that is neither still needs the lazy recovery path.
|
|
3643
|
-
*/
|
|
3644
|
-
declare function isMountableVaultBlock(block: VaultCaptureBlock | null | undefined): boolean;
|
|
3645
|
-
/** Session context a descriptor-built shell is addressed with. */
|
|
3646
|
-
interface VaultMountContext {
|
|
3647
|
-
/** Billing API base URL (the hosted form's origin). */
|
|
3648
|
-
billingApiUrl?: string;
|
|
3649
|
-
/** Checkout session the form is bound to. */
|
|
3650
|
-
sessionId?: string | null;
|
|
3651
|
-
/** Session nonce the gated form route authenticates the frame with. */
|
|
3652
|
-
nonce?: string | null;
|
|
3653
|
-
}
|
|
3654
|
-
/**
|
|
3655
|
-
* Resolve a vault block into the adapter's mount options.
|
|
3656
|
-
*
|
|
3657
|
-
* - A block with `html` mounts that html exactly as before (released adapters
|
|
3658
|
-
* and the backend's own shell keep working unchanged).
|
|
3659
|
-
* - A verification-required block without `html` mounts a credential-free
|
|
3660
|
-
* iframe shell pointing at the billing API's hosted form route for this
|
|
3661
|
-
* session. Its `expectedOrigin` defaults to the billing API origin, so a
|
|
3662
|
-
* same-window forged outcome is rejected, and the block's `messageToken` is
|
|
3663
|
-
* still enforced when present.
|
|
3664
|
-
* - Anything else returns `null` (nothing to mount).
|
|
3665
|
-
*/
|
|
3666
|
-
declare function resolveVaultMountOptions(block: VaultCaptureBlock | null | undefined, context: VaultMountContext): CardCaptureMountOptions | null;
|
|
3667
|
-
|
|
3668
|
-
/**
|
|
3669
|
-
* Deferred Stripe Elements mode for the wallet / Express Checkout row
|
|
3670
|
-
* (Apple Pay, Google Pay), from the cart total due today.
|
|
3671
|
-
*
|
|
3672
|
-
* A $0-today cart (free trial) cannot run in `payment` mode: Stripe rejects a
|
|
3673
|
-
* `$0` amount with "amount must be greater than 0", and the historic
|
|
3674
|
-
* `amount: totalAmount || 100` floor surfaced a misleading **$1.00** charge on
|
|
3675
|
-
* the wallet sheet. Those carts run in `setup` mode instead — the wallet
|
|
3676
|
-
* collects the card for the trial with no amount shown, matching the backend's
|
|
3677
|
-
* SetupIntent. Any positive amount keeps `payment` mode with the real total.
|
|
3678
|
-
*
|
|
3679
|
-
* Moved from `@flopay/react`'s `resolveWalletElementsMode` so `@flopay/react`
|
|
3680
|
-
* and `@flopay/vue` decide the wallet row's mode, amount and capture method
|
|
3681
|
-
* with one implementation. Each caller adds its method list and the usage
|
|
3682
|
-
* from `resolveSetupFutureUsage`.
|
|
3683
|
-
*
|
|
3684
|
-
* @param amountInMinorUnits cart total due today, in the smallest currency unit.
|
|
3685
|
-
* @param captureMethod capture contract used by the subsequently created intent.
|
|
3686
|
-
*/
|
|
3687
|
-
declare function resolveWalletModeOptions(amountInMinorUnits: number | undefined, captureMethod?: CaptureMethod): {
|
|
3688
|
-
mode: 'setup';
|
|
3689
|
-
} | {
|
|
3690
|
-
mode: 'payment';
|
|
3691
|
-
amount: number;
|
|
3692
|
-
captureMethod: 'automatic_async' | 'manual';
|
|
3693
|
-
};
|
|
3694
|
-
|
|
3695
|
-
/** `details.providerCode` on the `external_payment_method_failed` error for this case. */
|
|
3696
|
-
declare const WALLET_SHEET_WINDOW_TOO_SMALL_CODE = "wallet_sheet_window_too_small";
|
|
3697
|
-
interface BrowserWindowInput {
|
|
3698
|
-
/** Defaults to `navigator.userAgent`; the string is read, never retained. */
|
|
3699
|
-
userAgent?: string;
|
|
3700
|
-
/** Defaults to `window.innerWidth` × `window.innerHeight`. */
|
|
3701
|
-
viewport?: {
|
|
3702
|
-
width: number;
|
|
3703
|
-
height: number;
|
|
3704
|
-
};
|
|
3705
|
-
}
|
|
3706
|
-
interface WalletSheetCancelContext extends BrowserWindowInput {
|
|
3707
|
-
/** Stripe express payment type of the cancelled attempt. */
|
|
3708
|
-
method: string;
|
|
3709
|
-
/** Milliseconds between the wallet click and the cancel callback. */
|
|
3710
|
-
elapsedMs: number;
|
|
3711
|
-
/** Whether the page lost focus or visibility after the click (a sheet really opened). */
|
|
3712
|
-
handoffObserved: boolean;
|
|
3713
|
-
}
|
|
3714
|
-
/**
|
|
3715
|
-
* Desktop Chromium in a viewport Chrome cannot fit its payment-handler window
|
|
3716
|
-
* into: the one case where Google Pay must open in Google's own window.
|
|
3717
|
-
*/
|
|
3718
|
-
declare function shouldPreferWalletPopup(input?: BrowserWindowInput): boolean;
|
|
3719
|
-
/**
|
|
3720
|
-
* True only on positive evidence: a Google Pay attempt on desktop Chromium
|
|
3721
|
-
* that was cancelled within the quick-cancel window, without the page ever
|
|
3722
|
-
* yielding control, in a viewport Chrome cannot fit its handler window into.
|
|
3723
|
-
* Time alone is never evidence; a slow cancel or an observed hand-off is the
|
|
3724
|
-
* buyer dismissing a sheet that did open.
|
|
3725
|
-
*/
|
|
3726
|
-
declare function isWalletSheetRefusedForWindowSize(context: WalletSheetCancelContext): boolean;
|
|
3727
|
-
/** Buyer copy for a wallet sheet the browser refused to open for lack of room. */
|
|
3728
|
-
declare function buildWalletSheetWindowMessage(displayName: string): string;
|
|
3729
|
-
/**
|
|
3730
|
-
* From now until the returned function runs, every iframe created through
|
|
3731
|
-
* `document.createElement` carries `allow="… payment 'none'"`, whatever its
|
|
3732
|
-
* creator later sets, so none of those frames (or their children) can use
|
|
3733
|
-
* the Payment Request API. Frames that already exist are untouched: a frame's
|
|
3734
|
-
* policy is fixed when it is created. Stopping restores `createElement` when
|
|
3735
|
-
* nothing else has wrapped it since; otherwise the hook just stops acting.
|
|
3736
|
-
*/
|
|
3737
|
-
declare function denyPaymentPermissionToNewFrames(doc?: Document): () => void;
|
|
3738
|
-
|
|
3739
|
-
export { ASYNC_AUTO_CHECKOUT_CAPABILITY, type AVSFieldConfig, type AdvertisedPaymentMethod, 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, CHECKOUT_PROCESSING_TIMEOUT_MESSAGE, COUNTRY_OPTIONS, CURRENCY_MAP, type CaptureMethod, type CardCaptureAdapter, type CardCaptureEventType, type CardCaptureMountOptions, type CardCaptureOutcomeEvent, type CardCaptureProviderId, type CardSetupFutureUse, type CardSetupOverlaySource, type CardSetupThemeResolution, type CardSetupThemeSource, type CheckoutAccount, type CheckoutButtonMethod, type CheckoutDisplayData, type CheckoutFailureOutcome, type CheckoutGateway, type CheckoutGateways, type CheckoutItem, type CheckoutLogLayout, type CheckoutMetadata, type CheckoutMode, type CheckoutModeKind, type CheckoutProcessAvsInput, type CheckoutProcessError, type CheckoutProcessMetadataInput, type CheckoutProcessingPending, type CheckoutProduct, type CheckoutProductType, type CheckoutSession, type CheckoutSessionMode, type CheckoutSessionProduct, type CheckoutSessionResult, type CheckoutSubscription, type ClassifiedTelemetryFailure, type CountryOption, type CreateCardSetupSessionRequest, 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 DirectPayPalConfig, type DirectPayPalGatewaySource, type DisplayLineItem, EXTERNAL_METHOD_CALLBACK_GRACE_MS, type ExternalMethodFailureClassification, type ExternalMethodFailureContext, type ExternalMethodFailureDetails, FLAT_APPEARANCE, FLO_INSTRUMENT_CATALOG, FLO_INSTRUMENT_ONCE_NAMES, FLO_INSTRUMENT_SCHEMA_VERSION, FLO_SDK_CAPABILITIES_HEADER, FLO_SDK_VERSION_HEADER, type FloInstrumentErrorPhase, type FloInstrumentEvent, type FloInstrumentLifecycleName, type FloInstrumentSource, type FloPayAppearance, type FloPayConfig, type FloPayEnvironment, FloPayError, type FloPayErrorType, type FloPayPaymentCancelEvent, type FloPayThemeVariables, type FutureUseSessionFields, type FutureUseSurface, type FutureUseUnsupportedMethod, GLASS_DARK_APPEARANCE, GLASS_LIGHT_APPEARANCE, type GatewayEnvironment, IDEMPOTENCY_IN_PROGRESS_CODE, IDEMPOTENCY_KEY_HEADER, type InlineSessionDraft, type InlineSessionParams, type InlineSessionPatch, type LineItem, type ListSavedPaymentMethodsQuery, MAX_IDEMPOTENCY_KEY_LENGTH, MODERN_DARK_APPEARANCE, MODERN_LIGHT_APPEARANCE, NIGHT_APPEARANCE, type NonCardPaymentMethodCategory, type NormalizedCheckoutSession, type NormalizedGatewayEnvironment, PAYPAL_VAULTED_PAYMENT_METHOD_TYPE, type PayPalApprovalPresentation, type PayPalBrowserEnvironment, type PayPalBuyerIdentity, type PayPalPaymentResult, type PayPalProcessPaymentInput, type PayPalProviderObjectType, type PayPalSessionIntent, type PayPalSessionIntentRequest, type PaymentMethodRemovalConflictCode, type PaymentMethodRemovalConflictError, type PaymentMethodRemovalError, type PaymentMethodRemovalFailureReason, type PaymentMethodRemovalNotFoundError, type PaymentMethodRemovalRetryableError, type PaymentMethodSetupAdvertisement, type PaymentProviderAdapter, type PaymentResult, type PriceData, type PrimaryTileStyle, type PrimaryTileStyleSource, type PrimaryTileSubmitStyle, type ProcessPaymentParams, type ProcessingOverlayStatus, type ProcessingOverlayThemeColors, type RecurringInterval, SAVED_PAYMENT_METHOD_FAMILIES, SAVED_PAYMENT_METHOD_LIST_TYPES, SAVED_PAYMENT_METHOD_TYPES, SDK_VERSION, STORED_PAYMENT_METHOD_UNSUPPORTED_CODE, STORED_PAYMENT_METHOD_UNSUPPORTED_MESSAGE, STRIPE_EXPRESS_METHODS, STRIPE_METHOD_AMOUNT_LIMITS, STRIPE_METHOD_COUNTRIES, STRIPE_METHOD_CURRENCIES, STRIPE_METHOD_MATRIX, STRIPE_PAYPAL_RESUME_KEY, STRIPE_REDIRECT_PARAMS, SUPPORTED_CARD_BRANDS, type SavedCardDisplay, type SavedCardPaymentMethodDisplay, type SavedOtherPaymentMethodDisplay, type SavedPaymentMethodDisplay, type SavedPaymentMethodFamily, type SavedPaymentMethodListType, type SavedPaymentMethodStatus, type SavedPaymentMethodType, type SentryEventLike, type SentryStackFrameLike, type SerializeTelemetryBatchOptions, type SessionIntent, type SessionIntentDeclineRequest, type SetupOverlayWording, type StateOption, type StoredPaymentMethodOutcomeCode, type StripeMethodEntry, type StripeMethodThemeVariant, type StripePayPalResumeContinuation, type StripeSafeAppearance, 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, THREE_DS_CHALLENGE_WINDOW_MS, type TagsData, type TelemetryAppFamily, type TelemetryBatchEnvelope, type TelemetryCheckoutMode, type TelemetryDurationMode, type TelemetryErrorCode, type TelemetryErrorEvent, type TelemetryErrorReason, type TelemetryEvent, type TelemetryEventClass, type TelemetryExpectedOutcome, type TelemetryExpectedOutcomeEvent, type TelemetryFailureCategory, type TelemetryLayout, type TelemetryLogEvent, type TelemetryLogName, type TelemetryPaymentMethodCategory, type TelemetryPerformanceEvent, type TelemetryPopupCapability, type TelemetryPresentationMode, type TelemetryProvider, type TelemetryProviderInput, type TelemetryRequestCategory, type TelemetrySdkPackage, type TelemetryStage, type TelemetryStatusClass, type TelemetryTerminalReason, type ThemeBundle, type ThemeBundleId, type ThemeId, type TokenizedBody, US_STATES, UUID_V4, type UpdateCustomerParams, VAULT_CAPTURE_FORM_PATH, type VaultCaptureBlock, type VaultCaptureResultMessage, type VaultCardFieldKey, type VaultCardThemeColors, type VaultGradientStop, type VaultLinearGradientBackground, type VaultMountContext, type VaultShadowLayer, type VaultSolidBackground, type VaultSubmitBackground, type VaultSubmitButtonTheme, type VaultSubmitSpacing, type VaultSubmitTypography, type VaultThemeColor, type VaultThemeSource, WALLET_SHEET_WINDOW_TOO_SMALL_CODE, type WalletPresentation, type WebhookEvent, advertisedMethodKeys, advertisesAnyMethod, apiError, applyFriendlyMessageOverride, assertCaptureMethodEligible, authenticationError, buildCheckoutDisplayData, buildCheckoutProcessMetadata, buildExternalMethodRecoveryMessage, buildItemPayload, buildPayPalCancelEvent, buildPayPalProcessPaymentRequest, buildPayPalSessionIntentRequest, buildPayPalTokenizedBody, buildProcessPaymentAvsAccount, buildProcessPaymentAvsExposure, buildProductPayload, buildSubscriptionPayload, buildTelemetryErrorEvent, buildTelemetryLogEvent, buildTelemetryPerformanceEvent, buildTelemetryTerminalEvent, buildWalletSheetWindowMessage, canRecoverHostedCardForm, classifyExternalMethodFailure, classifyPaymentRejection, classifyTelemetryFailure, clearCachedInlineCheckout, clearCachedInlineSession, clearStripePayPalReturn, compactBuyerIdentity, computeCardSetupOverlayTheme, computeVaultCardThemeColors, configureFlopay, darkenHex, denyPaymentPermissionToNewFrames, derivePrimaryTileStyle, describePayPalProcessFailure, detectPayPalEnvironment, dropThirdPartyOnlyError, filterStripeMethodsByAmount, filterStripeMethodsByCountry, filterStripeMethodsByCountryGate, filterStripeMethodsByCurrency, foldIntoProducts, friendlyPayPalFailureMessage, generateIdempotencyKey, getButtonMethodLabel, getConfiguredBillingApiUrl, getCountryByCode, getCurrencyByCountry, getFloPayEnvironment, getPostalCodeExample, getPostalCodeLabel, getProviderDeclineCode, getProviderErrorCode, getStateFromPostalCode, getStateLabel, getStateOptions, getStripeMethodDisplayName, hasMatchingStripePayPalReturn, hasServerSideCardGateway, hasVendoredStripeMethodLogo, hashCreateParams, invokeMerchantCallback, isAVSEnabled, isAVSFieldVisible, isAuthorizationOnlySession, isCardHolderNamePlaceholder, isCardSetupCheckoutSession, isDetachedSessionEligible, isMoneySettledOutcome, isMountableVaultBlock, isPayPalAcknowledgementDeadWindow, isPayPalTeardownMessage, isPopupBlockedError, isPostalCodeSupported, isProviderDecline, isSetupCheckoutSession, isSetupIntentClientSecret, isUuidV4, isValidEmail, isValidPostalCode, isValidPublishableKey, isValidSecretKey, isVaultVerificationRequired, isWalletSheetRefusedForWindowSize, legacyCachedSessionMatchesDraft, markSessionRecentlyCompleted, mergeButtonsStyles, mergeCardSetupSurface, mergePayPalPayerIdentity, needsPayPalPayerDetails, needsStripeMethodExplicitConfirm, networkError, normalizeBeforeButtonClickError, normalizeCheckoutFailureOutcome, normalizeGatewayEnvironment, partitionStripeMethods, paypalProviderIdentityRequired, persistCachedInlineIdempotencyKey, persistCachedInlineSession, projectFloInstrument, randomUuidV4, rateLimitError, readCachedInlineIdempotencyKey, readCachedInlineSession, readMatchingStripePayPalContinuation, readPayPalPayerIdentity, readSetupAdvertisement, readStripeRedirectParams, resolveAVSConfig, resolveBillingApiUrl, resolveButtonsLayoutTheme, resolveCardSetupTheme, resolveCheckoutLogLayout, resolveDirectPaypalConfig, resolveIdempotencyKey, resolvePayPalApprovalIdentity, resolvePayPalDeclineReason, resolvePayPalPresentationMode, resolveSessionCurrency, resolveSetupFutureUsage, resolveStripeMethodBrandVariant, resolveStripePayPalPresentation, resolveTheme, resolveVaultMountOptions, resolveWalletModeOptions, sanitizeExternalFailureCode, serializeCreateParams, serializeTelemetryBatch, setupOverlayLabels, shouldPreferWalletPopup, splitFullName, stripeExpressMethodToOptionKey, stripeMethodCategory, stripeRedirectReturnUrl, telemetryStatusClass, toCssWeight, toStripeAppearance, toStripeAppearanceTheme, usesPayPalVaultedChannel, validationError, wasSessionRecentlyCompleted, writeStripePayPalContinuation };
|