@flopay/react 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/README.md +50 -2
- package/dist/automatic-payment-button.d.ts +81 -0
- package/dist/buyer-identity-fallback.d.ts +43 -0
- package/dist/card-button-content.d.ts +11 -0
- package/dist/card-setup-entry.d.ts +10 -104
- package/dist/card-setup-surface.d.ts +12 -0
- package/dist/card-setup-theme.d.ts +32 -0
- package/dist/checkout-utils.d.ts +163 -0
- package/dist/context.d.ts +46 -0
- package/dist/direct-paypal-button.d.ts +155 -0
- package/dist/error-banner.d.ts +21 -0
- package/dist/external-method-recovery.d.ts +1 -0
- package/dist/external-method-telemetry.d.ts +17 -0
- package/dist/{card-setup-entry.d.cts → flopay-card-setup.d.ts} +19 -11
- package/dist/flopay-checkout.d.ts +239 -0
- package/dist/flopay-payment-method-setup-main.d.ts +10 -0
- package/dist/flopay-payment-method-setup.d.ts +11 -0
- package/dist/hooks.d.ts +36 -0
- package/dist/in-app-browser.d.ts +5 -0
- package/dist/index.d.ts +20 -921
- package/dist/inline-session-cache.d.ts +1 -0
- package/dist/instruments.d.ts +5 -0
- package/dist/merchant-callback.d.ts +1 -0
- package/dist/payment-logos.generated.d.ts +1 -0
- package/dist/payment-method-setup-advertisement.d.ts +36 -0
- package/dist/payment-method-setup-entry.d.ts +12 -14
- package/dist/payment-method-setup-paypal.d.ts +25 -0
- package/dist/payment-method-setup-stripe.d.ts +31 -0
- package/dist/{payment-method-setup-surface-DWGNLM0I.d.cts → payment-method-setup-surface.d.ts} +27 -9
- package/dist/popup-capability.d.ts +12 -0
- package/dist/processing-overlay.d.ts +33 -0
- package/dist/provider.d.ts +40 -0
- package/dist/recent-completion.d.ts +1 -0
- package/dist/run-latest-abortable-action.d.ts +5 -0
- package/dist/saved-payment-flow.d.ts +124 -0
- package/dist/split-card-form.d.ts +319 -0
- package/dist/stripe-method-presentation.d.ts +115 -0
- package/dist/telemetry-bridge.d.ts +41 -0
- package/dist/use-external-attempt-reconciliation.d.ts +27 -0
- package/dist/use-isomorphic-layout-effect.d.ts +3 -0
- package/dist/vault-card-fields.d.ts +95 -0
- package/dist/vault-theme.d.ts +1 -0
- package/package.json +6 -6
- package/dist/index.d.cts +0 -921
- package/dist/payment-method-setup-entry.d.cts +0 -16
- package/dist/payment-method-setup-surface-B9TI-00C.d.ts +0 -72
package/dist/index.d.cts
DELETED
|
@@ -1,921 +0,0 @@
|
|
|
1
|
-
import * as _flopay_shared from '@flopay/shared';
|
|
2
|
-
import { InlineSessionDraft, CheckoutButtonMethod, CheckoutProduct, CheckoutItem, CheckoutSubscription, ThemeId, FloPayAppearance, ButtonsLayoutTheme, ButtonsLayoutStyles, PaymentResult, CheckoutSession, FloPayError, DeclineEvent, InlineSessionPatch, GatewayEnvironment, PayPalProviderObjectType, PayPalApprovalPresentation, TokenizedBody, FloPayPaymentCancelEvent, TelemetryPresentationMode, TelemetryTerminalReason, FloInstrumentEvent, WalletPresentation, BeforeButtonClickEvent, CheckoutMode, AVSFieldConfig, CardCaptureAdapter, VaultCardThemeColors } from '@flopay/shared';
|
|
3
|
-
export { BeforeButtonClickEvent, CheckoutButtonMethod, DeclineEvent, FloInstrumentEvent, FloPayPaymentCancelEvent, InlineSessionDraft, InlineSessionPatch, SentryEventLike, SentryStackFrameLike, WalletPresentation, dropThirdPartyOnlyError } from '@flopay/shared';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
export { FloPayCardSetup, FloPayCardSetupCancelEvent, FloPayCardSetupCompleteEvent, FloPayCardSetupDeclineEvent, FloPayCardSetupError, FloPayCardSetupProps } from './card-setup-entry.cjs';
|
|
6
|
-
import { F as FloPayPaymentMethodSetupProps } from './payment-method-setup-surface-DWGNLM0I.cjs';
|
|
7
|
-
export { a as FloPayPaymentMethodSetupCancelEvent, b as FloPayPaymentMethodSetupCompleteEvent, c as FloPayPaymentMethodSetupDeclineEvent } from './payment-method-setup-surface-DWGNLM0I.cjs';
|
|
8
|
-
import { FloPay } from '@flopay/js';
|
|
9
|
-
|
|
10
|
-
interface FloPayAutomaticPaymentSuccessEvent {
|
|
11
|
-
result: PaymentResult;
|
|
12
|
-
session: CheckoutSession | null;
|
|
13
|
-
sessionId: string | null;
|
|
14
|
-
autoCompleted: boolean;
|
|
15
|
-
}
|
|
16
|
-
interface FloPayAutomaticPaymentButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children' | 'onError'> {
|
|
17
|
-
sessionId?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Session-bound checkout token for a consumer-supplied {@link sessionId}
|
|
20
|
-
* (the `nonce` returned when that session was created). Post-#640 backends
|
|
21
|
-
* require it as `x-checkout-session-token` to read the session and to
|
|
22
|
-
* `/process` it; without it the existing-session path 401s with
|
|
23
|
-
* "Missing checkout session token.". Ignored on the create-session path,
|
|
24
|
-
* where the SDK mints and threads the nonce itself.
|
|
25
|
-
*/
|
|
26
|
-
nonce?: string;
|
|
27
|
-
createSession?: InlineSessionDraft;
|
|
28
|
-
/**
|
|
29
|
-
* @deprecated Ignored. The backend now picks the customer's most recent
|
|
30
|
-
* vaulted payment method via `getLatestByUserId` and rebinds the session's
|
|
31
|
-
* gateway to match it (see `apps/api`'s `createSingle` auto-checkout
|
|
32
|
-
* branch). Passing this prop has no effect — it is retained only to avoid
|
|
33
|
-
* breaking existing integrations.
|
|
34
|
-
*/
|
|
35
|
-
paymentMethodId?: string;
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Ignored. The backend orchestrates gateway routing — clients
|
|
38
|
-
* no longer choose between card and PayPal at the SDK boundary. Passing
|
|
39
|
-
* this prop has no effect.
|
|
40
|
-
*/
|
|
41
|
-
checkoutMethod?: CheckoutButtonMethod;
|
|
42
|
-
clientId?: string;
|
|
43
|
-
/**
|
|
44
|
-
* Unified products array (TeamFloPay/backend#760). When supplied,
|
|
45
|
-
* `items`/`subscriptions` are ignored. The SDK folds the legacy fields
|
|
46
|
-
* into this shape internally.
|
|
47
|
-
*/
|
|
48
|
-
products?: CheckoutProduct[];
|
|
49
|
-
items?: CheckoutItem[];
|
|
50
|
-
subscriptions?: CheckoutSubscription[];
|
|
51
|
-
account?: InlineSessionDraft['account'];
|
|
52
|
-
successUrl?: string;
|
|
53
|
-
cancelUrl?: string;
|
|
54
|
-
couponCodes?: string[];
|
|
55
|
-
tagsData?: InlineSessionDraft['tagsData'];
|
|
56
|
-
utmMetadata?: InlineSessionDraft['utmMetadata'];
|
|
57
|
-
billingApiUrl?: string;
|
|
58
|
-
locale?: string;
|
|
59
|
-
/**
|
|
60
|
-
* High-level theme bundle that styles the button (and the fallback
|
|
61
|
-
* `FloPayCheckout` modal that opens when the saved-payment charge needs
|
|
62
|
-
* user interaction). One of: `'classic'`, `'modern-light'`, `'modern-dark'`,
|
|
63
|
-
* `'bold-light'`, `'bold-dark'`, `'glass-light'`, `'glass-dark'`. Explicit
|
|
64
|
-
* `buttonsStyles` still wins for fine-grained overrides.
|
|
65
|
-
*/
|
|
66
|
-
theme?: ThemeId;
|
|
67
|
-
/**
|
|
68
|
-
* Per-checkout appearance overrides layered on top of the chosen `theme`
|
|
69
|
-
* (same shape as {@link FloPayCheckout}'s `appearance`). Its `colorPrimary` /
|
|
70
|
-
* `colorPrimaryHover` / `borderRadius` re-skin the button — and the fallback
|
|
71
|
-
* `FloPayCheckout` modal — so the auto-pay button matches the rest of the
|
|
72
|
-
* themed checkout. Without this the button only saw the bundle's defaults.
|
|
73
|
-
*/
|
|
74
|
-
appearance?: FloPayAppearance;
|
|
75
|
-
/**
|
|
76
|
-
* @deprecated Use `theme` instead. Legacy buttons-layout preset
|
|
77
|
-
* (`'default' | 'minimal' | 'rounded' | 'dark'`). Still honored for
|
|
78
|
-
* back-compat.
|
|
79
|
-
*/
|
|
80
|
-
buttonsTheme?: ButtonsLayoutTheme;
|
|
81
|
-
buttonsStyles?: ButtonsLayoutStyles;
|
|
82
|
-
onSuccess?: (event: FloPayAutomaticPaymentSuccessEvent) => void;
|
|
83
|
-
onError?: (error: FloPayError) => void;
|
|
84
|
-
onDecline?: (decline: DeclineEvent) => void;
|
|
85
|
-
children?: React.ReactNode;
|
|
86
|
-
}
|
|
87
|
-
declare function FloPayAutomaticPaymentButton({ sessionId, nonce, createSession, paymentMethodId: _deprecatedPaymentMethodId, checkoutMethod: _deprecatedCheckoutMethod, clientId, products, items, subscriptions, account, successUrl, cancelUrl, couponCodes, tagsData, utmMetadata, billingApiUrl, locale, theme, appearance, buttonsTheme, buttonsStyles: stylesOverride, onSuccess, onError, onDecline, children, disabled, type, style, ...buttonProps }: FloPayAutomaticPaymentButtonProps): React.JSX.Element;
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Overrides that `SplitCardForm`'s tokenized-body dispatcher uses to apply a
|
|
91
|
-
* `runBeforeButtonClick` patch to the in-flight processPayment call. Kept in
|
|
92
|
-
* sync structurally with `TokenizedBodyOverrides` in `split-card-form.tsx`.
|
|
93
|
-
*/
|
|
94
|
-
interface DirectPayPalTokenizedOverrides {
|
|
95
|
-
accountPatch?: InlineSessionPatch['account'];
|
|
96
|
-
sessionId?: string;
|
|
97
|
-
nonce?: string;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Internal handler signature aligned with `SplitCardForm`'s tokenized-body
|
|
101
|
-
* dispatcher. Direct PayPal completes via the backend's process endpoint and
|
|
102
|
-
* never produces a Stripe PaymentIntent, so we still forward a synthetic
|
|
103
|
-
* `TokenizedBody` describing the captured order, optionally with the
|
|
104
|
-
* session/account patch captured at click-time.
|
|
105
|
-
*/
|
|
106
|
-
type DirectPayPalTokenizedHandler = (body: TokenizedBody, overrides?: DirectPayPalTokenizedOverrides) => void;
|
|
107
|
-
/** Click-time `runBeforeButtonClick` result, structurally compatible with `SplitCardForm`. */
|
|
108
|
-
interface DirectPayPalBeforeButtonClickResult {
|
|
109
|
-
proceed: boolean;
|
|
110
|
-
accountPatch?: InlineSessionPatch['account'];
|
|
111
|
-
sessionId?: string;
|
|
112
|
-
nonce?: string;
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* Click-time gate. Mirrors `RunBeforeButtonClick` in `SplitCardForm`: lets the
|
|
116
|
-
* consumer patch the session/account before PayPal creates the order, and lets
|
|
117
|
-
* them abort the click entirely by returning `proceed: false`.
|
|
118
|
-
*/
|
|
119
|
-
type DirectPayPalRunBeforeButtonClick = (method: CheckoutButtonMethod) => Promise<DirectPayPalBeforeButtonClickResult>;
|
|
120
|
-
type DirectPayPalInitializationState = 'loading' | 'retrying' | 'ready' | 'exhausted';
|
|
121
|
-
interface DirectPayPalTechnicalFailureOptions {
|
|
122
|
-
code?: string;
|
|
123
|
-
popupBlocked?: boolean;
|
|
124
|
-
telemetryReported?: boolean;
|
|
125
|
-
provider?: 'paypal';
|
|
126
|
-
paymentMethodCategory?: 'paypal';
|
|
127
|
-
presentationMode?: TelemetryPresentationMode;
|
|
128
|
-
terminalReason?: TelemetryTerminalReason;
|
|
129
|
-
}
|
|
130
|
-
type DirectPayPalTechnicalFailureHandler = (method: 'paypal', err: unknown, options?: DirectPayPalTechnicalFailureOptions) => void;
|
|
131
|
-
interface DirectPayPalButtonProps {
|
|
132
|
-
/** Checkout session ID. */
|
|
133
|
-
sessionId: string;
|
|
134
|
-
/**
|
|
135
|
-
* Session-bound checkout token returned by session creation. Forwarded as
|
|
136
|
-
* `x-checkout-session-token` on every continuation request — required by
|
|
137
|
-
* post-#640 backends. `FloPayCheckout` plumbs this prop automatically.
|
|
138
|
-
*/
|
|
139
|
-
nonce?: string;
|
|
140
|
-
/** Billing API base URL. */
|
|
141
|
-
billingApiUrl: string;
|
|
142
|
-
/** Buyer email. */
|
|
143
|
-
email?: string;
|
|
144
|
-
/** Buyer name already attached to the checkout, when available. */
|
|
145
|
-
billingName?: string;
|
|
146
|
-
/** Attaches buyer identity collected from PayPal before checkout continues. */
|
|
147
|
-
onBuyerIdentityReady?: (identity: NonNullable<InlineSessionPatch['account']>) => void | Promise<void>;
|
|
148
|
-
/** PayPal client identifier (`gateways.paypal.publishableKey`). */
|
|
149
|
-
clientId: string;
|
|
150
|
-
/** Gateway environment, drives the sandbox/live SDK script. */
|
|
151
|
-
environment?: GatewayEnvironment;
|
|
152
|
-
/** ISO 4217 currency code. */
|
|
153
|
-
currency: string;
|
|
154
|
-
/** Whether the session is a subscription (drives intent + flow selection). */
|
|
155
|
-
isSubscription: boolean;
|
|
156
|
-
/**
|
|
157
|
-
* @deprecated Pass the backing {@link DirectPayPalButtonProps.session}; its
|
|
158
|
-
* `gateways.paypal.providerObjectType` advertisement is authoritative. This
|
|
159
|
-
* prop remains as a fallback for integrations that have not yet forwarded
|
|
160
|
-
* the session. When neither source advertises a provider object, legacy
|
|
161
|
-
* sessions continue to derive the flow from `isSubscription`.
|
|
162
|
-
*/
|
|
163
|
-
providerObjectType?: PayPalProviderObjectType;
|
|
164
|
-
/**
|
|
165
|
-
* Backend-advertised approval presentation. The backing session value is
|
|
166
|
-
* authoritative when both are supplied. No return URL can be provided here.
|
|
167
|
-
*/
|
|
168
|
-
approvalPresentation?: PayPalApprovalPresentation;
|
|
169
|
-
/**
|
|
170
|
-
* If provided, called with the tokenized body once PayPal capture
|
|
171
|
-
* completes. When omitted, the component processes payment internally.
|
|
172
|
-
*/
|
|
173
|
-
onTokenizedBody?: DirectPayPalTokenizedHandler;
|
|
174
|
-
/** Called when the full self-contained payment flow succeeds. */
|
|
175
|
-
onComplete?: (result: PaymentResult) => void;
|
|
176
|
-
/** Called when an error occurs. */
|
|
177
|
-
onErrorChange?: (error: string | null) => void;
|
|
178
|
-
/** Decline emitter (mirrors SplitCardForm semantics). */
|
|
179
|
-
onDecline?: (decline: DeclineEvent) => void;
|
|
180
|
-
/**
|
|
181
|
-
* Called once when the buyer closes or leaves PayPal without approving (pop-up
|
|
182
|
-
* or app switch). Never called for an approval, a decline or a technical failure.
|
|
183
|
-
*/
|
|
184
|
-
onCancel?: (event: FloPayPaymentCancelEvent) => void;
|
|
185
|
-
/** Called for post-click technical failures before PayPal authorization completes. */
|
|
186
|
-
onTechnicalFailure?: DirectPayPalTechnicalFailureHandler;
|
|
187
|
-
/** External processing state. */
|
|
188
|
-
isProcessing?: boolean;
|
|
189
|
-
/** Notify the parent of the loading state for placeholder swapping. */
|
|
190
|
-
onLoadStateChange?: (ready: boolean) => void;
|
|
191
|
-
/** Notify a PayPal-only wrapper about pre-render recovery state. */
|
|
192
|
-
onInitializationStateChange?: (state: DirectPayPalInitializationState) => void;
|
|
193
|
-
/** Disable the automatic retry for a buyer-initiated single manual attempt. */
|
|
194
|
-
allowAutomaticRetry?: boolean;
|
|
195
|
-
/** Tracks button-click for analytics. */
|
|
196
|
-
onButtonClick?: (method: CheckoutButtonMethod) => void;
|
|
197
|
-
/**
|
|
198
|
-
* Click-time gate (runs before PayPal creates the order). When provided, the
|
|
199
|
-
* returned patch is applied to the in-flight create-intent and tokenized
|
|
200
|
-
* dispatch so callers using `onBeforeButtonClick` see the same session/email
|
|
201
|
-
* the Stripe-rendered PayPal flow does.
|
|
202
|
-
*/
|
|
203
|
-
runBeforeButtonClick?: DirectPayPalRunBeforeButtonClick;
|
|
204
|
-
/** Backing session — used for self-contained accountData population. */
|
|
205
|
-
session?: CheckoutSession | null;
|
|
206
|
-
/**
|
|
207
|
-
* Pre-existing PayPal Order id (or Subscription id when `isSubscription` is
|
|
208
|
-
* true) to bind the button to. When set, the button skips its usual
|
|
209
|
-
* session-scoped create-intent round-trip on click and feeds this
|
|
210
|
-
* id straight into PayPal's create-order / create-subscription callback.
|
|
211
|
-
*
|
|
212
|
-
* Used by `SplitCardForm`'s `paypal_direct_required` retry path: backend
|
|
213
|
-
* creates a fresh PayPal order after a stalled process attempt and returns
|
|
214
|
-
* its id; the SDK re-renders this button bound to that id so the buyer can
|
|
215
|
-
* confirm with one more click without the backend re-creating the order on
|
|
216
|
-
* each retry.
|
|
217
|
-
*
|
|
218
|
-
* Changing this value remounts the PayPal SDK so the new createOrder
|
|
219
|
-
* binding takes effect (PayPal's render() options aren't live-updatable).
|
|
220
|
-
*/
|
|
221
|
-
existingOrderId?: string;
|
|
222
|
-
/** Flo-owned privacy-safe telemetry is enabled by default; set `false` to opt out. */
|
|
223
|
-
telemetry?: boolean;
|
|
224
|
-
/**
|
|
225
|
-
* When true, renders an on-screen lifecycle tracer panel above the button
|
|
226
|
-
* (mount, loadScript, eligibility, render, errors). Intended for debugging
|
|
227
|
-
* in-app browsers (Facebook IAB, etc.) where remote console access is
|
|
228
|
-
* impractical. Off by default — leave disabled in production.
|
|
229
|
-
*/
|
|
230
|
-
debug?: boolean;
|
|
231
|
-
}
|
|
232
|
-
/** Public direct-PayPal surface: telemetry accepts only the boolean opt-out. */
|
|
233
|
-
declare function DirectPayPalButton(props: DirectPayPalButtonProps): React.ReactElement | null;
|
|
234
|
-
|
|
235
|
-
/** Props for the all-in-one `FloPayCheckout` wrapper. */
|
|
236
|
-
interface FloPayCheckoutProps {
|
|
237
|
-
/** The checkout session ID (UUID from billing API). Required unless `createSession` is provided. */
|
|
238
|
-
sessionId?: string;
|
|
239
|
-
/**
|
|
240
|
-
* Session-bound checkout token (the `nonce` returned when the session was
|
|
241
|
-
* created). Sent as the `x-checkout-session-token` header when fetching a
|
|
242
|
-
* session by `sessionId`. Required by post-#640 backends, which no longer
|
|
243
|
-
* let the UUID alone authorize a session read; harmless on older backends.
|
|
244
|
-
* Only consulted in the `sessionId` flow — inline `createSession` sessions
|
|
245
|
-
* carry their own freshly-minted nonce server-side.
|
|
246
|
-
*/
|
|
247
|
-
nonce?: string;
|
|
248
|
-
/**
|
|
249
|
-
* Create a checkout session inline — no separate API route needed.
|
|
250
|
-
* The component POSTs to the billing API, gets the full session back, and renders the form.
|
|
251
|
-
* Alternative to `sessionId` (provide one or the other).
|
|
252
|
-
*/
|
|
253
|
-
createSession?: InlineSessionDraft;
|
|
254
|
-
/** Billing API base URL. Defaults to the shared `BILLING_API_URL` constant. */
|
|
255
|
-
billingApiUrl?: string;
|
|
256
|
-
/** Flo-owned privacy-safe telemetry is enabled by default; set `false` to opt out. */
|
|
257
|
-
telemetry?: boolean;
|
|
258
|
-
/** Visual appearance for payment elements. */
|
|
259
|
-
appearance?: FloPayAppearance;
|
|
260
|
-
/** Locale for payment elements (default: 'auto'). */
|
|
261
|
-
locale?: string;
|
|
262
|
-
/** Custom loading UI. Defaults to a simple centered spinner. */
|
|
263
|
-
loading?: React.ReactNode;
|
|
264
|
-
/** Custom error UI. Receives the error. Defaults to showing the error message. */
|
|
265
|
-
error?: (error: FloPayError) => React.ReactNode;
|
|
266
|
-
/** Called when the full payment flow completes successfully. */
|
|
267
|
-
onComplete?: (result: PaymentResult) => void;
|
|
268
|
-
/** Called when a payment error occurs. */
|
|
269
|
-
onError?: (error: FloPayError) => void;
|
|
270
|
-
/** Receives the versioned, privacy-safe checkout instrument feed. */
|
|
271
|
-
onInstrument?: (event: FloInstrumentEvent) => void;
|
|
272
|
-
/** Called when a payment is declined or the authentication step fails. */
|
|
273
|
-
onDecline?: (decline: DeclineEvent) => void;
|
|
274
|
-
/**
|
|
275
|
-
* Called once when the buyer closes or leaves the direct PayPal button's
|
|
276
|
-
* PayPal window without approving. Never called for an approval, a decline
|
|
277
|
-
* or a technical failure, nor for Stripe-rendered PayPal.
|
|
278
|
-
*/
|
|
279
|
-
onCancel?: (event: FloPayPaymentCancelEvent) => void;
|
|
280
|
-
/** Called when the AVS country dropdown changes. */
|
|
281
|
-
onCountryChange?: (country: string) => void;
|
|
282
|
-
/** Called when the AVS ZIP/postcode input changes. */
|
|
283
|
-
onZipChange?: (zip: string) => void;
|
|
284
|
-
/**
|
|
285
|
-
* Show the PayPal payment surface (default: `true`). Renderer is chosen
|
|
286
|
-
* from `gateways.paypal` on the session — DirectPayPalButton when present,
|
|
287
|
-
* Stripe-rendered PayPal otherwise.
|
|
288
|
-
*/
|
|
289
|
-
showPayPal?: boolean;
|
|
290
|
-
/**
|
|
291
|
-
* Show Stripe-rendered wallets/APMs alongside the vault-hosted card surface
|
|
292
|
-
* (default: `true`). When `false`, only
|
|
293
|
-
* `DirectPayPalButton` can render. Both `showStripe=false` and
|
|
294
|
-
* `showPayPal=false` (with no PayPal gateway configured) triggers a
|
|
295
|
-
* bootstrap-time validation error.
|
|
296
|
-
*/
|
|
297
|
-
showStripe?: boolean;
|
|
298
|
-
/**
|
|
299
|
-
* Preferred approval presentation for supported wallets. Defaults to
|
|
300
|
-
* `'auto'`. Safety signals and provider capability remain authoritative.
|
|
301
|
-
*/
|
|
302
|
-
walletPresentation?: WalletPresentation;
|
|
303
|
-
/**
|
|
304
|
-
* Override the wallet/APM list the session advertises via
|
|
305
|
-
* `gateways.stripe.enabledPaymentMethods`. Omit (the default) and the
|
|
306
|
-
* backend's per-session list is used, which is what a normal integration
|
|
307
|
-
* wants.
|
|
308
|
-
*
|
|
309
|
-
* Pass an explicit list to narrow it, or `[]` to render the hosted card form
|
|
310
|
-
* on its own — the empty array means "no methods enabled", not "fall back to
|
|
311
|
-
* the backend list". This is the supported way to get a card-only checkout:
|
|
312
|
-
* `showStripe={false}` also gates the vault, so it takes the card form down
|
|
313
|
-
* with the wallets.
|
|
314
|
-
*
|
|
315
|
-
* Narrowing only. Naming a method the backend hasn't enabled for the session
|
|
316
|
-
* will not turn it on.
|
|
317
|
-
*/
|
|
318
|
-
enabledPaymentMethods?: string[];
|
|
319
|
-
/**
|
|
320
|
-
* @deprecated Apple Pay availability is now driven by
|
|
321
|
-
* `gateways.stripe.enabledPaymentMethods` on the per-session response from
|
|
322
|
-
* the billing API. Setting this prop emits a one-time deprecation warning
|
|
323
|
-
* and is otherwise ignored once the backend ships the list.
|
|
324
|
-
*/
|
|
325
|
-
showApplePay?: boolean;
|
|
326
|
-
/**
|
|
327
|
-
* @deprecated See {@link FloPayCheckoutProps.showApplePay}.
|
|
328
|
-
*/
|
|
329
|
-
showGooglePay?: boolean;
|
|
330
|
-
/**
|
|
331
|
-
* Enables on-screen diagnostic panels (PayPal gate decision, DirectPayPalButton
|
|
332
|
-
* lifecycle). Intended for debugging in-app browsers (Facebook, Instagram, etc.)
|
|
333
|
-
* where remote console access is impractical. Off by default.
|
|
334
|
-
*/
|
|
335
|
-
debug?: boolean;
|
|
336
|
-
/** Layout mode: 'default' (all visible) or 'buttons' (PayPal/wallets + expandable card form). */
|
|
337
|
-
layout?: 'default' | 'buttons';
|
|
338
|
-
/**
|
|
339
|
-
* High-level theme bundle that styles non-card Stripe Elements, the FloPay
|
|
340
|
-
* wrapper / AVS inputs, and the hosted vault widget. One of: `'classic'`
|
|
341
|
-
* (historic FloPay look, no bundle applied), `'modern-light'`, `'modern-dark'`,
|
|
342
|
-
* `'bold-light'`, `'bold-dark'`, `'glass-light'`, `'glass-dark'`. Explicit
|
|
343
|
-
* `appearance` / `buttonsStyles` props still override their respective
|
|
344
|
-
* halves when supplied.
|
|
345
|
-
*/
|
|
346
|
-
theme?: _flopay_shared.ThemeId;
|
|
347
|
-
/**
|
|
348
|
-
* @deprecated Use `theme` instead. Legacy buttons-layout preset
|
|
349
|
-
* (`'default' | 'minimal' | 'rounded' | 'dark'`). Still honored for
|
|
350
|
-
* back-compat.
|
|
351
|
-
*/
|
|
352
|
-
buttonsTheme?: _flopay_shared.ButtonsLayoutTheme;
|
|
353
|
-
/** Style overrides merged on top of the resolved theme bundle / buttonsTheme preset. */
|
|
354
|
-
buttonsStyles?: _flopay_shared.ButtonsLayoutStyles;
|
|
355
|
-
/** Custom React content rendered inside the card button when `layout="buttons"`. */
|
|
356
|
-
cardButtonContent?: React.ReactNode;
|
|
357
|
-
/** Custom React content rendered for the buttons-layout card back button label. */
|
|
358
|
-
cardBackButtonContent?: React.ReactNode;
|
|
359
|
-
/** Custom React content rendered for the card-form title. */
|
|
360
|
-
cardTitleContent?: React.ReactNode;
|
|
361
|
-
/**
|
|
362
|
-
* @deprecated No longer rendered — the default-layout security footer was
|
|
363
|
-
* removed alongside the theme-bundle refactor. Retained as an optional
|
|
364
|
-
* prop so existing integrations type-check without changes.
|
|
365
|
-
*/
|
|
366
|
-
showSecurityFooter?: boolean;
|
|
367
|
-
/**
|
|
368
|
-
* Called when a payment method button is clicked.
|
|
369
|
-
* `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
|
|
370
|
-
*/
|
|
371
|
-
onButtonClick?: (method: CheckoutButtonMethod) => void;
|
|
372
|
-
/**
|
|
373
|
-
* Called before a payment button continues in `layout="buttons"`.
|
|
374
|
-
* Runs for card, PayPal, Apple Pay, and Google Pay.
|
|
375
|
-
* In `layout="buttons"` with `createSession`, the returned patch is merged
|
|
376
|
-
* into the inline session params before the selected flow continues.
|
|
377
|
-
*/
|
|
378
|
-
onBeforeButtonClick?: (event: BeforeButtonClickEvent) => undefined | false | Promise<undefined | false | InlineSessionPatch> | InlineSessionPatch;
|
|
379
|
-
/**
|
|
380
|
-
* Enable AVS (Address Verification).
|
|
381
|
-
* - `true` — show country + postal code (backward compatible default)
|
|
382
|
-
* - `AVSFieldConfig` — granular per-field control, optionally scoped to country codes
|
|
383
|
-
* - `false` / omitted — AVS disabled
|
|
384
|
-
*/
|
|
385
|
-
enableAVS?: boolean | _flopay_shared.AVSFieldConfig;
|
|
386
|
-
/**
|
|
387
|
-
* Per-merchant order of the hosted vault card rows — a permutation of
|
|
388
|
-
* `['name','number','expiry']` (`'expiry'` = the expiry+CVV row; submit stays
|
|
389
|
-
* last). Sets both the visual and tab order. Omit for the default
|
|
390
|
-
* (`name`, `number`, `expiry`). Vault card path only.
|
|
391
|
-
*/
|
|
392
|
-
cardFieldOrder?: _flopay_shared.VaultCardFieldKey[];
|
|
393
|
-
/**
|
|
394
|
-
* Content rendered directly above the hosted vault card widget (below the
|
|
395
|
-
* "or pay with card" divider). Used by the demo playground to surface a
|
|
396
|
-
* test-cards helper; harmless to omit in a normal integration.
|
|
397
|
-
*/
|
|
398
|
-
cardPreFormSlot?: React.ReactNode;
|
|
399
|
-
/** Layout for AVS fields: 'row' (side-by-side, default) or 'column' (stacked). */
|
|
400
|
-
avsLayout?: 'row' | 'column';
|
|
401
|
-
/**
|
|
402
|
-
* Final wording for the hosted card form's submit button in full checkout
|
|
403
|
-
* (billing API v1.9.35+), e.g. `'Pay $10'`. Pass final, already-localized
|
|
404
|
-
* plain text from your own order summary — the SDK does not format amounts
|
|
405
|
-
* or translate. Updates apply live without remounting the card form or
|
|
406
|
-
* clearing entered card details; omitting or clearing it (or passing `null`
|
|
407
|
-
* or blank text) shows the hosted default, `CONFIRM PAYMENT`. Direct
|
|
408
|
-
* custom-layout children receive it unless they set their own `submitLabel`.
|
|
409
|
-
*
|
|
410
|
-
* Only the hosted card submit button changes: `confirmLabel` still owns the
|
|
411
|
-
* saved-payment confirm button, `cardButtonContent` the buttons-layout card
|
|
412
|
-
* tile, and wallet, PayPal, processing, and retry wording is unchanged.
|
|
413
|
-
*/
|
|
414
|
-
submitLabel?: string | null;
|
|
415
|
-
/** Additional CSS class for the wrapper. */
|
|
416
|
-
className?: string;
|
|
417
|
-
/** Seed an initial checkout error message for the rendered payment form. */
|
|
418
|
-
initialErrorMessage?: string | null;
|
|
419
|
-
/** Resume a backend-created PayPal Order/Subscription instead of creating another one. */
|
|
420
|
-
initialPayPalOrderId?: string;
|
|
421
|
-
/**
|
|
422
|
-
* Override the default `SplitCardForm`. When provided, children are rendered
|
|
423
|
-
* inside the initialized `FloPayProvider` with session props auto-injected.
|
|
424
|
-
*/
|
|
425
|
-
children?: React.ReactNode;
|
|
426
|
-
/**
|
|
427
|
-
* Override the session's checkoutMode.
|
|
428
|
-
* - `'full'` — show payment form (default)
|
|
429
|
-
* - `'confirm'` — show confirm button, uses saved payment method
|
|
430
|
-
* - `'auto'` — auto-submit with saved PM, falls back to `'full'` on failure
|
|
431
|
-
*/
|
|
432
|
-
checkoutMode?: CheckoutMode;
|
|
433
|
-
/**
|
|
434
|
-
* Label for the saved-payment confirm button in `confirm` mode. Default:
|
|
435
|
-
* `'Confirm Purchase'`. Full checkout's hosted card button uses
|
|
436
|
-
* {@link FloPayCheckoutProps.submitLabel} instead.
|
|
437
|
-
*/
|
|
438
|
-
confirmLabel?: string;
|
|
439
|
-
/** Custom confirm button renderer for `confirm` mode. */
|
|
440
|
-
renderConfirmButton?: (props: {
|
|
441
|
-
onConfirm: () => void;
|
|
442
|
-
isProcessing: boolean;
|
|
443
|
-
}) => React.ReactNode;
|
|
444
|
-
/** Called when the session has already been completed. Receives the successUrl. */
|
|
445
|
-
onSessionCompleted?: (successUrl: string) => void;
|
|
446
|
-
/**
|
|
447
|
-
* @deprecated No longer used. The Stripe publishable key is sourced exclusively
|
|
448
|
-
* from the checkout session's `gateways.stripe.publishableKey`. Accepted only
|
|
449
|
-
* for backward compatibility with older consumer code — the value is ignored.
|
|
450
|
-
*/
|
|
451
|
-
fallbackPublishableKey?: string;
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* All-in-one checkout component. Fetches the session, initializes the
|
|
455
|
-
* payment provider, and renders the appropriate UI based on checkout mode.
|
|
456
|
-
*
|
|
457
|
-
* **Modes:**
|
|
458
|
-
* - `full` (default) — renders hosted-vault card capture, wallets, APMs, and PayPal
|
|
459
|
-
* - `confirm` — renders a "Confirm Purchase" button, uses saved payment method
|
|
460
|
-
* - `auto` — auto-submits with saved PM, falls back to `full` on failure
|
|
461
|
-
*
|
|
462
|
-
* ```tsx
|
|
463
|
-
* <FloPayCheckout
|
|
464
|
-
* sessionId="sess_abc123"
|
|
465
|
-
* onComplete={(result) => router.push('/success')}
|
|
466
|
-
* onError={(err) => console.error(err)}
|
|
467
|
-
* />
|
|
468
|
-
* ```
|
|
469
|
-
*/
|
|
470
|
-
declare function FloPayCheckout({ sessionId: sessionIdProp, nonce: nonceProp, createSession: createSessionParams, billingApiUrl, telemetry, appearance: appearanceOverride, locale, loading: loadingNode, error: errorNode, onComplete, onError, onInstrument, onDecline, onCancel, onCountryChange, onZipChange, showPayPal, showStripe, walletPresentation, enabledPaymentMethods: enabledPaymentMethodsProp, showApplePay, showGooglePay, debug, layout, theme, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter: _showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, cardFieldOrder, cardPreFormSlot, avsLayout, submitLabel, className, initialErrorMessage, initialPayPalOrderId, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* Renders every payment method a setup session advertises — the hosted card
|
|
474
|
-
* widget, Stripe wallets/APMs in setup mode, and the PayPal vault flow — and
|
|
475
|
-
* saves the buyer's choice without a purchase. The advertisement is the single
|
|
476
|
-
* source of truth.
|
|
477
|
-
*/
|
|
478
|
-
declare function FloPayPaymentMethodSetup(props: FloPayPaymentMethodSetupProps): React.ReactElement;
|
|
479
|
-
|
|
480
|
-
/**
|
|
481
|
-
* Returns the current `FloPay` instance, or `null` if the provider
|
|
482
|
-
* is still loading (i.e. the `loadFloPay()` promise has not resolved yet).
|
|
483
|
-
*
|
|
484
|
-
* Must be called within a `<FloPayProvider>`.
|
|
485
|
-
*/
|
|
486
|
-
declare function useFloPay(): FloPay | null;
|
|
487
|
-
/**
|
|
488
|
-
* Returns the Stripe `FloPay` instance dedicated to the Stripe-rendered
|
|
489
|
-
* PayPal fallback, or `null` if PayPal is disabled for this session. Direct
|
|
490
|
-
* PayPal (`gateways.paypal`) does not use this instance.
|
|
491
|
-
*
|
|
492
|
-
* Must be called within a `<FloPayProvider>`.
|
|
493
|
-
*/
|
|
494
|
-
declare function usePayPalFloPay(): FloPay | null;
|
|
495
|
-
/** Checkout state exposed by `useCheckout()`. */
|
|
496
|
-
interface CheckoutState {
|
|
497
|
-
session: CheckoutSession | null;
|
|
498
|
-
loading: boolean;
|
|
499
|
-
error: FloPayError | null;
|
|
500
|
-
/** True while a detached session shell is not yet safe to charge. */
|
|
501
|
-
claimPending?: boolean;
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* Returns the current checkout session state.
|
|
505
|
-
*
|
|
506
|
-
* Must be called within the checkout context rendered by `<FloPayCheckout>`.
|
|
507
|
-
*/
|
|
508
|
-
declare function useCheckout(): CheckoutState;
|
|
509
|
-
|
|
510
|
-
/** Props for the `FloPayProvider` component. */
|
|
511
|
-
interface FloPayProviderProps {
|
|
512
|
-
/** A `FloPay` instance or a promise that resolves to one (from `loadFloPay()`). */
|
|
513
|
-
flopay: Promise<FloPay> | FloPay | null;
|
|
514
|
-
/**
|
|
515
|
-
* Optional Stripe `FloPay` instance used to drive the Stripe-rendered PayPal
|
|
516
|
-
* fallback. When omitted or `null`, the Stripe-rendered PayPal button is
|
|
517
|
-
* not rendered. Direct PayPal (`gateways.paypal`) does not use this prop.
|
|
518
|
-
*/
|
|
519
|
-
paypalFlopay?: Promise<FloPay> | FloPay | null;
|
|
520
|
-
/** Optional provider configuration. */
|
|
521
|
-
options?: {
|
|
522
|
-
/** Billing API base URL. Set once here so child components don't need to repeat it. */
|
|
523
|
-
billingApiUrl?: string;
|
|
524
|
-
};
|
|
525
|
-
/** Receives the versioned, privacy-safe checkout instrument feed. */
|
|
526
|
-
onInstrument?: (event: FloInstrumentEvent) => void;
|
|
527
|
-
children: React.ReactNode;
|
|
528
|
-
}
|
|
529
|
-
/**
|
|
530
|
-
* Provides FloPay SDK context to the component tree.
|
|
531
|
-
*
|
|
532
|
-
* Wrap components that consume FloPay context with this provider:
|
|
533
|
-
*
|
|
534
|
-
* ```tsx
|
|
535
|
-
* <FloPayProvider flopay={loadFloPay('pk_test_...')}>
|
|
536
|
-
* <YourCheckout />
|
|
537
|
-
* </FloPayProvider>
|
|
538
|
-
* ```
|
|
539
|
-
*
|
|
540
|
-
* `FloPayCheckout` is a standalone integration that owns its provider:
|
|
541
|
-
*
|
|
542
|
-
* ```tsx
|
|
543
|
-
* <FloPayCheckout sessionId="sess_..." />
|
|
544
|
-
* ```
|
|
545
|
-
*/
|
|
546
|
-
declare function FloPayProvider({ flopay: floPayProp, paypalFlopay: paypalFloPayProp, options, onInstrument, children, }: FloPayProviderProps): React.ReactElement;
|
|
547
|
-
|
|
548
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
549
|
-
|
|
550
|
-
interface SplitCardFormProps {
|
|
551
|
-
/** The checkout session ID (UUID from billing API). */
|
|
552
|
-
sessionId: string;
|
|
553
|
-
/**
|
|
554
|
-
* Session-bound checkout token returned by session creation
|
|
555
|
-
* (`CheckoutSessionResult.nonce` or `session.clientSecret`). Forwarded as
|
|
556
|
-
* `x-checkout-session-token` on every continuation request — required by
|
|
557
|
-
* post-#640 backends. `FloPayCheckout` plumbs this prop automatically.
|
|
558
|
-
*/
|
|
559
|
-
nonce?: string;
|
|
560
|
-
/** Billing API base URL. Optional — defaults to the value from FloPayProvider or the shared constant. */
|
|
561
|
-
billingApiUrl?: string;
|
|
562
|
-
/** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
|
|
563
|
-
telemetry?: boolean;
|
|
564
|
-
/** User's email (required for creating payment intents). */
|
|
565
|
-
email?: string;
|
|
566
|
-
/** User ID (required for processing payments). */
|
|
567
|
-
userId?: string;
|
|
568
|
-
/** Called when the full payment flow completes successfully. */
|
|
569
|
-
onComplete?: (result: PaymentResult) => void;
|
|
570
|
-
/** Called when a payment error occurs. */
|
|
571
|
-
onError?: (error: FloPayError) => void;
|
|
572
|
-
/** Called when a payment is declined or the authentication step fails. */
|
|
573
|
-
onDecline?: (decline: DeclineEvent) => void;
|
|
574
|
-
/**
|
|
575
|
-
* Called once when the buyer closes or leaves the direct PayPal button's
|
|
576
|
-
* PayPal window without approving. Not called for Stripe-rendered PayPal.
|
|
577
|
-
*/
|
|
578
|
-
onCancel?: (event: FloPayPaymentCancelEvent) => void;
|
|
579
|
-
/**
|
|
580
|
-
* **Override**: If provided, delegates backend submission to the caller.
|
|
581
|
-
* When omitted, processes internally (calls processPayment + handles 3DS).
|
|
582
|
-
*/
|
|
583
|
-
onTokenizedBody?: (tokenizedBody: TokenizedBody) => void;
|
|
584
|
-
/** First name for billing. */
|
|
585
|
-
firstName?: string;
|
|
586
|
-
/** Last name for billing. */
|
|
587
|
-
lastName?: string;
|
|
588
|
-
/** Checkout version for A/B tracking. */
|
|
589
|
-
chv?: string;
|
|
590
|
-
/** Additional CSS class for the form wrapper. */
|
|
591
|
-
className?: string;
|
|
592
|
-
/**
|
|
593
|
-
* Final wording for the hosted card form's submit button — the control that
|
|
594
|
-
* starts the card payment — e.g. `'Pay $10'` (billing API v1.9.35+). Pass
|
|
595
|
-
* the final, already-localized plain text from your own order summary; the
|
|
596
|
-
* SDK does not format amounts or translate.
|
|
597
|
-
*
|
|
598
|
-
* Changes apply live without remounting the card form, so buyer-entered
|
|
599
|
-
* card details, focus, and caret are kept. Omitting it, passing `null`, or
|
|
600
|
-
* clearing it after a label was shown restores the hosted default
|
|
601
|
-
* (`CONFIRM PAYMENT`); blank, oversized, or invalid text also shows the
|
|
602
|
-
* default. It does not change wallet, PayPal, processing, or retry wording,
|
|
603
|
-
* the buttons-layout card tile (`cardButtonContent`), or the saved-payment
|
|
604
|
-
* confirm button (`FloPayCheckout`'s `confirmLabel`).
|
|
605
|
-
*/
|
|
606
|
-
submitLabel?: string | null;
|
|
607
|
-
/** External processing state. */
|
|
608
|
-
isProcessing?: boolean;
|
|
609
|
-
/** External error message. */
|
|
610
|
-
error?: string | null;
|
|
611
|
-
/** Called when internal error state changes. */
|
|
612
|
-
onErrorChange?: (error: string | null) => void;
|
|
613
|
-
/**
|
|
614
|
-
* Show the PayPal payment surface above the hosted vault card surface. Defaults to `true`.
|
|
615
|
-
* The renderer is chosen from `session.gateways.paypal`: when that gateway
|
|
616
|
-
* is configured, `DirectPayPalButton` (PayPal JS SDK) takes over and Stripe
|
|
617
|
-
* drops `paypal` from its express row to avoid double-rendering; otherwise
|
|
618
|
-
* PayPal renders inside `ExpressCheckoutElement` (using either a dedicated
|
|
619
|
-
* `gateways.stripe.paypalPublishableKey` sub-account or the main Stripe
|
|
620
|
-
* account when the enabled-methods list includes `paypal`).
|
|
621
|
-
*/
|
|
622
|
-
showPayPal?: boolean;
|
|
623
|
-
/**
|
|
624
|
-
* Show Stripe-rendered wallets and APMs (ExpressCheckoutElement +
|
|
625
|
-
* PaymentElement). Defaults to `true`. When `false`, every Stripe surface
|
|
626
|
-
* is hidden — only `DirectPayPalButton` can render. Setting both
|
|
627
|
-
* `showStripe={false}` and `showPayPal={false}` (with no PayPal gateway
|
|
628
|
-
* configured) throws a bootstrap-time validation error.
|
|
629
|
-
*/
|
|
630
|
-
showStripe?: boolean;
|
|
631
|
-
/**
|
|
632
|
-
* Preferred approval presentation for supported wallets. Defaults to
|
|
633
|
-
* `'auto'`. Safety signals and provider capability remain authoritative.
|
|
634
|
-
*/
|
|
635
|
-
walletPresentation?: WalletPresentation;
|
|
636
|
-
/**
|
|
637
|
-
* Per-session list of Stripe payment method type identifiers (as returned
|
|
638
|
-
* by the billing API on `gateways.stripe.enabledPaymentMethods`). When
|
|
639
|
-
* supplied, drives the contents of the `ExpressCheckoutElement` row and the
|
|
640
|
-
* accordion `PaymentElement` instead of the historic hardcoded
|
|
641
|
-
* Apple/Google/PayPal set. `card` is reserved for the hosted card path: it
|
|
642
|
-
* advertises that `/vault/capture` recovery is available when the session
|
|
643
|
-
* has no embedded vault block. When omitted, the SDK falls back to the
|
|
644
|
-
* legacy `showApplePay`/`showGooglePay`/`showPayPal` toggles.
|
|
645
|
-
*/
|
|
646
|
-
enabledPaymentMethods?: string[];
|
|
647
|
-
/**
|
|
648
|
-
* Per-method buyer-country gate from `gateways.stripe.enabledPaymentMethodCountries`
|
|
649
|
-
* (method → allowed ISO-3166-1 alpha-2 countries; a method absent here has no
|
|
650
|
-
* country gate). The SDK filters the rendered tile row by the buyer's *live*
|
|
651
|
-
* country against this map, so per-method country eligibility comes from the
|
|
652
|
-
* backend rather than a hardcoded SDK table. When omitted (legacy backend),
|
|
653
|
-
* the SDK falls back to its built-in {@link STRIPE_METHOD_COUNTRIES} table.
|
|
654
|
-
*/
|
|
655
|
-
enabledPaymentMethodCountries?: Record<string, string[]>;
|
|
656
|
-
/**
|
|
657
|
-
* @deprecated The Apple Pay / Google Pay surface is now driven by the
|
|
658
|
-
* `gateways.stripe.enabledPaymentMethods` list returned per-session by the
|
|
659
|
-
* billing API. Pass {@link SplitCardFormProps.enabledPaymentMethods} (or
|
|
660
|
-
* upgrade the backend so `FloPayCheckout` threads it through automatically).
|
|
661
|
-
* Setting this prop emits a one-time deprecation warning and is otherwise
|
|
662
|
-
* ignored when `enabledPaymentMethods` is supplied.
|
|
663
|
-
*/
|
|
664
|
-
showApplePay?: boolean;
|
|
665
|
-
/**
|
|
666
|
-
* @deprecated See {@link SplitCardFormProps.showApplePay}.
|
|
667
|
-
*/
|
|
668
|
-
showGooglePay?: boolean;
|
|
669
|
-
/**
|
|
670
|
-
* Layout mode for the payment form.
|
|
671
|
-
* - `'default'` — all payment methods + card form shown together (current behavior)
|
|
672
|
-
* - `'buttons'` — PayPal, wallets, and a "Credit / Debit Card" button; clicking the card
|
|
673
|
-
* button expands the card form with a back button to return to the button view
|
|
674
|
-
*/
|
|
675
|
-
layout?: 'default' | 'buttons';
|
|
676
|
-
/**
|
|
677
|
-
* High-level theme bundle that styles non-card Stripe Elements, the FloPay
|
|
678
|
-
* wrapper / AVS inputs, and the hosted vault widget. One of:
|
|
679
|
-
* `'classic'` (historic FloPay look, no bundle applied), `'modern-light'`,
|
|
680
|
-
* `'modern-dark'`, `'bold-light'`, `'bold-dark'`, `'glass-light'`,
|
|
681
|
-
* `'glass-dark'`. Explicit `appearance` / `buttonsStyles` props still
|
|
682
|
-
* override their respective halves when provided.
|
|
683
|
-
*/
|
|
684
|
-
theme?: _flopay_shared.ThemeId;
|
|
685
|
-
/**
|
|
686
|
-
* @deprecated Use `theme` instead. Legacy buttons-layout preset
|
|
687
|
-
* (`'default' | 'minimal' | 'rounded' | 'dark'`). Still honored for
|
|
688
|
-
* back-compat — the new union accepts the bundle ids too but you should
|
|
689
|
-
* migrate to the `theme` prop.
|
|
690
|
-
*/
|
|
691
|
-
buttonsTheme?: _flopay_shared.ButtonsLayoutTheme;
|
|
692
|
-
/** Style overrides merged on top of the resolved theme bundle / buttonsTheme preset. */
|
|
693
|
-
buttonsStyles?: _flopay_shared.ButtonsLayoutStyles;
|
|
694
|
-
/**
|
|
695
|
-
* Appearance from `FloPayProvider` / `FloPayCheckout`. Threaded through so
|
|
696
|
-
* the React-rendered wrapper, AVS inputs, title, and hosted vault widget can
|
|
697
|
-
* derive colors from `appearance.variables` when no explicit `buttonsStyles`
|
|
698
|
-
* is supplied. Bundle consumers (`THEMES[id]`) get a coherent look without
|
|
699
|
-
* having to forward both halves manually.
|
|
700
|
-
*/
|
|
701
|
-
appearance?: _flopay_shared.FloPayAppearance;
|
|
702
|
-
/** Custom React content rendered inside the card button when `layout="buttons"`. */
|
|
703
|
-
cardButtonContent?: React.ReactNode;
|
|
704
|
-
/** Custom React content rendered for the buttons-layout card back button label. */
|
|
705
|
-
cardBackButtonContent?: React.ReactNode;
|
|
706
|
-
/** Custom React content rendered for the card-form title. */
|
|
707
|
-
cardTitleContent?: React.ReactNode;
|
|
708
|
-
/**
|
|
709
|
-
* @deprecated No longer rendered — the default-layout security footer was
|
|
710
|
-
* removed alongside the theme-bundle refactor. Retained as an optional
|
|
711
|
-
* prop so existing integrations type-check without changes.
|
|
712
|
-
*/
|
|
713
|
-
showSecurityFooter?: boolean;
|
|
714
|
-
/**
|
|
715
|
-
* Called when a payment method button is clicked.
|
|
716
|
-
* `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
|
|
717
|
-
*/
|
|
718
|
-
onButtonClick?: (method: CheckoutButtonMethod) => void;
|
|
719
|
-
/**
|
|
720
|
-
* Called before a payment button continues in `layout="buttons"`.
|
|
721
|
-
* Runs for card, PayPal, Apple Pay, and Google Pay.
|
|
722
|
-
*/
|
|
723
|
-
onBeforeButtonClick?: (event: BeforeButtonClickEvent) => MaybePromise<undefined | false | InlineSessionPatch>;
|
|
724
|
-
/**
|
|
725
|
-
* Called after checkout collects a missing buyer email/name. FloPayCheckout
|
|
726
|
-
* uses this to claim an email-less detached session before payment continues.
|
|
727
|
-
*/
|
|
728
|
-
onBuyerIdentityReady?: (identity: NonNullable<InlineSessionPatch['account']>) => MaybePromise<void>;
|
|
729
|
-
/**
|
|
730
|
-
* Enable AVS (Address Verification).
|
|
731
|
-
* - `true` — show country + postal code (backward compatible default)
|
|
732
|
-
* - `AVSFieldConfig` — granular per-field control, optionally scoped to country codes
|
|
733
|
-
* - `false` / omitted — AVS disabled
|
|
734
|
-
*/
|
|
735
|
-
enableAVS?: boolean | AVSFieldConfig;
|
|
736
|
-
/**
|
|
737
|
-
* Per-merchant order of the hosted vault card rows — a permutation of
|
|
738
|
-
* `['name','number','expiry']` (`'expiry'` is the combined expiry+CVV row;
|
|
739
|
-
* the submit button stays last). Drives both the visual order and the tab
|
|
740
|
-
* order inside the widget. Omit for the default (`name`, `number`, `expiry`).
|
|
741
|
-
* Only applies on the vault card path.
|
|
742
|
-
*/
|
|
743
|
-
cardFieldOrder?: _flopay_shared.VaultCardFieldKey[];
|
|
744
|
-
/** Content rendered above the hosted vault card widget (below the wallet divider). */
|
|
745
|
-
cardPreFormSlot?: React.ReactNode;
|
|
746
|
-
/** Layout for AVS fields: 'row' (side-by-side, default) or 'column' (stacked). */
|
|
747
|
-
avsLayout?: 'row' | 'column';
|
|
748
|
-
/** Pre-filled country code (ISO 3166-1 alpha-2) for AVS. */
|
|
749
|
-
country?: string;
|
|
750
|
-
/** Pre-filled ZIP/postal code for AVS. */
|
|
751
|
-
zip?: string;
|
|
752
|
-
/** Pre-filled street address (line 1) for AVS. Typically from a partner GeoIP / profile lookup. */
|
|
753
|
-
addressLine1?: string;
|
|
754
|
-
/** Pre-filled apt/suite/unit (line 2) for AVS. */
|
|
755
|
-
addressLine2?: string;
|
|
756
|
-
/** Pre-filled city for AVS. Typically from a partner GeoIP / profile lookup. */
|
|
757
|
-
city?: string;
|
|
758
|
-
/** Pre-filled state/province for AVS. Typically from a partner GeoIP / profile lookup. */
|
|
759
|
-
state?: string;
|
|
760
|
-
/** Callback when AVS country changes. */
|
|
761
|
-
onCountryChange?: (country: string) => void;
|
|
762
|
-
/** Callback when AVS ZIP/postal code changes. */
|
|
763
|
-
onZipChange?: (zip: string) => void;
|
|
764
|
-
/** Whether AVS was enabled (sent to backend for analytics). */
|
|
765
|
-
avsCheck?: boolean;
|
|
766
|
-
/** Checkout type: 'standard_checkout' or 'embedded_checkout'. */
|
|
767
|
-
checkoutType?: string;
|
|
768
|
-
/** Checkout layout: 'default_layout', 'buttons_layout', or 'custom_layout'. */
|
|
769
|
-
checkoutLayout?: string;
|
|
770
|
-
/** Total amount in cents (smallest currency unit). Used for wallet/PayPal Elements config. */
|
|
771
|
-
totalAmount?: number;
|
|
772
|
-
/** Currency code (used for PayPal Elements config). */
|
|
773
|
-
currency?: string;
|
|
774
|
-
/** Render the card form expanded on first paint when `layout="buttons"`. */
|
|
775
|
-
initialCardOpen?: boolean;
|
|
776
|
-
/**
|
|
777
|
-
* Direct PayPal gateway configuration. When provided, PayPal renders via
|
|
778
|
-
* the official PayPal JS SDK (in-app browser compliant) instead of via
|
|
779
|
-
* Stripe's ExpressCheckoutElement. Selection is mutually exclusive:
|
|
780
|
-
* setting this disables the Stripe-rendered PayPal path automatically.
|
|
781
|
-
*/
|
|
782
|
-
directPaypal?: {
|
|
783
|
-
clientId: string;
|
|
784
|
-
environment?: GatewayEnvironment;
|
|
785
|
-
/**
|
|
786
|
-
* @deprecated The active session's
|
|
787
|
-
* `gateways.paypal.providerObjectType` advertisement is authoritative.
|
|
788
|
-
* Retained as a fallback for integrations that do not supply a session.
|
|
789
|
-
*/
|
|
790
|
-
providerObjectType?: PayPalProviderObjectType;
|
|
791
|
-
/** Backend-advertised non-popup presentation for one-time PayPal Orders. */
|
|
792
|
-
approvalPresentation?: _flopay_shared.PayPalApprovalPresentation;
|
|
793
|
-
/** Backend-created PayPal object to resume without creating a replacement. */
|
|
794
|
-
existingOrderId?: string;
|
|
795
|
-
};
|
|
796
|
-
/** Whether the active session represents a subscription (drives direct PayPal intent). */
|
|
797
|
-
isSubscription?: boolean;
|
|
798
|
-
/** Backing session — forwarded to direct-PayPal so it can populate accountData. */
|
|
799
|
-
session?: CheckoutSession | null;
|
|
800
|
-
/**
|
|
801
|
-
* True while a **detached** session's claim is waiting for buyer identity or
|
|
802
|
-
* is still in flight (TeamFloPay/backend#1099).
|
|
803
|
-
*
|
|
804
|
-
* The hosted card widget is already mounted and the buyer can fill it in, but
|
|
805
|
-
* the session has no cart attached yet, so nothing may be submitted: the
|
|
806
|
-
* billing API rejects process / intent calls on an unclaimed session with
|
|
807
|
-
* `409 checkout_session_data_attachment_required`, and holds an unclaimed
|
|
808
|
-
* vault charge with a retryable `503`. While true, card submit stays gated.
|
|
809
|
-
* Non-card surfaces also stay hidden unless they are needed to collect the
|
|
810
|
-
* missing identity; all payment continuations enable when the claim lands.
|
|
811
|
-
* `FloPayCheckout` plumbs this prop automatically.
|
|
812
|
-
*/
|
|
813
|
-
dataAttachmentPending?: boolean;
|
|
814
|
-
/**
|
|
815
|
-
* True when the pending detached claim is waiting for this form to collect
|
|
816
|
-
* buyer identity. Non-card collection surfaces remain available, while all
|
|
817
|
-
* payment continuations still await `onBuyerIdentityReady`.
|
|
818
|
-
*/
|
|
819
|
-
dataAttachmentRequiresIdentity?: boolean;
|
|
820
|
-
/**
|
|
821
|
-
* Enables on-screen diagnostic panels for the PayPal/wallet gating decision
|
|
822
|
-
* and the `DirectPayPalButton` lifecycle. Intended for debugging in-app
|
|
823
|
-
* browsers where remote console access is impractical. Off by default.
|
|
824
|
-
*/
|
|
825
|
-
debug?: boolean;
|
|
826
|
-
}
|
|
827
|
-
/**
|
|
828
|
-
* Checkout surface combining hosted vault card capture with wallets, APMs,
|
|
829
|
-
* and PayPal. Card entry is hosted-vault-only.
|
|
830
|
-
*
|
|
831
|
-
* Stripe-hosted PayPal uses its own Elements instance; direct PayPal uses the
|
|
832
|
-
* official PayPal SDK when the session advertises that gateway.
|
|
833
|
-
*/
|
|
834
|
-
declare function SplitCardForm(props: SplitCardFormProps): React.JSX.Element;
|
|
835
|
-
|
|
836
|
-
/** Props for {@link VaultCardFields}. */
|
|
837
|
-
interface VaultCardFieldsProps {
|
|
838
|
-
/**
|
|
839
|
-
* The card-capture adapter (typically `useFloPay().cardCapture()`). Owns
|
|
840
|
-
* injecting + bootstrapping the hosted vault widget. Changing this instance
|
|
841
|
-
* (or {@link VaultCardFieldsProps.html}) remounts the widget.
|
|
842
|
-
*/
|
|
843
|
-
capture: CardCaptureAdapter;
|
|
844
|
-
/**
|
|
845
|
-
* Server-rendered hosted vault widget HTML (the session's
|
|
846
|
-
* {@link CheckoutSession.vault} block `html`, or one fetched from
|
|
847
|
-
* `POST /vault/capture`). The widget owns the card fields, submit button,
|
|
848
|
-
* tokenization, charge, and 3DS; this component only injects it.
|
|
849
|
-
*/
|
|
850
|
-
html: string;
|
|
851
|
-
/**
|
|
852
|
-
* Per-session integrity token (the vault block's `messageToken`). Forwarded
|
|
853
|
-
* to the adapter so it can reject forged terminal `postMessage` outcomes that
|
|
854
|
-
* omit/mismatch it. Omitted when the backend does not (yet) mint one.
|
|
855
|
-
*/
|
|
856
|
-
messageToken?: string;
|
|
857
|
-
/**
|
|
858
|
-
* Exact origin expected for the widget's terminal `postMessage` outcomes
|
|
859
|
-
* (the vault block's `expectedOrigin`). Forwarded to the adapter's origin
|
|
860
|
-
* gate; omitted to skip it.
|
|
861
|
-
*/
|
|
862
|
-
expectedOrigin?: string;
|
|
863
|
-
/**
|
|
864
|
-
* The form sits behind the backend's production human check (the vault
|
|
865
|
-
* block's `verification.required`). Forwarded to the adapter so a pre-submit
|
|
866
|
-
* frame `error` (check failed, expired or unavailable) is not reported as a
|
|
867
|
-
* vault load failure; it still reaches {@link VaultCardFieldsProps.onError}.
|
|
868
|
-
*/
|
|
869
|
-
verificationRequired?: boolean;
|
|
870
|
-
/**
|
|
871
|
-
* Merchant theme colors pushed into the hosted widget so the card form
|
|
872
|
-
* matches the surrounding checkout. Applied live on change (no remount).
|
|
873
|
-
* `null` is the explicit classic reset: after a theme was applied it tells
|
|
874
|
-
* the hosted form to restore every historical neutral value. Omitted (or
|
|
875
|
-
* `null` from the start) leaves the widget's own defaults untouched.
|
|
876
|
-
*/
|
|
877
|
-
theme?: VaultCardThemeColors | null;
|
|
878
|
-
/**
|
|
879
|
-
* Final, already-localized wording for the hosted card form's submit button
|
|
880
|
-
* (e.g. `'Pay $10'`), billing API v1.9.35+. Applied live on change (no
|
|
881
|
-
* remount, buyer-entered card data kept). `null` is the same as omitting it:
|
|
882
|
-
* omitting or clearing it after a label was shown restores the session
|
|
883
|
-
* default (`CONFIRM PAYMENT`, or `ADD CARD` for card setup); blank text also
|
|
884
|
-
* shows the default.
|
|
885
|
-
*/
|
|
886
|
-
submitLabel?: string | null;
|
|
887
|
-
/**
|
|
888
|
-
* Inline styles for the container the widget mounts into. Applied as a
|
|
889
|
-
* whole declaration list in key order on every change (not diffed property
|
|
890
|
-
* by property), so a shorthand and a longhand of the same family cascade
|
|
891
|
-
* deterministically across live updates — the surface the card-setup preset
|
|
892
|
-
* treatment and a merchant `containerStyle` share.
|
|
893
|
-
*/
|
|
894
|
-
containerStyle?: React.CSSProperties;
|
|
895
|
-
/** Fired once the widget is injected and bootstrapping. */
|
|
896
|
-
onReady?: () => void;
|
|
897
|
-
/**
|
|
898
|
-
* Fired with a load/runtime error message from the widget, or `null` when it
|
|
899
|
-
* clears. Wired to the card form's shared error banner. Terminal payment
|
|
900
|
-
* outcomes (`complete` / `decline`) are observed by the parent form directly
|
|
901
|
-
* off the same adapter and are not surfaced here.
|
|
902
|
-
*/
|
|
903
|
-
onError?: (message: string | null) => void;
|
|
904
|
-
/**
|
|
905
|
-
* Fired with the widget's inline field-validation message (live, debounced by
|
|
906
|
-
* the widget to changes), or `null` when validation clears. Surfaced in the
|
|
907
|
-
* card form's error banner and the merchant `onError`.
|
|
908
|
-
*/
|
|
909
|
-
onValidation?: (message: string | null) => void;
|
|
910
|
-
}
|
|
911
|
-
/**
|
|
912
|
-
* Renders the backend-served vault PCI card widget
|
|
913
|
-
* (TeamFloPay/backend#823, Model A). The hosted widget
|
|
914
|
-
* is a self-contained form: PAN / CVC, the submit button, the charge, and 3DS
|
|
915
|
-
* all live inside it. This component only injects the widget HTML through the
|
|
916
|
-
* {@link CardCaptureAdapter} and bridges its `ready` / `error` lifecycle events
|
|
917
|
-
* back to the surrounding card form.
|
|
918
|
-
*/
|
|
919
|
-
declare function VaultCardFields({ capture, html, messageToken, expectedOrigin, verificationRequired, theme, submitLabel, containerStyle, onReady, onError, onValidation, }: VaultCardFieldsProps): React.ReactElement;
|
|
920
|
-
|
|
921
|
-
export { type CheckoutState, DirectPayPalButton, type DirectPayPalButtonProps, type DirectPayPalInitializationState, FloPayAutomaticPaymentButton, type FloPayAutomaticPaymentButtonProps, type FloPayAutomaticPaymentSuccessEvent, FloPayCheckout, type FloPayCheckoutProps, FloPayPaymentMethodSetup, FloPayPaymentMethodSetupProps, FloPayProvider, type FloPayProviderProps, SplitCardForm, type SplitCardFormProps, VaultCardFields, type VaultCardFieldsProps, useCheckout, useFloPay, usePayPalFloPay };
|