@flopay/react 1.20.15 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -390
- package/dist/card-setup-entry.cjs +1 -6
- package/dist/card-setup-entry.d.ts +4 -10
- package/dist/card-setup-entry.mjs +1 -1
- package/dist/chunk-KPRDVWZP.mjs +1 -0
- package/dist/chunk-XRYDC367.mjs +1 -0
- package/dist/flopay-runtime-card-setup.d.ts +4 -5
- package/dist/flopay-runtime-checkout.d.ts +2 -0
- package/dist/hosted-runtime-components.d.ts +75 -0
- package/dist/index.cjs +1 -47
- package/dist/index.d.ts +3 -21
- package/dist/index.mjs +1 -21
- package/dist/payment-method-setup-entry.cjs +1 -27
- package/dist/payment-method-setup-entry.d.ts +5 -12
- package/dist/payment-method-setup-entry.mjs +1 -1
- package/dist/runtime-context.d.ts +10 -0
- package/package.json +3 -6
- package/dist/account-bound-elements.d.ts +0 -31
- package/dist/automatic-payment-button.d.ts +0 -88
- package/dist/buyer-identity-fallback.d.ts +0 -43
- package/dist/card-button-content.d.ts +0 -11
- package/dist/card-setup-surface.d.ts +0 -12
- package/dist/card-setup-theme.d.ts +0 -32
- package/dist/checkout-utils.d.ts +0 -172
- package/dist/chunk-BU7THP6H.mjs +0 -1
- package/dist/chunk-FGCZOMML.mjs +0 -22
- package/dist/chunk-ITRFSHZP.mjs +0 -6
- package/dist/chunk-PCIHQY3X.mjs +0 -1
- package/dist/chunk-VK67324N.mjs +0 -1
- package/dist/context.d.ts +0 -46
- package/dist/direct-paypal-button.d.ts +0 -155
- package/dist/error-banner.d.ts +0 -21
- package/dist/external-method-recovery.d.ts +0 -1
- package/dist/external-method-telemetry.d.ts +0 -17
- package/dist/flopay-card-setup.d.ts +0 -114
- package/dist/flopay-checkout.d.ts +0 -292
- package/dist/flopay-payment-method-setup-main.d.ts +0 -10
- package/dist/flopay-payment-method-setup.d.ts +0 -11
- package/dist/hooks.d.ts +0 -36
- package/dist/in-app-browser.d.ts +0 -5
- package/dist/inline-session-cache.d.ts +0 -1
- package/dist/instruments.d.ts +0 -5
- package/dist/more-payment-options.d.ts +0 -19
- package/dist/one-click-warnings.d.ts +0 -12
- package/dist/payment-logos.generated.d.ts +0 -1
- package/dist/payment-method-layout-placeholder.d.ts +0 -10
- package/dist/payment-method-setup-advertisement.d.ts +0 -36
- package/dist/payment-method-setup-paypal-CLV7JDJH.mjs +0 -1
- package/dist/payment-method-setup-paypal.d.ts +0 -25
- package/dist/payment-method-setup-stripe-526L4P5X.mjs +0 -1
- package/dist/payment-method-setup-stripe.d.ts +0 -31
- package/dist/payment-method-setup-surface.d.ts +0 -90
- package/dist/popup-capability.d.ts +0 -12
- package/dist/processing-overlay.d.ts +0 -33
- package/dist/provider-callback-ignored.d.ts +0 -8
- package/dist/provider.d.ts +0 -40
- package/dist/recent-completion.d.ts +0 -1
- package/dist/run-latest-abortable-action.d.ts +0 -5
- package/dist/saved-payment-flow.d.ts +0 -140
- package/dist/split-card-form.d.ts +0 -393
- package/dist/stripe-method-presentation.d.ts +0 -115
- package/dist/telemetry-bridge.d.ts +0 -41
- package/dist/use-external-attempt-reconciliation.d.ts +0 -27
- package/dist/use-isomorphic-layout-effect.d.ts +0 -3
- package/dist/use-payment-method-layout.d.ts +0 -27
- package/dist/vault-card-fields.d.ts +0 -97
- package/dist/vault-theme.d.ts +0 -1
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
export type OverlayStatus = 'processing' | 'success' | 'error';
|
|
3
|
-
export declare const PROCESSING_OVERLAY_SUCCESS_DELAY_MS = 600;
|
|
4
|
-
export declare const PROCESSING_OVERLAY_ERROR_DELAY_MS = 400;
|
|
5
|
-
/**
|
|
6
|
-
* Optional visual treatment for the overlay. Absent, the modal keeps its
|
|
7
|
-
* historical neutral look (white panel, gray/indigo spinner, green/red labels).
|
|
8
|
-
*/
|
|
9
|
-
export interface ProcessingOverlayTheme {
|
|
10
|
-
/** Panel surface (background, border, radius, shadow) plus base text color and font. */
|
|
11
|
-
panel: React.CSSProperties;
|
|
12
|
-
spinnerTrackColor: string;
|
|
13
|
-
spinnerAccentColor: string;
|
|
14
|
-
labelColors: Record<OverlayStatus, string>;
|
|
15
|
-
/** Secondary copy: the success note and the failure message. */
|
|
16
|
-
noteColor: string;
|
|
17
|
-
}
|
|
18
|
-
export declare function ProcessingOverlay({ status, errorMessage, authorized, processingLabel, successLabel, errorLabel, successNote, theme, }: {
|
|
19
|
-
status: OverlayStatus;
|
|
20
|
-
errorMessage?: string | null;
|
|
21
|
-
/** Labels a successful authorization hold without implying that funds settled. */
|
|
22
|
-
authorized?: boolean;
|
|
23
|
-
/** Override the spinner label for non-payment surfaces (e.g. card setup). */
|
|
24
|
-
processingLabel?: string;
|
|
25
|
-
/** Override the success label; defaults to the payment wording (authorized-aware). */
|
|
26
|
-
successLabel?: string;
|
|
27
|
-
/** Override the failure label for non-payment surfaces. */
|
|
28
|
-
errorLabel?: string;
|
|
29
|
-
/** Success sub-note; pass `null` to omit (surfaces that do not redirect). */
|
|
30
|
-
successNote?: string | null;
|
|
31
|
-
/** Preset treatment (card setup); omit for the neutral modal. */
|
|
32
|
-
theme?: ProcessingOverlayTheme;
|
|
33
|
-
}): React.JSX.Element;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/** The lifecycle diagnostic recorded when a provider callback is ignored. */
|
|
2
|
-
export declare const PROVIDER_CALLBACK_IGNORED_EVENT: 'provider.callback.ignored';
|
|
3
|
-
interface IgnoredCallbackBudget {
|
|
4
|
-
/** Spends one diagnostic for `scope` (the session); false once the cap is reached. */
|
|
5
|
-
take(scope: string): boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare function createIgnoredCallbackBudget(): IgnoredCallbackBudget;
|
|
8
|
-
export {};
|
package/dist/provider.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { FloPay } from '@flopay/js';
|
|
2
|
-
import type { FloInstrumentEvent } from '@flopay/shared';
|
|
3
|
-
import type React from 'react';
|
|
4
|
-
/** Props for the `FloPayProvider` component. */
|
|
5
|
-
export interface FloPayProviderProps {
|
|
6
|
-
/** A `FloPay` instance or a promise that resolves to one (from `loadFloPay()`). */
|
|
7
|
-
flopay: Promise<FloPay> | FloPay | null;
|
|
8
|
-
/**
|
|
9
|
-
* Optional Stripe `FloPay` instance used to drive the Stripe-rendered PayPal
|
|
10
|
-
* fallback. When omitted or `null`, the Stripe-rendered PayPal button is
|
|
11
|
-
* not rendered. Direct PayPal (`gateways.paypal`) does not use this prop.
|
|
12
|
-
*/
|
|
13
|
-
paypalFlopay?: Promise<FloPay> | FloPay | null;
|
|
14
|
-
/** Optional provider configuration. */
|
|
15
|
-
options?: {
|
|
16
|
-
/** Billing API base URL. Set once here so child components don't need to repeat it. */
|
|
17
|
-
billingApiUrl?: string;
|
|
18
|
-
};
|
|
19
|
-
/** Receives the versioned, privacy-safe checkout instrument feed. */
|
|
20
|
-
onInstrument?: (event: FloInstrumentEvent) => void;
|
|
21
|
-
children: React.ReactNode;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Provides FloPay SDK context to the component tree.
|
|
25
|
-
*
|
|
26
|
-
* Wrap components that consume FloPay context with this provider:
|
|
27
|
-
*
|
|
28
|
-
* ```tsx
|
|
29
|
-
* <FloPayProvider flopay={loadFloPay('pk_test_...')}>
|
|
30
|
-
* <YourCheckout />
|
|
31
|
-
* </FloPayProvider>
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* `FloPayCheckout` is a standalone integration that owns its provider:
|
|
35
|
-
*
|
|
36
|
-
* ```tsx
|
|
37
|
-
* <FloPayCheckout sessionId="sess_..." />
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
export declare function FloPayProvider({ flopay: floPayProp, paypalFlopay: paypalFloPayProp, options, onInstrument, children, }: FloPayProviderProps): React.ReactElement;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { markSessionRecentlyCompleted, wasSessionRecentlyCompleted } from '@flopay/shared';
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import type { FloPay, SavedCardChallengeInput, SavedCardChallengeOutcome, ThreeDsChallengeAttempt } from '@flopay/js';
|
|
2
|
-
import type { CheckoutButtonMethod, CheckoutProcessError, CheckoutSession, NormalizedCheckoutSession, PaymentResult, TelemetryExpectedOutcome, TelemetryFailureCategory, TelemetryRequestCategory, TokenizedBody } from '@flopay/shared';
|
|
3
|
-
import { FloPayError } from '@flopay/shared';
|
|
4
|
-
export declare const DEFAULT_SAVED_PAYMENT_DECLINE_METHOD: CheckoutButtonMethod;
|
|
5
|
-
export type ProcessRedirectResult = {
|
|
6
|
-
type: 'paypal_redirect_required' | '3ds_required';
|
|
7
|
-
threeDSecureToken: string;
|
|
8
|
-
paymentMethodId?: string;
|
|
9
|
-
};
|
|
10
|
-
export type ProviderNeutralNextAction = {
|
|
11
|
-
type: 'next_action_required';
|
|
12
|
-
nextActionRedirectUrl: string;
|
|
13
|
-
};
|
|
14
|
-
export type SavedPaymentProcessResult = ProcessRedirectResult | ProviderNeutralNextAction | {
|
|
15
|
-
type: 'success';
|
|
16
|
-
result: PaymentResult;
|
|
17
|
-
};
|
|
18
|
-
export type SavedPaymentFlowError = FloPayError & {
|
|
19
|
-
checkoutMethod?: CheckoutButtonMethod;
|
|
20
|
-
/** Fresh PayPal Order/Subscription id retained for direct approval recovery. */
|
|
21
|
-
orderId?: string;
|
|
22
|
-
telemetryFailureCategory?: TelemetryFailureCategory;
|
|
23
|
-
telemetryOutcome?: Extract<TelemetryExpectedOutcome, 'payment_declined' | 'validation_rejected'>;
|
|
24
|
-
telemetryRequestCategory?: TelemetryRequestCategory;
|
|
25
|
-
};
|
|
26
|
-
/** Build the cancellation sentinel consumed by lifecycle-bound React payment flows. */
|
|
27
|
-
export declare function createThreeDsAbortedError(cause?: unknown): FloPayError;
|
|
28
|
-
export declare function getRedirectResultFromCheckoutProcessError(error?: CheckoutProcessError | null): ProcessRedirectResult | null;
|
|
29
|
-
/**
|
|
30
|
-
* The saved-card 3DS challenge runner lives once, in `@flopay/js`
|
|
31
|
-
* (TeamFloPay/sdk#410, CTO decision 1): `@flopay/react` and `@flopay/vue` both
|
|
32
|
-
* use it. It renders the provider-hosted challenge in a modal overlay, accepts
|
|
33
|
-
* the `flopay-vault-3ds-return` message only from the challenge frame and the
|
|
34
|
-
* billing API origin, and then drives `/3ds/complete`.
|
|
35
|
-
*/
|
|
36
|
-
export type AutoCheckoutThreeDsOutcome = SavedCardChallengeOutcome;
|
|
37
|
-
/** React's name for the shared `@flopay/js` saved-card challenge runner. */
|
|
38
|
-
export declare function runAutoCheckoutThreeDsChallenge(input: SavedCardChallengeInput): Promise<AutoCheckoutThreeDsOutcome>;
|
|
39
|
-
type ProviderNeutralActionInput = {
|
|
40
|
-
billingApiUrl: string;
|
|
41
|
-
sessionId: string;
|
|
42
|
-
nonce?: string;
|
|
43
|
-
session: CheckoutSession;
|
|
44
|
-
signal: AbortSignal;
|
|
45
|
-
/**
|
|
46
|
-
* Record an unfinished challenge in SDK telemetry. Components that own their
|
|
47
|
-
* telemetry for this flow (FloPayCheckout) leave it off.
|
|
48
|
-
*/
|
|
49
|
-
telemetry?: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* The challenge's lifecycle recorder (`three_ds.challenge`, #525), begun by the calling
|
|
52
|
-
* component on its own `PaymentAPI` with `beginSavedCardChallengeTelemetry`. Observation only.
|
|
53
|
-
*/
|
|
54
|
-
challengeTelemetry?: ThreeDsChallengeAttempt;
|
|
55
|
-
};
|
|
56
|
-
/**
|
|
57
|
-
* Begin a component-owned saved-card challenge's lifecycle recorder (#525) on a dedicated
|
|
58
|
-
* `PaymentAPI` client. Pass `telemetry` to {@link completeProviderNeutralSavedPaymentAction} as
|
|
59
|
-
* `challengeTelemetry` and call `release` once the action settles: it destroys the client on
|
|
60
|
-
* the next task, after the runner's teardown record, so the reporter drains what it queued. With
|
|
61
|
-
* the merchant's telemetry off, or when recording cannot start, nothing is created or released.
|
|
62
|
-
*/
|
|
63
|
-
export declare function beginComponentChallengeTelemetry(billingApiUrl: string, sessionId: string, session: CheckoutSession, enabled?: boolean): {
|
|
64
|
-
telemetry?: ThreeDsChallengeAttempt;
|
|
65
|
-
release: () => void;
|
|
66
|
-
};
|
|
67
|
-
/** Complete a backend-owned saved-card challenge without loading a browser payment provider. */
|
|
68
|
-
export declare function completeProviderNeutralSavedPaymentAction(action: ProviderNeutralNextAction, input: ProviderNeutralActionInput): Promise<PaymentResult>;
|
|
69
|
-
export declare function checkoutProcessErrorToFloPayError(error?: CheckoutProcessError | null, fallbackMessage?: string, options?: {
|
|
70
|
-
checkoutMethod?: CheckoutButtonMethod;
|
|
71
|
-
}): SavedPaymentFlowError;
|
|
72
|
-
export declare function processSavedPaymentForMode({ billingApiUrl, sessionId, session, nonce, tokenizedData, returnUrl, telemetry, }: {
|
|
73
|
-
billingApiUrl: string;
|
|
74
|
-
sessionId?: string | null;
|
|
75
|
-
session: CheckoutSession;
|
|
76
|
-
/**
|
|
77
|
-
* Session-bound checkout token. Defaults to `session.clientSecret`, but
|
|
78
|
-
* callers that resolved the session via a GET (which doesn't echo the nonce)
|
|
79
|
-
* must pass it explicitly so `/process` and 3DS recovery stay authorized.
|
|
80
|
-
*/
|
|
81
|
-
nonce?: string;
|
|
82
|
-
tokenizedData?: TokenizedBody;
|
|
83
|
-
returnUrl?: string;
|
|
84
|
-
/** Disable the JS reporter when an enclosing React operation owns telemetry. */
|
|
85
|
-
telemetry?: boolean;
|
|
86
|
-
}): Promise<SavedPaymentProcessResult>;
|
|
87
|
-
export declare function handleSavedPaymentRedirectResult(redirectResult: ProcessRedirectResult, { flopay, paypalFlopay, attempt3DS, billingApiUrl, sessionId, session, returnUrl, telemetry, signal, }: {
|
|
88
|
-
flopay: FloPay | null;
|
|
89
|
-
paypalFlopay: FloPay | null;
|
|
90
|
-
attempt3DS?: boolean;
|
|
91
|
-
billingApiUrl: string;
|
|
92
|
-
sessionId?: string | null;
|
|
93
|
-
session: CheckoutSession;
|
|
94
|
-
returnUrl?: string;
|
|
95
|
-
/** Disable nested JS reporting when the enclosing React recovery owns telemetry. */
|
|
96
|
-
telemetry?: boolean;
|
|
97
|
-
/** Lifecycle-bound cancellation for any provider-neutral follow-up challenge. */
|
|
98
|
-
signal: AbortSignal;
|
|
99
|
-
}): Promise<PaymentResult>;
|
|
100
|
-
export declare function normalizeSavedPaymentError(err: unknown): SavedPaymentFlowError;
|
|
101
|
-
/**
|
|
102
|
-
* Resolve the generic, provider-agnostic payment method id for a card already
|
|
103
|
-
* on file for a returning customer, or `null` when none is present.
|
|
104
|
-
*
|
|
105
|
-
* For the vault flow (TeamFloPay/backend#823) the backend attaches a generic
|
|
106
|
-
* `providerPaymentMethodId` to the session when a card is on file. The id is
|
|
107
|
-
* opaque to the SDK — Stripe behind the vault returns a `pm_…`, but other card
|
|
108
|
-
* providers can return their own token. Under the Model-A hosted-widget flow
|
|
109
|
-
* the backend's auto-checkout cascade owns returning-customer charging; this
|
|
110
|
-
* helper remains for callers that surface "card on file" affordances.
|
|
111
|
-
*/
|
|
112
|
-
export declare function resolveReturningCustomerPaymentMethodId(session: CheckoutSession): string | null;
|
|
113
|
-
/**
|
|
114
|
-
* Stripe Elements publishable keys resolved from a normalized session. The
|
|
115
|
-
* "PayPal" entry here refers to the legacy Stripe-rendered PayPal account
|
|
116
|
-
* (`gateways.stripe`'s dedicated PayPal sub-account), not the new direct
|
|
117
|
-
* PayPal gateway — direct PayPal lives in `gateways.paypal` and is rendered
|
|
118
|
-
* via the official PayPal JS SDK rather than through Stripe Elements.
|
|
119
|
-
*
|
|
120
|
-
* PayPal-only and hosted-vault-only sessions have no Stripe publishable key;
|
|
121
|
-
* callers should skip Stripe Elements entirely. A server-side card gateway
|
|
122
|
-
* (Worldpay) is a hosted-vault surface even when the read omitted its embedded
|
|
123
|
-
* block, which the card form recovers from `/vault/capture`. Only throws when
|
|
124
|
-
* the session advertises no supported payment surface at all.
|
|
125
|
-
*/
|
|
126
|
-
export declare function resolveSavedPaymentPublishableKeys(unified: NormalizedCheckoutSession): {
|
|
127
|
-
publishableKey?: string;
|
|
128
|
-
paypalPublishableKey?: string;
|
|
129
|
-
};
|
|
130
|
-
export declare function loadSavedPaymentProviders({ publishableKey, paypalPublishableKey, billingApiUrl, locale, telemetry, }: {
|
|
131
|
-
publishableKey?: string;
|
|
132
|
-
paypalPublishableKey?: string;
|
|
133
|
-
billingApiUrl: string;
|
|
134
|
-
locale?: string;
|
|
135
|
-
telemetry?: boolean;
|
|
136
|
-
}): Promise<{
|
|
137
|
-
flopay: FloPay | null;
|
|
138
|
-
paypalFlopay: FloPay | null;
|
|
139
|
-
}>;
|
|
140
|
-
export {};
|
|
@@ -1,393 +0,0 @@
|
|
|
1
|
-
import type { AVSFieldConfig, BeforeButtonClickEvent, CardFieldLabels, CardFieldPlaceholders, CheckoutButtonMethod, CheckoutSession, DeclineEvent, FloPayPaymentCancelEvent, GatewayEnvironment, InlineSessionPatch, PaymentMethodLayoutRules, PaymentResult, PayPalProviderObjectType, TokenizedBody, WalletPresentation } from '@flopay/shared';
|
|
2
|
-
import { FloPayError } from '@flopay/shared';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { type MaybePromise } from './buyer-identity-fallback.js';
|
|
5
|
-
export { darkenHex } from '@flopay/shared';
|
|
6
|
-
export declare const CARD_VIEW_TRANSITION_MS = 180;
|
|
7
|
-
/**
|
|
8
|
-
* Shared "primary button" base style for the two buyer-action buttons in the
|
|
9
|
-
* buttons-layout (the "Credit / Debit Card" button + `FloPayAutomaticPaymentButton`).
|
|
10
|
-
*
|
|
11
|
-
* - `'classic'` / no theme: white background, grey border — historic look
|
|
12
|
-
* that lines up with the wallet ECE row's flat tiles.
|
|
13
|
-
* - Any theme bundle (`modern-*`, `bold-*`, `glass-*`): `colorPrimary`
|
|
14
|
-
* (`resolvedPrimaryColor` — already merged with any `appearance` override)
|
|
15
|
-
* drives the `backgroundColor`, exactly like the "Confirm Payment" submit
|
|
16
|
-
* CTA, so all three flo buttons (submit, card, auto-pay) share one fill and
|
|
17
|
-
* a per-checkout `colorPrimary` override re-skins every one of them. The
|
|
18
|
-
* bundle's `submitButton` still supplies `color` / `border` / `borderRadius`
|
|
19
|
-
* / `boxShadow` so typography + shape stay on-theme. Hover (`colorPrimaryHover`)
|
|
20
|
-
* is applied by each button's `onMouseEnter`/`onMouseLeave` at the call site.
|
|
21
|
-
*/
|
|
22
|
-
export declare function derivePrimaryTileStyle(opts: {
|
|
23
|
-
themeBundle: import('@flopay/shared').ThemeBundle | null | undefined;
|
|
24
|
-
resolvedPrimaryColor: string;
|
|
25
|
-
resolvedBorderRadius: string;
|
|
26
|
-
submitButtonStyle?: React.CSSProperties;
|
|
27
|
-
/**
|
|
28
|
-
* Raw `appearance.colorPrimary` (undefined when the merchant didn't set one).
|
|
29
|
-
* When present it forces a primary-filled tile even with no theme bundle
|
|
30
|
-
* (the `classic` preset), so an explicit `colorPrimary` override always wins
|
|
31
|
-
* over the historic white tile.
|
|
32
|
-
*/
|
|
33
|
-
explicitPrimaryColor?: string;
|
|
34
|
-
}): React.CSSProperties;
|
|
35
|
-
export interface SplitCardFormProps {
|
|
36
|
-
/** The checkout session ID (UUID from billing API). */
|
|
37
|
-
sessionId: string;
|
|
38
|
-
/**
|
|
39
|
-
* Session-bound checkout token returned by session creation
|
|
40
|
-
* (`CheckoutSessionResult.nonce` or `session.clientSecret`). Forwarded as
|
|
41
|
-
* `x-checkout-session-token` on every continuation request — required by
|
|
42
|
-
* post-#640 backends. `FloPayCheckout` plumbs this prop automatically.
|
|
43
|
-
*/
|
|
44
|
-
nonce?: string;
|
|
45
|
-
/** Billing API base URL. Optional — defaults to the value from FloPayProvider or the shared constant. */
|
|
46
|
-
billingApiUrl?: string;
|
|
47
|
-
/** Flo-owned privacy-safe telemetry is enabled by default; set false to opt out. */
|
|
48
|
-
telemetry?: boolean;
|
|
49
|
-
/** User's email (required for creating payment intents). */
|
|
50
|
-
email?: string;
|
|
51
|
-
/** User ID (required for processing payments). */
|
|
52
|
-
userId?: string;
|
|
53
|
-
/** Called when the full payment flow completes successfully. */
|
|
54
|
-
onComplete?: (result: PaymentResult) => void;
|
|
55
|
-
/** Called when a payment error occurs. */
|
|
56
|
-
onError?: (error: FloPayError) => void;
|
|
57
|
-
/** Called when a payment is declined or the authentication step fails. */
|
|
58
|
-
onDecline?: (decline: DeclineEvent) => void;
|
|
59
|
-
/**
|
|
60
|
-
* Called once when the buyer closes or leaves the direct PayPal button's
|
|
61
|
-
* PayPal window without approving. Not called for Stripe-rendered PayPal.
|
|
62
|
-
*/
|
|
63
|
-
onCancel?: (event: FloPayPaymentCancelEvent) => void;
|
|
64
|
-
/**
|
|
65
|
-
* **Override**: If provided, delegates backend submission to the caller.
|
|
66
|
-
* When omitted, processes internally (calls processPayment + handles 3DS).
|
|
67
|
-
*/
|
|
68
|
-
onTokenizedBody?: (tokenizedBody: TokenizedBody) => void;
|
|
69
|
-
/** First name for billing. */
|
|
70
|
-
firstName?: string;
|
|
71
|
-
/** Last name for billing. */
|
|
72
|
-
lastName?: string;
|
|
73
|
-
/** Checkout version for A/B tracking. */
|
|
74
|
-
chv?: string;
|
|
75
|
-
/** Additional CSS class for the form wrapper. */
|
|
76
|
-
className?: string;
|
|
77
|
-
/**
|
|
78
|
-
* Final wording for the hosted card form's submit button — the control that
|
|
79
|
-
* starts the card payment — e.g. `'Pay $10'` (billing API v1.9.35+). Pass
|
|
80
|
-
* the final, already-localized plain text from your own order summary; the
|
|
81
|
-
* SDK does not format amounts or translate.
|
|
82
|
-
*
|
|
83
|
-
* Changes apply live without remounting the card form, so buyer-entered
|
|
84
|
-
* card details, focus, and caret are kept. Omitting it, passing `null`, or
|
|
85
|
-
* clearing it after a label was shown restores the hosted default
|
|
86
|
-
* (`CONFIRM PAYMENT`); blank, oversized, or invalid text also shows the
|
|
87
|
-
* default. It does not change wallet, PayPal, processing, or retry wording,
|
|
88
|
-
* the buttons-layout card tile (`cardButtonContent`), or the saved-payment
|
|
89
|
-
* confirm button (`FloPayCheckout`'s `confirmLabel`).
|
|
90
|
-
*/
|
|
91
|
-
submitLabel?: string | null;
|
|
92
|
-
/** External processing state. */
|
|
93
|
-
isProcessing?: boolean;
|
|
94
|
-
/** External error message. */
|
|
95
|
-
error?: string | null;
|
|
96
|
-
/** Called when internal error state changes. */
|
|
97
|
-
onErrorChange?: (error: string | null) => void;
|
|
98
|
-
/**
|
|
99
|
-
* Show the PayPal payment surface above the hosted vault card surface. Defaults to `true`.
|
|
100
|
-
* The renderer is chosen from `session.gateways.paypal`: when that gateway
|
|
101
|
-
* is configured, `DirectPayPalButton` (PayPal JS SDK) takes over and Stripe
|
|
102
|
-
* drops `paypal` from its express row to avoid double-rendering; otherwise
|
|
103
|
-
* PayPal renders inside `ExpressCheckoutElement` (using either a dedicated
|
|
104
|
-
* `gateways.stripe.paypalPublishableKey` sub-account or the main Stripe
|
|
105
|
-
* account when the enabled-methods list includes `paypal`).
|
|
106
|
-
*/
|
|
107
|
-
showPayPal?: boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Show Stripe-rendered wallets and APMs (ExpressCheckoutElement +
|
|
110
|
-
* PaymentElement). Defaults to `true`. When `false`, every Stripe surface
|
|
111
|
-
* is hidden — only `DirectPayPalButton` can render. Setting both
|
|
112
|
-
* `showStripe={false}` and `showPayPal={false}` (with no PayPal gateway
|
|
113
|
-
* configured) throws a bootstrap-time validation error.
|
|
114
|
-
*/
|
|
115
|
-
showStripe?: boolean;
|
|
116
|
-
/**
|
|
117
|
-
* Preferred approval presentation for supported wallets. Defaults to
|
|
118
|
-
* `'auto'`. Safety signals and provider capability remain authoritative.
|
|
119
|
-
*/
|
|
120
|
-
walletPresentation?: WalletPresentation;
|
|
121
|
-
/**
|
|
122
|
-
* Per-session list of Stripe payment method type identifiers (as returned
|
|
123
|
-
* by the billing API on `gateways.stripe.enabledPaymentMethods`). When
|
|
124
|
-
* supplied, drives the contents of the `ExpressCheckoutElement` row and the
|
|
125
|
-
* accordion `PaymentElement` instead of the historic hardcoded
|
|
126
|
-
* Apple/Google/PayPal set. `card` is reserved for the hosted card path: it
|
|
127
|
-
* advertises that `/vault/capture` recovery is available when the session
|
|
128
|
-
* has no embedded vault block. When omitted, the SDK falls back to the
|
|
129
|
-
* legacy `showApplePay`/`showGooglePay`/`showPayPal` toggles.
|
|
130
|
-
*/
|
|
131
|
-
enabledPaymentMethods?: string[];
|
|
132
|
-
/**
|
|
133
|
-
* Per-method buyer-country gate from `gateways.stripe.enabledPaymentMethodCountries`
|
|
134
|
-
* (method → allowed ISO-3166-1 alpha-2 countries; a method absent here has no
|
|
135
|
-
* country gate). The SDK filters the rendered tile row by the buyer's *live*
|
|
136
|
-
* country against this map, so per-method country eligibility comes from the
|
|
137
|
-
* backend rather than a hardcoded SDK table. When omitted (legacy backend),
|
|
138
|
-
* the SDK falls back to its built-in {@link STRIPE_METHOD_COUNTRIES} table.
|
|
139
|
-
*/
|
|
140
|
-
enabledPaymentMethodCountries?: Record<string, string[]>;
|
|
141
|
-
/**
|
|
142
|
-
* @deprecated The Apple Pay / Google Pay surface is now driven by the
|
|
143
|
-
* `gateways.stripe.enabledPaymentMethods` list returned per-session by the
|
|
144
|
-
* billing API. Pass {@link SplitCardFormProps.enabledPaymentMethods} (or
|
|
145
|
-
* upgrade the backend so `FloPayCheckout` threads it through automatically).
|
|
146
|
-
* Setting this prop emits a one-time deprecation warning and is otherwise
|
|
147
|
-
* ignored when `enabledPaymentMethods` is supplied.
|
|
148
|
-
*/
|
|
149
|
-
showApplePay?: boolean;
|
|
150
|
-
/**
|
|
151
|
-
* @deprecated See {@link SplitCardFormProps.showApplePay}.
|
|
152
|
-
*/
|
|
153
|
-
showGooglePay?: boolean;
|
|
154
|
-
/**
|
|
155
|
-
* Layout mode for the payment form.
|
|
156
|
-
* - `'default'` — all payment methods + card form shown together (current behavior)
|
|
157
|
-
* - `'buttons'` — PayPal, wallets, and a "Credit / Debit Card" button; clicking the card
|
|
158
|
-
* button expands the card form with a back button to return to the button view
|
|
159
|
-
*/
|
|
160
|
-
layout?: 'default' | 'buttons';
|
|
161
|
-
/**
|
|
162
|
-
* The merchant's rules for the order of the payment method groups: `'card'`,
|
|
163
|
-
* `'paypal'`, `'wallets'` (Apple Pay / Google Pay) and `'apms'` (Stripe's
|
|
164
|
-
* alternative payment methods), with optional per-country rules. The billing
|
|
165
|
-
* API applies them to each buyer (the session's country, else the buyer's IP
|
|
166
|
-
* country) and the form shows the order it resolves. Without the prop the
|
|
167
|
-
* order is PayPal, wallets, APMs, then card, with no request. While the
|
|
168
|
-
* first answer is pending the methods show placeholders; if the billing API
|
|
169
|
-
* is slow or unavailable, the default `order` applies. On the default
|
|
170
|
-
* layout, Card first puts the card form above the buttons; anywhere else it
|
|
171
|
-
* stays below "or pay with card". The rules can change after mount: a group
|
|
172
|
-
* whose place changes is mounted again, so set them before the buyer starts
|
|
173
|
-
* paying. Hiding a group stays the job of `showPayPal` / `showStripe` /
|
|
174
|
-
* `enabledPaymentMethods`. Billing API warnings about invalid rules are
|
|
175
|
-
* logged to the console.
|
|
176
|
-
*
|
|
177
|
-
* `moreOptions` (default and per country) puts groups behind a closed
|
|
178
|
-
* "More payment options" link: under the buttons on the buttons layout,
|
|
179
|
-
* and under the buttons, above "or pay with card", on the default layout,
|
|
180
|
-
* where the card form always stays in view. Opening it reveals them in the
|
|
181
|
-
* resolved order for good and emits `more_options_opened` on
|
|
182
|
-
* `onInstrument`. When nothing available would stay in view every group
|
|
183
|
-
* shows without a link, and when nothing behind it is available there is
|
|
184
|
-
* no link.
|
|
185
|
-
*/
|
|
186
|
-
paymentMethodLayout?: PaymentMethodLayoutRules;
|
|
187
|
-
/**
|
|
188
|
-
* The text of the "More payment options" link that `paymentMethodLayout`'s
|
|
189
|
-
* `moreOptions` adds. Pass final, already-localized plain text; omit it for
|
|
190
|
-
* the default, "More payment options".
|
|
191
|
-
*/
|
|
192
|
-
moreOptionsLabel?: string;
|
|
193
|
-
/**
|
|
194
|
-
* High-level theme bundle that styles non-card Stripe Elements, the FloPay
|
|
195
|
-
* wrapper / AVS inputs, and the hosted vault widget. One of:
|
|
196
|
-
* `'classic'` (historic FloPay look, no bundle applied), `'modern-light'`,
|
|
197
|
-
* `'modern-dark'`, `'bold-light'`, `'bold-dark'`, `'glass-light'`,
|
|
198
|
-
* `'glass-dark'`. Explicit `appearance` / `buttonsStyles` props still
|
|
199
|
-
* override their respective halves when provided.
|
|
200
|
-
*/
|
|
201
|
-
theme?: import('@flopay/shared').ThemeId;
|
|
202
|
-
/**
|
|
203
|
-
* @deprecated Use `theme` instead. Legacy buttons-layout preset
|
|
204
|
-
* (`'default' | 'minimal' | 'rounded' | 'dark'`). Still honored for
|
|
205
|
-
* back-compat — the new union accepts the bundle ids too but you should
|
|
206
|
-
* migrate to the `theme` prop.
|
|
207
|
-
*/
|
|
208
|
-
buttonsTheme?: import('@flopay/shared').ButtonsLayoutTheme;
|
|
209
|
-
/** Style overrides merged on top of the resolved theme bundle / buttonsTheme preset. */
|
|
210
|
-
buttonsStyles?: import('@flopay/shared').ButtonsLayoutStyles;
|
|
211
|
-
/**
|
|
212
|
-
* Appearance from `FloPayProvider` / `FloPayCheckout`. Threaded through so
|
|
213
|
-
* the React-rendered wrapper, AVS inputs, title, and hosted vault widget can
|
|
214
|
-
* derive colors from `appearance.variables` when no explicit `buttonsStyles`
|
|
215
|
-
* is supplied. Bundle consumers (`THEMES[id]`) get a coherent look without
|
|
216
|
-
* having to forward both halves manually.
|
|
217
|
-
*/
|
|
218
|
-
appearance?: import('@flopay/shared').FloPayAppearance;
|
|
219
|
-
/** Custom React content rendered inside the card button when `layout="buttons"`. */
|
|
220
|
-
cardButtonContent?: React.ReactNode;
|
|
221
|
-
/** Custom React content rendered for the buttons-layout card back button label. */
|
|
222
|
-
cardBackButtonContent?: React.ReactNode;
|
|
223
|
-
/** Custom React content rendered for the card-form title. */
|
|
224
|
-
cardTitleContent?: React.ReactNode;
|
|
225
|
-
/**
|
|
226
|
-
* @deprecated No longer rendered — the default-layout security footer was
|
|
227
|
-
* removed alongside the theme-bundle refactor. Retained as an optional
|
|
228
|
-
* prop so existing integrations type-check without changes.
|
|
229
|
-
*/
|
|
230
|
-
showSecurityFooter?: boolean;
|
|
231
|
-
/**
|
|
232
|
-
* Called when a payment method button is clicked.
|
|
233
|
-
* `method`: `'card'` | `'paypal'` | `'apple_pay'` | `'google_pay'`
|
|
234
|
-
*/
|
|
235
|
-
onButtonClick?: (method: CheckoutButtonMethod) => void;
|
|
236
|
-
/**
|
|
237
|
-
* Called before a payment button continues in `layout="buttons"`.
|
|
238
|
-
* Runs for card, PayPal, Apple Pay, and Google Pay.
|
|
239
|
-
*/
|
|
240
|
-
onBeforeButtonClick?: (event: BeforeButtonClickEvent) => MaybePromise<undefined | false | InlineSessionPatch>;
|
|
241
|
-
/**
|
|
242
|
-
* Called after checkout collects a missing buyer email/name. FloPayCheckout
|
|
243
|
-
* uses this to claim an email-less detached session before payment continues.
|
|
244
|
-
*/
|
|
245
|
-
onBuyerIdentityReady?: (identity: NonNullable<InlineSessionPatch['account']>) => MaybePromise<void>;
|
|
246
|
-
/**
|
|
247
|
-
* Enable AVS (Address Verification).
|
|
248
|
-
* - `true` — show country + postal code (backward compatible default)
|
|
249
|
-
* - `AVSFieldConfig` — granular per-field control, optionally scoped to country codes
|
|
250
|
-
* - `false` / omitted — AVS disabled
|
|
251
|
-
*/
|
|
252
|
-
enableAVS?: boolean | AVSFieldConfig;
|
|
253
|
-
/**
|
|
254
|
-
* Per-merchant order of the hosted vault card rows — a permutation of
|
|
255
|
-
* `['name','number','expiry']` (`'expiry'` is the combined expiry+CVV row;
|
|
256
|
-
* the submit button stays last). Drives both the visual order and the tab
|
|
257
|
-
* order inside the widget. Omit for the default (`name`, `number`, `expiry`).
|
|
258
|
-
* Only applies on the vault card path.
|
|
259
|
-
*/
|
|
260
|
-
cardFieldOrder?: import('@flopay/shared').VaultCardFieldKey[];
|
|
261
|
-
/**
|
|
262
|
-
* Show the Visa, Mastercard, Amex and Discover icons in the hosted card number
|
|
263
|
-
* field. Only `true` turns them on; omitted or `false` keeps the field as it is.
|
|
264
|
-
* Only applies on the vault card path; an older hosted form ignores it.
|
|
265
|
-
*/
|
|
266
|
-
showCardBrandIcons?: boolean;
|
|
267
|
-
/**
|
|
268
|
-
* Show the visible labels above the hosted card fields. Omitted sends nothing,
|
|
269
|
-
* so the form looks as it does today. Vault card path only.
|
|
270
|
-
*/
|
|
271
|
-
showCardFieldLabels?: boolean;
|
|
272
|
-
/**
|
|
273
|
-
* Replace the text of the labels (`number`, `expiry`, `cvv`, `name`). Only the
|
|
274
|
-
* fields you set are sent. Vault card path only.
|
|
275
|
-
*/
|
|
276
|
-
cardFieldLabels?: CardFieldLabels;
|
|
277
|
-
/**
|
|
278
|
-
* Placeholder text for the hosted card fields (`number`, `expiry`, `cvv`,
|
|
279
|
-
* `name`), each optional. Only the fields given are sent; the rest keep the
|
|
280
|
-
* hosted form's wording, and `''` shows no placeholder. A change updates the
|
|
281
|
-
* mounted form live (compared by content, so a new object with the same text
|
|
282
|
-
* sends nothing). Omitted sends nothing. Only applies on the vault card path.
|
|
283
|
-
*/
|
|
284
|
-
cardFieldPlaceholders?: CardFieldPlaceholders;
|
|
285
|
-
/**
|
|
286
|
-
* Opt out of the hosted card widget's automatic initial focus (and the host-side
|
|
287
|
-
* initial identity/AVS field focus). `false` disables it; omitted or `true` keeps
|
|
288
|
-
* the default, which never focuses the card over fields rendered above it.
|
|
289
|
-
*/
|
|
290
|
-
cardAutoFocus?: boolean;
|
|
291
|
-
/**
|
|
292
|
-
* The hosted card fields are on screen and the buyer can type in them. Once per card
|
|
293
|
-
* form, with the milliseconds since the form mounted.
|
|
294
|
-
*/
|
|
295
|
-
onCardFieldsReady?: (event: import('@flopay/shared').CardFieldsReadyEvent) => void;
|
|
296
|
-
/**
|
|
297
|
-
* The hosted card fields failed to load (`load_error`, `blocked`, `other`) or were not
|
|
298
|
-
* ready within `cardFieldsTimeoutMs` (`timeout`). Not a declined or failed payment.
|
|
299
|
-
*/
|
|
300
|
-
onCardFieldsFailed?: (event: import('@flopay/shared').CardFieldsFailedEvent) => void;
|
|
301
|
-
/** Milliseconds the card fields may take to become ready before `timeout` (default 15 000). */
|
|
302
|
-
cardFieldsTimeoutMs?: number;
|
|
303
|
-
/** Content rendered above the hosted vault card widget (below the wallet divider). */
|
|
304
|
-
cardPreFormSlot?: React.ReactNode;
|
|
305
|
-
/** Layout for AVS fields: 'row' (side-by-side, default) or 'column' (stacked). */
|
|
306
|
-
avsLayout?: 'row' | 'column';
|
|
307
|
-
/** Pre-filled country code (ISO 3166-1 alpha-2) for AVS. */
|
|
308
|
-
country?: string;
|
|
309
|
-
/** Pre-filled ZIP/postal code for AVS. */
|
|
310
|
-
zip?: string;
|
|
311
|
-
/** Pre-filled street address (line 1) for AVS. Typically from a partner GeoIP / profile lookup. */
|
|
312
|
-
addressLine1?: string;
|
|
313
|
-
/** Pre-filled apt/suite/unit (line 2) for AVS. */
|
|
314
|
-
addressLine2?: string;
|
|
315
|
-
/** Pre-filled city for AVS. Typically from a partner GeoIP / profile lookup. */
|
|
316
|
-
city?: string;
|
|
317
|
-
/** Pre-filled state/province for AVS. Typically from a partner GeoIP / profile lookup. */
|
|
318
|
-
state?: string;
|
|
319
|
-
/** Callback when AVS country changes. */
|
|
320
|
-
onCountryChange?: (country: string) => void;
|
|
321
|
-
/** Callback when AVS ZIP/postal code changes. */
|
|
322
|
-
onZipChange?: (zip: string) => void;
|
|
323
|
-
/** Whether AVS was enabled (sent to backend for analytics). */
|
|
324
|
-
avsCheck?: boolean;
|
|
325
|
-
/** Checkout type: 'standard_checkout' or 'embedded_checkout'. */
|
|
326
|
-
checkoutType?: string;
|
|
327
|
-
/** Checkout layout: 'default_layout', 'buttons_layout', or 'custom_layout'. */
|
|
328
|
-
checkoutLayout?: string;
|
|
329
|
-
/** Total amount in cents (smallest currency unit). Used for wallet/PayPal Elements config. */
|
|
330
|
-
totalAmount?: number;
|
|
331
|
-
/** Currency code (used for PayPal Elements config). */
|
|
332
|
-
currency?: string;
|
|
333
|
-
/** Render the card form expanded on first paint when `layout="buttons"`. */
|
|
334
|
-
initialCardOpen?: boolean;
|
|
335
|
-
/**
|
|
336
|
-
* Direct PayPal gateway configuration. When provided, PayPal renders via
|
|
337
|
-
* the official PayPal JS SDK (in-app browser compliant) instead of via
|
|
338
|
-
* Stripe's ExpressCheckoutElement. Selection is mutually exclusive:
|
|
339
|
-
* setting this disables the Stripe-rendered PayPal path automatically.
|
|
340
|
-
*/
|
|
341
|
-
directPaypal?: {
|
|
342
|
-
clientId: string;
|
|
343
|
-
environment?: GatewayEnvironment;
|
|
344
|
-
/**
|
|
345
|
-
* @deprecated The active session's
|
|
346
|
-
* `gateways.paypal.providerObjectType` advertisement is authoritative.
|
|
347
|
-
* Retained as a fallback for integrations that do not supply a session.
|
|
348
|
-
*/
|
|
349
|
-
providerObjectType?: PayPalProviderObjectType;
|
|
350
|
-
/** Backend-advertised non-popup presentation for one-time PayPal Orders. */
|
|
351
|
-
approvalPresentation?: import('@flopay/shared').PayPalApprovalPresentation;
|
|
352
|
-
/** Backend-created PayPal object to resume without creating a replacement. */
|
|
353
|
-
existingOrderId?: string;
|
|
354
|
-
};
|
|
355
|
-
/** Whether the active session represents a subscription (drives direct PayPal intent). */
|
|
356
|
-
isSubscription?: boolean;
|
|
357
|
-
/** Backing session — forwarded to direct-PayPal so it can populate accountData. */
|
|
358
|
-
session?: CheckoutSession | null;
|
|
359
|
-
/**
|
|
360
|
-
* True while a **detached** session's claim is waiting for buyer identity or
|
|
361
|
-
* is still in flight (TeamFloPay/backend#1099).
|
|
362
|
-
*
|
|
363
|
-
* The hosted card widget is already mounted and the buyer can fill it in, but
|
|
364
|
-
* the session has no cart attached yet, so nothing may be submitted: the
|
|
365
|
-
* billing API rejects process / intent calls on an unclaimed session with
|
|
366
|
-
* `409 checkout_session_data_attachment_required`, and holds an unclaimed
|
|
367
|
-
* vault charge with a retryable `503`. While true, card submit stays gated.
|
|
368
|
-
* Non-card surfaces also stay hidden unless they are needed to collect the
|
|
369
|
-
* missing identity; all payment continuations enable when the claim lands.
|
|
370
|
-
* `FloPayCheckout` plumbs this prop automatically.
|
|
371
|
-
*/
|
|
372
|
-
dataAttachmentPending?: boolean;
|
|
373
|
-
/**
|
|
374
|
-
* True when the pending detached claim is waiting for this form to collect
|
|
375
|
-
* buyer identity. Non-card collection surfaces remain available, while all
|
|
376
|
-
* payment continuations still await `onBuyerIdentityReady`.
|
|
377
|
-
*/
|
|
378
|
-
dataAttachmentRequiresIdentity?: boolean;
|
|
379
|
-
/**
|
|
380
|
-
* Enables on-screen diagnostic panels for the PayPal/wallet gating decision
|
|
381
|
-
* and the `DirectPayPalButton` lifecycle. Intended for debugging in-app
|
|
382
|
-
* browsers where remote console access is impractical. Off by default.
|
|
383
|
-
*/
|
|
384
|
-
debug?: boolean;
|
|
385
|
-
}
|
|
386
|
-
/**
|
|
387
|
-
* Checkout surface combining hosted vault card capture with wallets, APMs,
|
|
388
|
-
* and PayPal. Card entry is hosted-vault-only.
|
|
389
|
-
*
|
|
390
|
-
* Stripe-hosted PayPal uses its own Elements instance; direct PayPal uses the
|
|
391
|
-
* official PayPal SDK when the session advertises that gateway.
|
|
392
|
-
*/
|
|
393
|
-
export declare function SplitCardForm(props: SplitCardFormProps): React.JSX.Element;
|