@flopay/react 1.20.14 → 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
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @flopay/react
|
|
2
2
|
|
|
3
|
-
React bindings for the FloPay SDK: a drop-in `FloPayCheckout`, a no-charge `FloPayCardSetup` and `FloPayPaymentMethodSetup`, a one-click `FloPayAutomaticPaymentButton`, composable checkout components
|
|
3
|
+
React bindings for the FloPay SDK: a drop-in `FloPayCheckout`, a no-charge `FloPayCardSetup` and `FloPayPaymentMethodSetup`, a one-click `FloPayAutomaticPaymentButton`, and composable checkout components. Each component mounts the Flo-hosted checkout runtime from `@flopay/js`: cards are collected by the billing API's hosted PCI card form, and wallets, alternative payment methods, and PayPal render beside it from the session's `paymentMethods`.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -131,83 +131,13 @@ Set `cardAutoFocus={false}` on `FloPayCheckout` or `SplitCardForm` to turn that
|
|
|
131
131
|
- **Default.** Omitted or `true` keeps the existing behaviour. `true` does not make the card form take focus over identity or AVS fields rendered above it.
|
|
132
132
|
- **Custom layouts.** `FloPayCheckout` forwards the prop to its built-in form. A `SplitCardForm` you render as a custom-layout child takes its own `cardAutoFocus`.
|
|
133
133
|
|
|
134
|
-
#### Card brand icons
|
|
135
|
-
|
|
136
|
-
Set `showCardBrandIcons` on `FloPayCheckout` or `SplitCardForm` to show the Visa, Mastercard, Amex and Discover icons on the right of the hosted card number field:
|
|
137
|
-
|
|
138
|
-
```tsx
|
|
139
|
-
<FloPayCheckout sessionId={sessionId} nonce={sessionNonce} showCardBrandIcons />
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
- **Opt-in.** Only `true` turns the icons on. Omitted or `false` leaves the card form exactly as it was.
|
|
143
|
-
- **Live updates.** Changing the prop updates the hosted form in place, without remounting it or clearing entered card details. The SDK re-sends the setting whenever the hosted form becomes ready again.
|
|
144
|
-
- **Brand narrowing.** The hosted form narrows the icons to the brand the buyer types. The SDK does nothing for that, and no brand is reported back to your page.
|
|
145
|
-
- **Compatibility.** A billing API whose card form predates the icons ignores the setting and keeps the field as it was.
|
|
146
|
-
- **Custom layouts.** `FloPayCheckout` forwards the prop to its built-in form. A `SplitCardForm` you render as a custom-layout child takes its own `showCardBrandIcons`.
|
|
147
|
-
|
|
148
|
-
#### Card field labels
|
|
149
|
-
|
|
150
|
-
Set `showCardFieldLabels` on `FloPayCheckout` or `SplitCardForm` to show visible labels above the hosted card fields, and `cardFieldLabels` to change their text:
|
|
151
|
-
|
|
152
|
-
```tsx
|
|
153
|
-
<FloPayCheckout
|
|
154
|
-
sessionId={sessionId}
|
|
155
|
-
nonce={sessionNonce}
|
|
156
|
-
showCardFieldLabels
|
|
157
|
-
cardFieldLabels={{ number: 'Card number', expiry: 'Valid until', cvv: 'Security code' }}
|
|
158
|
-
appearance={{ rules: { '.Label': { color: '#475569', fontWeight: '500', marginBottom: '6px' } } }}
|
|
159
|
-
/>
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
- **Opt-in.** When both props are omitted, nothing is sent and the card form looks as it does today. `false` hides the labels again.
|
|
163
|
-
- **Text.** `cardFieldLabels` takes optional `number`, `expiry`, `cvv` and `name` text (`CardFieldLabels`). Only the fields you set are sent, exactly as given: the hosted form shows the text literally. A field you leave out keeps the hosted form's default wording, and removing the prop restores all of them.
|
|
164
|
-
- **Live updates.** Changing either prop updates the hosted form in place, without remounting it or clearing entered card details. The SDK re-sends the settings whenever the hosted form becomes ready again.
|
|
165
|
-
- **Custom layouts.** `FloPayCheckout` forwards both props to its built-in form. A `SplitCardForm` you render as a custom-layout child takes its own.
|
|
166
|
-
- **Authenticated.** Like a custom submit label, the label settings are bound to the session and the card form's `messageToken`, and the SDK sends them only to the hosted form's exact `expectedOrigin`, never to `'*'`. A card form without them (an older billing API) receives no label settings and keeps its default look.
|
|
167
|
-
|
|
168
|
-
The labels are styled by the same `appearance.rules['.Label']` rule that styles Stripe's labels, so one setting styles both. The supported `.Label` properties are:
|
|
169
|
-
|
|
170
|
-
| `.Label` property | Hosted label |
|
|
171
|
-
|---|---|
|
|
172
|
-
| `color` | Text colour |
|
|
173
|
-
| `fontSize` | Font size, in `px` (`'13px'`) |
|
|
174
|
-
| `fontWeight` | Font weight (`'500'`, or `normal` / `bold`) |
|
|
175
|
-
| `letterSpacing` | Letter spacing, in `em` (`'0.05em'`) |
|
|
176
|
-
| `textTransform` | `none`, `uppercase`, `lowercase` or `capitalize` |
|
|
177
|
-
| `marginBottom` | The gap between the label and its field, in `px` (`'6px'`) |
|
|
178
|
-
|
|
179
|
-
Every other `.Label` property (for example `padding`, `border`, `marginTop`, `fontFamily` or `lineHeight`) is ignored, as are empty values and values of the wrong type; none of them raises an error. Without a supported `.Label` property, the theme sent to the hosted form is unchanged. The preset themes already style `.Label`, so their label style applies as soon as the labels are shown. The hosted form enforces its own bounds on the values.
|
|
180
|
-
|
|
181
|
-
#### Card field placeholders
|
|
182
|
-
|
|
183
|
-
Set `cardFieldPlaceholders` on `FloPayCheckout` or `SplitCardForm` to choose the placeholder text of the hosted card fields. Every field is optional: `number` (card number), `expiry` (expiry date), `cvv` (security code) and `name` (name on card):
|
|
184
|
-
|
|
185
|
-
```tsx
|
|
186
|
-
<FloPayCheckout
|
|
187
|
-
sessionId={sessionId}
|
|
188
|
-
nonce={sessionNonce}
|
|
189
|
-
cardFieldPlaceholders={{
|
|
190
|
-
number: 'Card number',
|
|
191
|
-
expiry: 'MM / YY',
|
|
192
|
-
cvv: 'CVC',
|
|
193
|
-
name: 'Name on card',
|
|
194
|
-
}}
|
|
195
|
-
/>
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
- **Only what you set.** Omitted, the card form looks exactly as it does today and nothing is sent. A field you leave out keeps the hosted form's own wording. An empty string (`''`) shows no placeholder in that field.
|
|
199
|
-
- **Plain text.** The text is sent as given, with no trimming or validation in the SDK. The hosted form enforces its own length limit and shows the text literally, never as markup. Placeholder colour and font come from the existing theme settings.
|
|
200
|
-
- **Live updates.** Changing the prop updates the hosted form in place, without remounting it or clearing entered card details. The comparison is by content, so passing a new object with the same text on each render sends nothing more. The SDK re-sends the latest text whenever the hosted form becomes ready again, so it survives a reload. Removing the prop restores the hosted form's wording.
|
|
201
|
-
- **Security.** Like the submit label, the text is sent only to the hosted form's exact origin, bound to the session.
|
|
202
|
-
- **Custom layouts.** `FloPayCheckout` forwards the prop to its built-in form. A `SplitCardForm` you render as a custom-layout child takes its own `cardFieldPlaceholders`.
|
|
203
|
-
|
|
204
134
|
#### Wallets and alternative payment methods
|
|
205
135
|
|
|
206
|
-
The payment-method list is
|
|
136
|
+
The payment-method list is session-driven: the session's `paymentMethods` says which of `card`, `paypal`, `wallets` and `apms` the billing API offers this buyer, and the hosted runtime renders exactly those. Apple Pay, Google Pay, PayPal, Link, Amazon Pay, and Klarna render as express buttons; every other offered method (for example Cash App Pay, Affirm, iDEAL, Bancontact, SEPA Debit) renders in an accordion. Enabling a new method for the merchant needs no SDK or application change. Wallets render only on supported devices.
|
|
207
137
|
|
|
208
|
-
`card`
|
|
138
|
+
`card` keeps **Credit / Debit Card** available; the runtime fetches the hosted card form on demand when the session has no embedded card form.
|
|
209
139
|
|
|
210
|
-
- `
|
|
140
|
+
- `hiddenPaymentMethods` hides offered methods by method or group name, never by processor: `card` (the card form), `paypal`, `apple_pay`, `google_pay` and `apms` (the other payment methods). It only removes methods the session offers and never adds one. `showPayPal={false}` is the same as listing `paypal`. The 1.x `showStripe`, `showApplePay` and `showGooglePay` props are removed; **Breaking changes in 2.0.0** under Public API maps each to its hide list.
|
|
211
141
|
- In `layout="buttons"`, **Credit / Debit Card** opens the inline card form. Cancelling a wallet or PayPal silently returns to the chooser. A technical failure after the click (including popup blocking, or a provider closing without a result) restores the chooser, focuses a retry control for that method, shows safe method-specific copy such as `We couldn't open Google Pay. Try again or choose another payment method.`, and calls `onError` with a `FloPayError`. A method that is unavailable before the click just disappears.
|
|
212
142
|
- **Wallet availability.** Every enabled express wallet, Apple Pay and Google Pay included, is requested from Stripe as `'auto'`, never `'always'`, so Stripe's own device and wallet-setup checks decide whether its button is shown. A wallet appears only when Stripe's availability result reports it available for this buyer; when Stripe reports none of the enabled wallets, the wallet row collapses and PayPal and card stay. `FloPayPaymentMethodSetup` and the Vue components use the same rule.
|
|
213
143
|
- **Stalled wallet clicks.** Stripe allows a wallet click about one second, so the SDK gives `onBeforeButtonClick` (and any session patch it returns) a 900 ms budget. When that budget runs out, the click is rejected once, `onError` receives one `external_payment_method_failed` whose `details.providerCode` is `express_checkout_click_timeout`, and the buyer sees the usual retry copy with a wallet retry. Whatever the stalled hook does later (succeeds, throws, or its session patch fails) is ignored for that click.
|
|
@@ -216,25 +146,25 @@ The payment-method list is gateway-driven: the billing API sends `gateways.strip
|
|
|
216
146
|
- **Small desktop windows.** Desktop Chrome refuses to open the Google Pay sheet when the browser window cannot fit it (about 680 by 640 CSS pixels of content; a docked DevTools pane counts) and reports only a cancel. In such a window the SDK denies the Payment Request API to the frames Stripe creates, so Google Pay opens in Google's own window, as it does on mobile and in Safari or Firefox. The choice is made when the wallet row mounts and re-evaluated on resize while no wallet attempt or payment is in flight. Should Chrome still refuse a sheet, `onError` receives `external_payment_method_failed` with `details.providerCode` `wallet_sheet_window_too_small` and the buyer is asked to enlarge the window or choose another method.
|
|
217
147
|
- Wallet confirmation has one 25-second SDK budget inside the provider's 30-second callback deadline. If a wallet omits required buyer identity, the authorization is failed promptly, the SDK collects the missing email, and the buyer reopens the wallet to continue.
|
|
218
148
|
- **Confirmation recovery.** Google Pay and Apple Pay authentication can outlive the SDK's observation window. The SDK never cancels that provider promise: it reads the original intent's status and settles once. A successful intent continues to payment exactly once; a cancelled or failed intent offers a wallet retry; an intent still needing action, or a status that cannot be read, keeps payment locked and offers only **Check payment status**. A retry after a lost intent-create response reuses the same authorization attempt id, so no second intent can be created.
|
|
219
|
-
-
|
|
149
|
+
- Wallet and PayPal availability come from the session's `paymentMethods` alone; to keep a wallet off for your checkout, list it in `hiddenPaymentMethods`.
|
|
220
150
|
|
|
221
151
|
#### PayPal
|
|
222
152
|
|
|
223
|
-
The
|
|
153
|
+
The hosted runtime renders PayPal one of two ways, chosen per session by the billing API:
|
|
224
154
|
|
|
225
|
-
- **Direct PayPal** (preferred, and works inside Facebook, Instagram, and other in-app browsers): when the session
|
|
226
|
-
- **Stripe-routed PayPal**: when only
|
|
155
|
+
- **Direct PayPal** (preferred, and works inside Facebook, Instagram, and other in-app browsers): when the session offers PayPal as its own gateway, PayPal renders through the official PayPal JS SDK with the client id and `environment` (`sandbox` or `live`) from the billing API. If only PayPal is offered, the runtime loads no other processor.
|
|
156
|
+
- **Stripe-routed PayPal**: when the session offers PayPal only through Stripe, an ordinary browser renders PayPal through Stripe Express Checkout. Instagram, generic Android WebViews, and other known in-app browsers instead get a Flo-owned PayPal tile that starts Stripe's full-page hosted approval without mounting the popup-bound Express element.
|
|
227
157
|
|
|
228
158
|
`walletPresentation` is a bounded merchant preference shared by `FloPayCheckout` and `SplitCardForm`: `auto` (the default) and `popup` retain Express Checkout in an ordinary browser, while `prefer_redirect` selects the Flo tile. Browser safety remains authoritative, so a known in-app browser or a positive popup block switches Stripe-routed PayPal to the tile for the rest of the checkout session even when `popup` was requested. The tile still creates the session-scoped Stripe PayPal intent, stores the bounded continuation, and calls Stripe with the current page as `return_url` and `redirect: 'if_required'`. On return, the SDK resumes the same checkout session without creating a duplicate payment. Apple Pay and Google Pay are unchanged and are not affected by this preference.
|
|
229
159
|
|
|
230
|
-
Direct PayPal never hides its button behind a FloPay identity step: after approval the SDK reads the payer's email and name, and asks once for anything missing.
|
|
160
|
+
Direct PayPal never hides its button behind a FloPay identity step: after approval the SDK reads the payer's email and name, and asks once for anything missing. The session's PayPal operation, set by the billing API, selects what the buyer approves: `order` (a one-time Order, even for a subscription-mode session), `subscription` (a PayPal-managed subscription), or `setup_token` (vault the account; the approval token is exchanged by the billing API). `approvalPresentation` selects the bounded `app_switch` mode only for a one-time Order in an in-app browser, where it enables PayPal's app switch; ordinary browsers, subscriptions, and setup tokens keep the popup flow. It is a mode, never a URL. If an in-app popup is blocked, `onTechnicalFailure` on `DirectPayPalButton` receives `popupBlocked: true` with guidance to open the page in the system browser, and PayPal stays visible for retry.
|
|
231
161
|
|
|
232
162
|
**Initialization recovery.** A Direct PayPal startup failure hides PayPal, waits one second, and remounts once, without creating a session, intent, or charge; other payment methods stay usable throughout. If Stripe-rendered PayPal is also available, it takes over during recovery. If both attempts fail in a mixed checkout, PayPal stays hidden and neither `onError` nor `onDecline` fires. In a PayPal-only checkout the component shows an accessible retrying status, then a **Retry PayPal** button, and calls `onError` once with `paypal_init_timeout`.
|
|
233
163
|
|
|
234
164
|
**Buyer cancel (`onCancel`).** `FloPayCheckout`, `SplitCardForm` and `DirectPayPalButton` accept an optional `onCancel?: (event: FloPayPaymentCancelEvent) => void`. It is called once per click when the buyer closes the PayPal pop-up, or returns from PayPal's app switch, without approving. The `FloPayPaymentCancelEvent` is `{ status: 'cancelled', sessionId, provider: 'paypal', paymentMethodType }`: `sessionId` is the attempt's session (the one your `onBeforeButtonClick` patch returned, otherwise the checkout's), and `paymentMethodType` is `paypal_vaulted` when the session advertises an `order` or `setup_token`, otherwise `paypal`.
|
|
235
165
|
|
|
236
166
|
- It is never called for an approval, a decline (that stays `onDecline`), a blocked pop-up, a load, render or eligibility failure, the reconciliation timeout, or a click your `onBeforeButtonClick` stopped. A repeated or stale cancel for the same click is ignored.
|
|
237
|
-
- It covers the direct PayPal button only (sessions
|
|
167
|
+
- It covers the direct PayPal button only (sessions that offer PayPal as its own gateway). Stripe-rendered PayPal does not report it.
|
|
238
168
|
- Nothing else changes: the PayPal button still remounts for the next click and `onDecline` is untouched. If you don't pass it, checkout behaves exactly as before, and a callback that throws does not break the button.
|
|
239
169
|
|
|
240
170
|
A "Didn't work? Pay another way" prompt that moves the buyer to the card form:
|
|
@@ -270,7 +200,7 @@ function Checkout({ sessionId, nonce }: { sessionId: string; nonce: string }) {
|
|
|
270
200
|
The billing API can route hosted and eligible saved cards to an approved Worldpay Corporate Gateway, processed entirely server-side. Your checkout code does not change:
|
|
271
201
|
|
|
272
202
|
- **No gateway choice.** The billing API selects the gateway and decides stored-credential eligibility. The SDK sends no gateway choice, Worldpay capability, merchant code, scheme reference, or eligibility assertion; the detached create's `routingProducts` names the cart's products, never a gateway. An Auto create advertises only the provider-neutral `async-auto-checkout-v1` response capability; Confirm and Full creates do not send it. A detached Full create and its claims carry only `stripe-account-switch-v1` (see **Stripe account routing** above).
|
|
273
|
-
- **Same card surface.** No Stripe runtime, Worldpay SDK, or browser credential is involved. An open session
|
|
203
|
+
- **Same card surface.** No Stripe runtime, Worldpay SDK, or browser credential is involved. An open session routed to a server-side card gateway that omits the embedded card form recovers it on demand; a completed or authorized session is never shown the card form again.
|
|
274
204
|
- **Same saved-card flow.** Returning-buyer Auto and Confirm checkouts, including subscription creation, call the provider-neutral `/process` route without card re-entry or `tokenizedData`. Immediate and asynchronously reconciled success, authorization, decline, and error outcomes reach the existing callbacks and UI states. Scheduled rebills, retry, dunning, credential eligibility, and reconciliation remain backend-owned.
|
|
275
205
|
- **Explicit unsupported use.** `stored_payment_method_unsupported` reaches `onError` with the buyer-safe instruction to choose another payment method. The SDK does not silently switch behavior, and older backends that omit the optional code remain compatible.
|
|
276
206
|
- **Same authentication.** When the buyer's bank asks for 3DS, the SDK renders the provider-hosted challenge in a modal dialog over your page (`role="dialog"`, `aria-modal`, focus moved into the challenge and restored when it closes), posts the existing provider-neutral `/3ds/complete` continuation once after the authenticated return, and reconciles the terminal attempt through `/status`. The challenge URL never reaches a callback, instrument, telemetry event, log, or browser storage; the only instrument signal is opaque `3ds_challenge`.
|
|
@@ -278,16 +208,16 @@ The billing API can route hosted and eligible saved cards to an approved Worldpa
|
|
|
278
208
|
|
|
279
209
|
#### Themes and layouts
|
|
280
210
|
|
|
281
|
-
`FloPayCheckout`, `FloPayAutomaticPaymentButton`, `SplitCardForm`, and `
|
|
211
|
+
`FloPayCardSetup` and `FloPayPaymentMethodSetup` accept one `theme` prop, a `ThemeId`, and the hosted runtime applies it to the setup form (see **FloPayCardSetup** below). The checkout components (`FloPayCheckout`, `FloPayAutomaticPaymentButton`, `SplitCardForm`, `DirectPayPalButton` and `VaultCardFields`) accept the same prop and forward it to the runtime unchanged; see **Known limits in 2.0.0** under Public API.
|
|
282
212
|
|
|
283
213
|
| Theme | Aesthetic |
|
|
284
214
|
|-------|-----------|
|
|
285
|
-
| `classic` | The historic FloPay look (no bundle applied)
|
|
215
|
+
| `classic` | The historic FloPay look (no bundle applied) |
|
|
286
216
|
| `modern-light` / `modern-dark` | Clean and airy: Inter, soft shadows, FloPay-blue accents |
|
|
287
217
|
| `bold-light` / `bold-dark` | Saturated FloPay blue with a gradient pill submit and heavy borders |
|
|
288
218
|
| `glass-light` / `glass-dark` | Translucent surfaces with backdrop blur over a blue gradient |
|
|
289
219
|
|
|
290
|
-
|
|
220
|
+
On the setup components, `appearance` and `buttonsStyles` still win over the bundle for the fields they touch; see the [ButtonsLayoutStyles reference](https://flopay.com/docs/technical-reference/react/flopay-checkout#buttonslayoutstyles-reference) for every override field.
|
|
291
221
|
|
|
292
222
|
`layout="buttons"` stacks the payment methods as buttons with an expandable card form, and can change at runtime without recreating the session. In that layout, `onButtonClick` reports every method click, `onDecline` reports declines and cancellations, and `onBeforeButtonClick` runs before a method continues: return an `InlineSessionPatch` to update the inline draft, or `false` to stop. Keep it well under 900 ms for PayPal, Apple Pay, and Google Pay, because it runs during the provider's button handshake (see **Stalled wallet clicks** above).
|
|
293
223
|
|
|
@@ -448,7 +378,7 @@ export function AddBrandedCard(props: { sessionId: string; nonce: string; theme:
|
|
|
448
378
|
|
|
449
379
|
`FloPayAutomaticPaymentButton` is a single reusable button that creates an `auto` checkout session inline (or reuses a `sessionId`), lets the billing API charge the customer's most recently saved payment method across providers, and shows the shared processing, success, and failure modal. It accepts either `sessionId` and `nonce`, or the session-creation props `clientId`, `items`, `subscriptions`, `products`, `account`, `successUrl`, `cancelUrl`, `couponCodes`, `tagsData`, and `utmMetadata`. `children` render inside the button.
|
|
450
380
|
|
|
451
|
-
When the saved payment method cannot complete silently, the button opens a `FloPayCheckout
|
|
381
|
+
When the saved payment method cannot complete silently, the button opens a `FloPayCheckout`. The `paymentMethodId` and `checkoutMethod` props are deprecated and ignored: the billing API selects the payment method and gateway.
|
|
452
382
|
|
|
453
383
|
Give exactly one of `sessionId`, `getSession` or an inline draft (`createSession` or the session-creation props); a click with more than one reports a `validation_error` through `onError` and makes no request. Inline creation is deprecated: the billing API may create a Full checkout for a keyless Auto session, and outside production the button logs a one-time warning pointing at `getSession`.
|
|
454
384
|
|
|
@@ -474,12 +404,12 @@ Nothing is fetched at render. `getSession` is called once per click (a double cl
|
|
|
474
404
|
|
|
475
405
|
### Composing your own checkout
|
|
476
406
|
|
|
477
|
-
`FloPayProvider
|
|
407
|
+
`FloPayProvider` and `SplitCardForm` let you compose the provider and session yourself; the 1.x hooks are removed in 2.0.0, because the hosted runtime holds the checkout state. Card checkout still uses the hosted card form: supply the session (with its `vault` block) and nonce, or a session that offers `card` in its `paymentMethods` so the form can be fetched on demand. A session with neither never calls the recovery endpoint; its other methods remain usable, and if none remain `onError` receives `UnsupportedBackendVaultCapability`. `FloPayCheckout` and `SplitCardForm` never fall back to Stripe card fields.
|
|
478
408
|
|
|
479
409
|
- Wallets, alternative methods, and PayPal create intents through the nonce-protected session intent route, and client-observed failures use the session decline route without tokens, provider object ids, card data, or personal data.
|
|
480
410
|
- **Hosted card form.** The widget owns the card fields, its own submit button, tokenization, the charge, 3DS, and the result, so no Stripe.js runs on the card path. `SplitCardForm` renders no card fields or submit button of its own, and Host-collected AVS fields remain outside the PCI widget and gate its submit. After the widget reports it is submitting, the processing overlay stays up until `complete`, `decline`, `error`, or the buyer closing the authentication challenge — which takes the overlay down but keeps the form's submit held until that attempt reports an outcome. In `layout="buttons"`, the recovery request for the form waits until the buyer selects Card, and concurrent renders share one request.
|
|
481
411
|
- **AVS.** With `enableAVS`, the SDK collects the billing address outside the PCI form and gates the form's submit synchronously on it. The postcode is validated against the selected country with the same rules as the billing API: a supported country blocks an empty or malformed postcode with an inline message, and a country without postcodes makes the field optional. Email and street, city, and state fields gate submit the same way. On submit, the address is saved in parallel with the charge: a rejected address (`4xx`) shows inline and reaches `onError` for the next attempt, while a transient failure or a 10-second timeout falls back to the session's saved address and still completes.
|
|
482
|
-
-
|
|
412
|
+
- The hosted runtime keeps the card form's submit held while a detached session shell is not yet safe to charge; the 1.x `useCheckout()` hook that exposed this as `claimPending` is removed.
|
|
483
413
|
|
|
484
414
|
### Upgrading from 1.9.x
|
|
485
415
|
|
|
@@ -493,233 +423,68 @@ Merchants on 1.9.4, or any other 1.9.x release, need no configuration change to
|
|
|
493
423
|
|
|
494
424
|
## Examples
|
|
495
425
|
|
|
496
|
-
|
|
426
|
+
Checkout with a session your server created. `FloPayProvider` hands the publishable key and the Flo-hosted runtime URL to every component below it, and each runtime event reaches the matching callback with its payload unchanged:
|
|
497
427
|
|
|
498
428
|
```tsx
|
|
499
|
-
import { FloPayCheckout } from '@flopay/react';
|
|
429
|
+
import { FloPayCheckout, FloPayProvider } from '@flopay/react';
|
|
500
430
|
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
<FloPayCheckout
|
|
504
|
-
sessionId={sessionId}
|
|
505
|
-
nonce={nonce}
|
|
506
|
-
theme="modern-light"
|
|
507
|
-
submitLabel="Pay $10"
|
|
508
|
-
onComplete={(result) => {
|
|
509
|
-
if (result.status === 'authorized') {
|
|
510
|
-
console.log('Funds held for payment', result.paymentId, 'until', result.authorizationExpiresAt);
|
|
511
|
-
}
|
|
512
|
-
window.location.assign('/success');
|
|
513
|
-
}}
|
|
514
|
-
onDecline={(decline) => console.warn(`${decline.method} declined: ${decline.message}`)}
|
|
515
|
-
onError={(error) => {
|
|
516
|
-
if (error.code === 'checkout_session_expired') {
|
|
517
|
-
window.location.assign('/checkout/expired');
|
|
518
|
-
return;
|
|
519
|
-
}
|
|
520
|
-
console.error(error.message);
|
|
521
|
-
}}
|
|
522
|
-
onSessionCompleted={(successUrl) => window.location.assign(successUrl)}
|
|
523
|
-
/>
|
|
524
|
-
);
|
|
525
|
-
}
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
Create the session inline, with the buttons layout, a just-in-time email step for cards, and analytics:
|
|
431
|
+
declare const publishableKey: string;
|
|
432
|
+
declare const runtimeUrl: string; // the Flo-hosted runtime entry for your environment
|
|
529
433
|
|
|
530
|
-
|
|
531
|
-
import { type FloInstrumentEvent, FloPayCheckout } from '@flopay/react';
|
|
532
|
-
|
|
533
|
-
function trackInstrument(event: FloInstrumentEvent) {
|
|
534
|
-
console.log('checkout instrument', event.name, event);
|
|
535
|
-
}
|
|
536
|
-
|
|
537
|
-
export function InlineCheckout() {
|
|
538
|
-
return (
|
|
539
|
-
<FloPayCheckout
|
|
540
|
-
layout="buttons"
|
|
541
|
-
theme="bold-dark"
|
|
542
|
-
createSession={{
|
|
543
|
-
clientId: 'your-client-id',
|
|
544
|
-
currency: 'EUR',
|
|
545
|
-
items: [{ providerItemId: 'product-1', providerItemName: 'Widget', totalAmount: 29.99 }],
|
|
546
|
-
account: { userId: 'user_1' },
|
|
547
|
-
successUrl: '/success',
|
|
548
|
-
cancelUrl: '/cancel',
|
|
549
|
-
checkoutMetadata: { merchantOrderId: 'order-123' },
|
|
550
|
-
idempotencyKey: 'checkout:order-123',
|
|
551
|
-
}}
|
|
552
|
-
onBeforeButtonClick={async ({ method, createSession }) => {
|
|
553
|
-
if (method !== 'card') {
|
|
554
|
-
return { checkoutMetadata: { merchantOrderId: 'order-123', selectedMethod: method } };
|
|
555
|
-
}
|
|
556
|
-
const email = window.prompt('Email for your receipt', createSession?.account.email ?? '');
|
|
557
|
-
return email ? { account: { email } } : false;
|
|
558
|
-
}}
|
|
559
|
-
onButtonClick={(method) => console.log('clicked', method)}
|
|
560
|
-
onInstrument={trackInstrument}
|
|
561
|
-
onComplete={() => window.location.assign('/success')}
|
|
562
|
-
/>
|
|
563
|
-
);
|
|
564
|
-
}
|
|
565
|
-
```
|
|
566
|
-
|
|
567
|
-
Authorise a one-time card payment now and capture it later from your server:
|
|
568
|
-
|
|
569
|
-
```tsx
|
|
570
|
-
import { FloPayCheckout } from '@flopay/react';
|
|
571
|
-
|
|
572
|
-
export function AuthorisationCheckout() {
|
|
434
|
+
export function CheckoutPage({ sessionId, nonce }: { sessionId: string; nonce: string }) {
|
|
573
435
|
return (
|
|
574
|
-
<
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
}}
|
|
584
|
-
onComplete={(result) => {
|
|
585
|
-
if (result.status === 'authorized') {
|
|
586
|
-
void fetch('/api/authorisations', {
|
|
587
|
-
method: 'POST',
|
|
588
|
-
headers: { 'Content-Type': 'application/json' },
|
|
589
|
-
body: JSON.stringify({
|
|
590
|
-
paymentId: result.paymentId,
|
|
591
|
-
sessionId: result.sessionId,
|
|
592
|
-
expiresAt: result.authorizationExpiresAt,
|
|
593
|
-
}),
|
|
594
|
-
});
|
|
595
|
-
}
|
|
596
|
-
}}
|
|
597
|
-
onSessionCompleted={(successUrl) => window.location.assign(successUrl)}
|
|
598
|
-
/>
|
|
436
|
+
<FloPayProvider publishableKey={publishableKey} runtimeUrl={runtimeUrl}>
|
|
437
|
+
<FloPayCheckout
|
|
438
|
+
sessionId={sessionId}
|
|
439
|
+
nonce={nonce}
|
|
440
|
+
hiddenPaymentMethods={['apple_pay', 'google_pay']}
|
|
441
|
+
onComplete={(event) => console.log('complete', event)}
|
|
442
|
+
onDecline={(event) => console.log('decline', event)}
|
|
443
|
+
/>
|
|
444
|
+
</FloPayProvider>
|
|
599
445
|
);
|
|
600
446
|
}
|
|
601
447
|
```
|
|
602
448
|
|
|
603
|
-
|
|
449
|
+
Card setup from the `@flopay/react/card-setup` subpath:
|
|
604
450
|
|
|
605
451
|
```tsx
|
|
606
452
|
import { FloPayCardSetup } from '@flopay/react/card-setup';
|
|
607
453
|
|
|
608
|
-
|
|
609
|
-
return (
|
|
610
|
-
<FloPayCardSetup
|
|
611
|
-
sessionId={sessionId}
|
|
612
|
-
nonce={nonce}
|
|
613
|
-
theme="glass-dark"
|
|
614
|
-
containerStyle={{ borderColor: '#60A5FA', padding: 16 }}
|
|
615
|
-
onComplete={({ paymentMethod }) => {
|
|
616
|
-
// Display-only when present; re-list cards from your server when it is absent.
|
|
617
|
-
console.log(paymentMethod?.brand, paymentMethod?.lastFour);
|
|
618
|
-
}}
|
|
619
|
-
onDecline={({ message }) => console.warn(message)}
|
|
620
|
-
onValidation={(message) => console.log(message)}
|
|
621
|
-
onError={(error) => console.error(error.code, error.retryable ? 'retry' : 'do not retry')}
|
|
622
|
-
onCancel={() => console.log('Card setup closed before it finished')}
|
|
623
|
-
/>
|
|
624
|
-
);
|
|
625
|
-
}
|
|
626
|
-
```
|
|
454
|
+
declare const runtimeUrl: string;
|
|
627
455
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
```tsx
|
|
631
|
-
import { FloPayPaymentMethodSetup } from '@flopay/react/payment-method-setup';
|
|
632
|
-
|
|
633
|
-
export function AddPaymentMethod({ sessionId, nonce }: { sessionId: string; nonce: string }) {
|
|
456
|
+
export function SaveCard({ sessionId, nonce }: { sessionId: string; nonce: string }) {
|
|
634
457
|
return (
|
|
635
|
-
<
|
|
458
|
+
<FloPayCardSetup
|
|
636
459
|
sessionId={sessionId}
|
|
637
460
|
nonce={nonce}
|
|
638
|
-
|
|
639
|
-
onComplete={(
|
|
640
|
-
// Verified by the billing API. `paymentMethod` is present for cards; re-list methods from
|
|
641
|
-
// your server for the rest.
|
|
642
|
-
console.log('Saved', paymentMethod?.brand ?? 'payment method');
|
|
643
|
-
}}
|
|
644
|
-
onDecline={({ message }) => console.warn(message)}
|
|
645
|
-
onError={(error) => console.error(error.code, error.retryable ? 'retry' : 'do not retry')}
|
|
646
|
-
onCancel={() => console.log('Setup closed before it finished')}
|
|
461
|
+
runtimeUrl={runtimeUrl}
|
|
462
|
+
onComplete={(event) => console.log('saved', event)}
|
|
647
463
|
/>
|
|
648
464
|
);
|
|
649
465
|
}
|
|
650
466
|
```
|
|
651
467
|
|
|
652
|
-
|
|
468
|
+
One-click payment with the buyer's saved payment method, from a session your server mints when the buyer clicks:
|
|
653
469
|
|
|
654
470
|
```tsx
|
|
471
|
+
import type { CheckoutRuntimeSuppliedSession } from '@flopay/js';
|
|
655
472
|
import { FloPayAutomaticPaymentButton } from '@flopay/react';
|
|
656
473
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
<FloPayAutomaticPaymentButton
|
|
660
|
-
clientId="your-client-id"
|
|
661
|
-
account={{ userId: 'user_1', email: 'user@example.com' }}
|
|
662
|
-
items={[
|
|
663
|
-
{
|
|
664
|
-
providerItemId: 'upsell_1',
|
|
665
|
-
providerItemName: 'AI Supercharger Pack',
|
|
666
|
-
totalAmount: 249,
|
|
667
|
-
overrideAmount: 80,
|
|
668
|
-
currency: 'EUR',
|
|
669
|
-
quantity: 1,
|
|
670
|
-
},
|
|
671
|
-
]}
|
|
672
|
-
successUrl="https://shop.example.com/success"
|
|
673
|
-
cancelUrl="https://shop.example.com/cancel"
|
|
674
|
-
theme="bold-dark"
|
|
675
|
-
onClick={() => console.log('automatic payment button clicked')}
|
|
676
|
-
onSuccess={({ sessionId, autoCompleted }) => console.log('paid', sessionId, autoCompleted)}
|
|
677
|
-
onDecline={(decline) => console.warn('declined', decline.message)}
|
|
678
|
-
onError={(error) => console.error(error.message)}
|
|
679
|
-
>
|
|
680
|
-
Purchase Item
|
|
681
|
-
</FloPayAutomaticPaymentButton>
|
|
682
|
-
);
|
|
683
|
-
}
|
|
684
|
-
```
|
|
685
|
-
|
|
686
|
-
Compose the provider, a checkout surface, and the hooks yourself:
|
|
474
|
+
declare const publishableKey: string;
|
|
475
|
+
declare const runtimeUrl: string;
|
|
687
476
|
|
|
688
|
-
|
|
689
|
-
import { loadFloPay } from '@flopay/js';
|
|
690
|
-
import type { CheckoutSession } from '@flopay/shared';
|
|
691
|
-
import { FloPayProvider, SplitCardForm, useCheckout, useFloPay } from '@flopay/react';
|
|
692
|
-
|
|
693
|
-
const floPayPromise = loadFloPay('pk_test_...');
|
|
694
|
-
|
|
695
|
-
function PaymentStatus() {
|
|
696
|
-
const flopay = useFloPay();
|
|
697
|
-
const { loading, error, claimPending } = useCheckout();
|
|
698
|
-
if (!flopay || loading) return <p>Loading payment methods…</p>;
|
|
699
|
-
if (error) return <p role="alert">{error.message}</p>;
|
|
700
|
-
return claimPending ? <p>Preparing your order…</p> : null;
|
|
701
|
-
}
|
|
702
|
-
|
|
703
|
-
export function ComposedCheckout({ session, nonce }: { session: CheckoutSession; nonce: string }) {
|
|
477
|
+
export function OneClickUpsell() {
|
|
704
478
|
return (
|
|
705
|
-
<
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
currency="usd"
|
|
715
|
-
enableAVS
|
|
716
|
-
enabledPaymentMethods={session.gateways?.stripe?.enabledPaymentMethods}
|
|
717
|
-
onComplete={(result) => {
|
|
718
|
-
if (result.status === 'succeeded') window.location.assign('/success');
|
|
719
|
-
}}
|
|
720
|
-
onError={(error) => console.error(error.message)}
|
|
721
|
-
/>
|
|
722
|
-
</FloPayProvider>
|
|
479
|
+
<FloPayAutomaticPaymentButton
|
|
480
|
+
publishableKey={publishableKey}
|
|
481
|
+
runtimeUrl={runtimeUrl}
|
|
482
|
+
getSession={async ({ signal }) => {
|
|
483
|
+
const response = await fetch('/api/one-click-session', { method: 'POST', signal });
|
|
484
|
+
return (await response.json()) as CheckoutRuntimeSuppliedSession;
|
|
485
|
+
}}
|
|
486
|
+
onSuccess={(event) => console.log('paid', event.sessionId)}
|
|
487
|
+
/>
|
|
723
488
|
);
|
|
724
489
|
}
|
|
725
490
|
```
|
|
@@ -736,16 +501,13 @@ export function ComposedCheckout({ session, nonce }: { session: CheckoutSession;
|
|
|
736
501
|
| `FloPayAutomaticPaymentButton` | One-click button that charges the customer's saved payment method, falling back to `FloPayCheckout` |
|
|
737
502
|
| `FloPayProvider` | Context provider for composed checkouts |
|
|
738
503
|
| `SplitCardForm` | Checkout surface combining the hosted card form with wallets, alternative methods, and PayPal |
|
|
739
|
-
| `VaultCardFields` | The hosted PCI card form.
|
|
504
|
+
| `VaultCardFields` | The hosted PCI card form. In 2.0 it mounts the hosted runtime with only the card form shown (`hiddenPaymentMethods` lists every other method). |
|
|
740
505
|
| `DirectPayPalButton` | Standalone direct PayPal Order, PayPal-managed subscription, or setup-token button using the session intent contract |
|
|
741
506
|
|
|
742
507
|
### Hooks
|
|
743
508
|
|
|
744
509
|
| Hook | Returns | Description |
|
|
745
510
|
|------|---------|-------------|
|
|
746
|
-
| `useFloPay()` | `FloPay \| null` | The current FloPay instance, or `null` while it loads |
|
|
747
|
-
| `useCheckout()` | `CheckoutState` | `{ session, loading, error, claimPending }` for the surrounding checkout |
|
|
748
|
-
| `usePayPalFloPay()` | `FloPay \| null` | The optional FloPay instance used for Stripe-rendered PayPal |
|
|
749
511
|
|
|
750
512
|
### Other exports
|
|
751
513
|
|
|
@@ -761,62 +523,32 @@ export function ComposedCheckout({ session, nonce }: { session: CheckoutSession;
|
|
|
761
523
|
| `sessionId` | `string?` | Existing checkout session id. Required unless `createSession` is provided. |
|
|
762
524
|
| `nonce` | `string?` | Session-bound checkout token for `sessionId` |
|
|
763
525
|
| `createSession` | `InlineSessionDraft?` | Creates the session inline instead of using `sessionId` |
|
|
764
|
-
| `checkoutMode` | `CheckoutMode?` | Overrides the session's checkout mode |
|
|
765
|
-
| `billingApiUrl` | `string?` | Billing API base URL; defaults to the configured environment |
|
|
766
526
|
| `layout` | `'default' \| 'buttons'` | Payment form layout |
|
|
767
527
|
| `paymentMethodLayout` | `PaymentMethodLayoutRules?` | Order of `'card'`, `'paypal'`, `'wallets'` and `'apms'`, the groups behind "More payment options", and per-country rules, resolved for each buyer by the billing API; without it, PayPal, wallets, APMs, card, and no link |
|
|
768
|
-
| `
|
|
769
|
-
| `theme` | `ThemeId?` | Theme bundle for the whole checkout |
|
|
528
|
+
| `theme` | `ThemeId?` | Forwarded to the runtime as given; omitted, nothing is sent. See **Known limits in 2.0.0** |
|
|
770
529
|
| `appearance` | `FloPayAppearance?` | Stripe-side appearance overrides |
|
|
771
|
-
| `buttonsStyles` | `ButtonsLayoutStyles?` | Wrapper style overrides layered on the theme |
|
|
772
|
-
| `locale` | `string?` | Locale for payment elements |
|
|
773
|
-
| `submitLabel` | `string \| null` | Live wording for the hosted card submit button |
|
|
774
|
-
| `confirmLabel` | `string?` | Saved-payment button label in confirm mode |
|
|
775
|
-
| `renderConfirmButton` | `function?` | Custom confirm-mode button renderer |
|
|
776
|
-
| `showStripe` | `boolean?` | Show Stripe wallets and alternative methods (default `true`) |
|
|
777
530
|
| `showPayPal` | `boolean?` | Show PayPal (default `true`) |
|
|
778
|
-
| `
|
|
779
|
-
| `
|
|
780
|
-
| `
|
|
781
|
-
| `
|
|
782
|
-
| `
|
|
783
|
-
| `
|
|
784
|
-
| `showCardFieldLabels` | `boolean?` | Set `true` to show visible labels above the hosted card fields, styled by `appearance.rules['.Label']`; omitted sends nothing |
|
|
785
|
-
| `cardFieldLabels` | `CardFieldLabels?` | Label text (`number`, `expiry`, `cvv`, `name`); only the fields you set are sent, verbatim |
|
|
786
|
-
| `cardFieldPlaceholders` | `CardFieldPlaceholders?` | Placeholder text for the hosted card fields: `number`, `expiry`, `cvv` and `name`, each optional; `''` shows no placeholder; updates live; omitted keeps the hosted wording |
|
|
787
|
-
| `cardAutoFocus` | `boolean?` | Set `false` to stop the checkout focusing the card form (or the identity/AVS field above it) when it opens; omitted or `true` keeps the default |
|
|
788
|
-
| `cardFieldsTimeoutMs` | `number?` | Milliseconds the card fields may take to become interactive before `onCardFieldsFailed` reports `timeout` (default 15 000) |
|
|
531
|
+
| `enabledPaymentMethods` | `string[]?` | Forwarded to the runtime as given; omitted, nothing is sent. See **Known limits in 2.0.0** |
|
|
532
|
+
| `initialPayPalOrderId` | `string?` | Forwarded to the runtime as given; omitted, nothing is sent. See **Known limits in 2.0.0** |
|
|
533
|
+
| `showCardBrandIcons` | `boolean?` | Forwarded to the runtime as given; omitted, nothing is sent. See **Known limits in 2.0.0** |
|
|
534
|
+
| `showCardFieldLabels` | `boolean?` | Forwarded to the runtime as given; omitted, nothing is sent. See **Known limits in 2.0.0** |
|
|
535
|
+
| `cardFieldLabels` | `CardFieldLabels?` | `number`, `expiry`, `cvv` and `name` text, forwarded to the runtime as given; omitted, nothing is sent. See **Known limits in 2.0.0** |
|
|
536
|
+
| `cardFieldPlaceholders` | `CardFieldPlaceholders?` | `number`, `expiry`, `cvv` and `name` text, forwarded to the runtime as given; omitted, nothing is sent. See **Known limits in 2.0.0** |
|
|
789
537
|
| `onCardFieldsReady` | `(event: CardFieldsReadyEvent) => void` | The hosted card fields are interactive; once per card form, with `elapsedMs` since it mounted |
|
|
790
538
|
| `onCardFieldsFailed` | `(event: CardFieldsFailedEvent) => void` | The card fields failed to load or were not ready in time; not a decline or payment error |
|
|
791
|
-
| `cardPreFormSlot` | `ReactNode?` | Content rendered above the hosted card form |
|
|
792
|
-
| `cardButtonContent` | `ReactNode?` | Card tile content in `layout="buttons"` |
|
|
793
|
-
| `cardBackButtonContent` | `ReactNode?` | Back-button label in `layout="buttons"` |
|
|
794
|
-
| `cardTitleContent` | `ReactNode?` | Card-form title |
|
|
795
|
-
| `className` | `string?` | Extra wrapper class |
|
|
796
|
-
| `loading` | `ReactNode?` | Custom loading UI |
|
|
797
|
-
| `error` | `(error: FloPayError) => ReactNode` | Custom error UI |
|
|
798
|
-
| `initialErrorMessage` | `string \| null` | Seeds an initial error message |
|
|
799
|
-
| `children` | `ReactNode?` | Custom layout rendered instead of the default `SplitCardForm` |
|
|
800
|
-
| `telemetry` | `boolean?` | Set `false` to opt out of operational telemetry |
|
|
801
539
|
| `onComplete` | `(result: PaymentResult) => void` | Payment succeeded or was authorized |
|
|
802
540
|
| `onDecline` | `(decline: DeclineEvent) => void` | A payment was declined or authentication failed. The event carries `sessionId` when a session exists |
|
|
803
541
|
| `onCancel` | `(event: FloPayPaymentCancelEvent) => void` | The buyer closed or left the direct PayPal button's PayPal window without approving. Once per click; never for an approval, decline or technical failure |
|
|
804
542
|
| `onError` | `(error: FloPayError) => void` | A checkout error occurred |
|
|
805
|
-
| `onSessionCompleted` | `(successUrl: string) => void` | The session was already completed |
|
|
806
|
-
| `onButtonClick` | `(method: CheckoutButtonMethod) => void` | A payment method button was clicked |
|
|
807
|
-
| `onBeforeButtonClick` | `(event: BeforeButtonClickEvent) => ...` | Runs before a buttons-layout method continues; return a patch or `false`. A wallet click gives it, and any session patch it returns, a 900 ms budget; keep the work well under that |
|
|
808
543
|
| `onInstrument` | `(event: FloInstrumentEvent) => void` | Merchant instrument feed |
|
|
809
|
-
| `onCountryChange` / `onZipChange` | `(value: string) => void` | AVS country or postcode changed |
|
|
810
|
-
| `showApplePay` / `showGooglePay` / `buttonsTheme` | deprecated | Superseded by the session's methods and `theme` |
|
|
811
544
|
|
|
812
545
|
### FloPayProviderProps
|
|
813
546
|
|
|
814
547
|
| Prop | Type | Description |
|
|
815
548
|
|------|------|-------------|
|
|
816
|
-
| `
|
|
817
|
-
| `
|
|
818
|
-
| `
|
|
819
|
-
| `onInstrument` | `(event: FloInstrumentEvent) => void` | Merchant instrument feed |
|
|
549
|
+
| `publishableKey` | `string` | The publishable key the components below use when they are not given one |
|
|
550
|
+
| `runtimeUrl` | `string` | The Flo-origin runtime script the components below use when they are not given one |
|
|
551
|
+
| `flopay` | `null` | Accepted only so 1.x pages keep compiling; 2.0 holds no FloPay instance, so pass `null` or leave it out |
|
|
820
552
|
| `children` | `ReactNode` | Checkout content |
|
|
821
553
|
|
|
822
554
|
### FloPayCardSetupProps
|
|
@@ -825,13 +557,10 @@ export function ComposedCheckout({ session, nonce }: { session: CheckoutSession;
|
|
|
825
557
|
|------|------|-------------|
|
|
826
558
|
| `sessionId` | `string` | Opaque id from the merchant-authenticated setup-session endpoint |
|
|
827
559
|
| `nonce` | `string` | Session-bound token returned with `sessionId` |
|
|
828
|
-
| `billingApiUrl` | `string?` | Billing API base URL; defaults to the configured environment |
|
|
829
|
-
| `telemetry` | `boolean?` | Set `false` to opt out of operational telemetry |
|
|
830
560
|
| `theme` | `ThemeId \| VaultCardThemeColors` | Preset (default `modern-light`) or raw hosted-form colors |
|
|
831
561
|
| `appearance` | `FloPayAppearance?` | Stored appearance; replaces the preset's, as in `FloPayCheckout` |
|
|
832
562
|
| `buttonsStyles` | `ButtonsLayoutStyles?` | Stored buttons-layout overrides merged over the preset, as in `FloPayCheckout` |
|
|
833
563
|
| `containerStyle` | `CSSProperties?` | Container styles merged over the preset surface |
|
|
834
|
-
| `loading` | `ReactNode?` | Content shown while the session and form load |
|
|
835
564
|
| `onReady` | `() => void` | The hosted form is mounted and accepting input |
|
|
836
565
|
| `onComplete` | `(event: FloPayCardSetupCompleteEvent) => void` | The card is verified and usable |
|
|
837
566
|
| `onDecline` | `(event: FloPayCardSetupDeclineEvent) => void` | Verification was declined |
|
|
@@ -861,20 +590,10 @@ Also accepts every standard `button` attribute, such as `onClick`, `disabled`, a
|
|
|
861
590
|
| `sessionId` / `nonce` | `string?` | Reuse an existing auto-mode session |
|
|
862
591
|
| `getSession` | `({ signal }: { signal: AbortSignal }) => Promise<OneClickSession>` | Fetches a server-minted `{ sessionId, nonce }` (from `@flopay/node` `createOneClick`) on click. 15s timeout, aborted on unmount |
|
|
863
592
|
| `createSession` | `InlineSessionDraft?` | Inline draft for the session to create (deprecated: use `getSession`) |
|
|
864
|
-
| `
|
|
865
|
-
| `items` / `subscriptions` / `products` | arrays | Cart for inline creation |
|
|
866
|
-
| `account` | `object?` | Buyer account; `userId` required, `email` optional |
|
|
867
|
-
| `successUrl` / `cancelUrl` | `string?` | Redirect targets |
|
|
868
|
-
| `couponCodes` | `string[]?` | Coupons to apply |
|
|
869
|
-
| `tagsData` / `utmMetadata` | objects | Analytics context |
|
|
870
|
-
| `billingApiUrl` | `string?` | Billing API base URL |
|
|
871
|
-
| `locale` | `string?` | Locale for the fallback checkout |
|
|
872
|
-
| `theme` | `ThemeId?` | Theme for the button and its fallback checkout |
|
|
873
|
-
| `appearance` / `buttonsStyles` | objects | Appearance overrides |
|
|
593
|
+
| `theme` | `ThemeId?` | Forwarded to the runtime as given; omitted, nothing is sent. See **Known limits in 2.0.0** |
|
|
874
594
|
| `onSuccess` | `(event: FloPayAutomaticPaymentSuccessEvent) => void` | Payment completed |
|
|
875
595
|
| `onDecline` | `(decline: DeclineEvent) => void` | Payment declined. Carries the failed session's `sessionId` |
|
|
876
596
|
| `onError` | `(error: FloPayError) => void` | Payment or setup error. Carries `sessionId` when the failure happened after the session was created |
|
|
877
|
-
| `children` | `ReactNode?` | Button content |
|
|
878
597
|
|
|
879
598
|
### SplitCardFormProps
|
|
880
599
|
|
|
@@ -882,50 +601,25 @@ Also accepts every standard `button` attribute, such as `onClick`, `disabled`, a
|
|
|
882
601
|
|------|------|-------------|
|
|
883
602
|
| `sessionId` | `string` | Checkout session id |
|
|
884
603
|
| `nonce` | `string?` | Session-bound token forwarded on intent, decline, account, and process calls |
|
|
885
|
-
| `session` | `CheckoutSession \| null` | Session capability data, including the optional `vault` block and gateways |
|
|
886
|
-
| `billingApiUrl` | `string?` | Billing API base URL |
|
|
887
|
-
| `email` / `userId` / `firstName` / `lastName` | `string?` | Buyer details |
|
|
888
|
-
| `totalAmount` | `number?` | Amount in the smallest currency unit, for wallet and PayPal configuration |
|
|
889
|
-
| `currency` | `string?` | Currency code for wallet and PayPal configuration |
|
|
890
604
|
| `layout` | `'default' \| 'buttons'` | Payment form layout |
|
|
891
605
|
| `paymentMethodLayout` | `PaymentMethodLayoutRules?` | Order of `'card'`, `'paypal'`, `'wallets'` and `'apms'`, the groups behind "More payment options", and per-country rules, resolved for each buyer by the billing API; without it, PayPal, wallets, APMs, card, and no link |
|
|
892
|
-
| `
|
|
893
|
-
| `
|
|
894
|
-
| `
|
|
895
|
-
| `
|
|
896
|
-
| `
|
|
897
|
-
| `
|
|
898
|
-
| `enableAVS` | `boolean \| AVSFieldConfig` | Collect and validate the billing address |
|
|
899
|
-
| `cardFieldOrder` | `VaultCardFieldKey[]?` | Order of the hosted card rows |
|
|
900
|
-
| `showCardBrandIcons` | `boolean?` | Set `true` to show the Visa, Mastercard, Amex and Discover icons in the hosted card number field; omitted or `false` keeps the field as it is |
|
|
901
|
-
| `showCardFieldLabels` | `boolean?` | Set `true` to show visible labels above the hosted card fields, styled by `appearance.rules['.Label']`; omitted sends nothing |
|
|
902
|
-
| `cardFieldLabels` | `CardFieldLabels?` | Label text (`number`, `expiry`, `cvv`, `name`); only the fields you set are sent, verbatim |
|
|
903
|
-
| `cardFieldPlaceholders` | `CardFieldPlaceholders?` | Placeholder text for the hosted card fields: `number`, `expiry`, `cvv` and `name`, each optional; `''` shows no placeholder; updates live; omitted keeps the hosted wording |
|
|
904
|
-
| `cardAutoFocus` | `boolean?` | Set `false` to stop the form focusing the hosted card (or the identity/AVS field above it) when it opens; omitted or `true` keeps the default |
|
|
905
|
-
| `cardFieldsTimeoutMs` | `number?` | Milliseconds the card fields may take to become interactive before `onCardFieldsFailed` reports `timeout` (default 15 000) |
|
|
606
|
+
| `theme` | `ThemeId?` | Forwarded to the runtime as given, as on `FloPayCheckout` |
|
|
607
|
+
| `enabledPaymentMethods` | `string[]?` | Forwarded to the runtime as given, as on `FloPayCheckout` |
|
|
608
|
+
| `showCardBrandIcons` | `boolean?` | Forwarded to the runtime as given, as on `FloPayCheckout` |
|
|
609
|
+
| `showCardFieldLabels` | `boolean?` | Forwarded to the runtime as given, as on `FloPayCheckout` |
|
|
610
|
+
| `cardFieldLabels` | `CardFieldLabels?` | Forwarded to the runtime as given, as on `FloPayCheckout` |
|
|
611
|
+
| `cardFieldPlaceholders` | `CardFieldPlaceholders?` | Forwarded to the runtime as given, as on `FloPayCheckout` |
|
|
906
612
|
| `onCardFieldsReady` / `onCardFieldsFailed` | callbacks | Card-field lifecycle; see **Card-field lifecycle** above |
|
|
907
|
-
| `onBuyerIdentityReady` | `(identity) => MaybePromise<void>` | Attach a buyer identity collected by the form; `FloPayCheckout` wires its late-buyer claim here |
|
|
908
|
-
| `onTokenizedBody` | `(body: TokenizedBody) => void` | Take over non-card backend submission yourself |
|
|
909
613
|
| `onComplete` / `onDecline` / `onError` | callbacks | Checkout outcomes |
|
|
910
614
|
| `onCancel` | `(event: FloPayPaymentCancelEvent) => void` | The buyer left the direct PayPal button's PayPal window without approving; see the PayPal section above |
|
|
911
|
-
| `directPaypal` | `object?` | Direct PayPal client configuration when wiring PayPal manually; `FloPayCheckout` resolves it from `gateways.paypal` |
|
|
912
|
-
| `showApplePay` / `showGooglePay` | deprecated | Superseded by the session's `enabledPaymentMethods` |
|
|
913
615
|
|
|
914
616
|
### DirectPayPalButtonProps
|
|
915
617
|
|
|
916
618
|
| Prop | Type | Description |
|
|
917
619
|
|------|------|-------------|
|
|
918
620
|
| `sessionId` / `nonce` | `string` | Checkout session and its token |
|
|
919
|
-
| `billingApiUrl` | `string` | Billing API base URL |
|
|
920
|
-
| `clientId` | `string` | PayPal client id (`gateways.paypal.publishableKey`) |
|
|
921
|
-
| `environment` | `GatewayEnvironment?` | `sandbox` or `live` |
|
|
922
|
-
| `currency` | `string` | ISO 4217 currency code |
|
|
923
|
-
| `isSubscription` | `boolean` | Fallback flow selection when the session advertises no `providerObjectType` |
|
|
924
|
-
| `approvalPresentation` | `PayPalApprovalPresentation?` | Billing-API-advertised approval mode |
|
|
925
|
-
| `session` | `CheckoutSession \| null` | Backing session; its advertised values are authoritative |
|
|
926
621
|
| `onComplete` / `onDecline` | callbacks | Payment outcomes |
|
|
927
622
|
| `onCancel` | `(event: FloPayPaymentCancelEvent) => void` | The buyer closed or left PayPal without approving; once per click |
|
|
928
|
-
| `onTechnicalFailure` | callback | Post-click technical failures, including `popupBlocked` |
|
|
929
623
|
|
|
930
624
|
### Types
|
|
931
625
|
|
|
@@ -946,14 +640,8 @@ Also accepts every standard `button` attribute, such as `onClick`, `disabled`, a
|
|
|
946
640
|
| `SplitCardFormProps` | Props for `SplitCardForm` |
|
|
947
641
|
| `DirectPayPalButtonProps` | Props for `DirectPayPalButton` |
|
|
948
642
|
| `VaultCardFieldsProps` | Props for `VaultCardFields` |
|
|
949
|
-
| `CheckoutState` | `session`, `loading`, `error`, `claimPending?` |
|
|
950
643
|
| `DeclineEvent` | `method`, `message`, `code?`, `declineCode?` |
|
|
951
644
|
| `FloPayPaymentCancelEvent` | Buyer left the direct PayPal button without approving: `status: 'cancelled'`, `sessionId`, `provider: 'paypal'`, `paymentMethodType` (`paypal` or `paypal_vaulted`) |
|
|
952
|
-
| `BeforeButtonClickEvent` | `method`, `sessionId?`, `createSession?` |
|
|
953
|
-
| `CheckoutButtonMethod` | The payment method a button represents |
|
|
954
|
-
| `InlineSessionDraft` | Draft accepted by `FloPayCheckoutProps.createSession` |
|
|
955
|
-
| `InlineSessionPatch` | Partial draft returned from `FloPayCheckoutProps.onBeforeButtonClick` |
|
|
956
|
-
| `WalletPresentation` | Closed wallet presentation preference: `auto`, `popup`, or `prefer_redirect` |
|
|
957
645
|
| `PaymentMethodGroup` | A group `paymentMethodLayout` can place: `'card'`, `'paypal'`, `'wallets'` or `'apms'` |
|
|
958
646
|
| `PaymentMethodLayoutRules` | `{ order?: PaymentMethodGroup[]; moreOptions?: PaymentMethodGroup[]; countryRules?: PaymentMethodCountryRule[] }`, the merchant's layout rules |
|
|
959
647
|
| `PaymentMethodCountryRule` | `{ countries: string[]; order?: PaymentMethodGroup[]; moreOptions?: PaymentMethodGroup[] }`, a rule for buyers in the listed ISO 3166-1 alpha-2 countries |
|
|
@@ -963,6 +651,43 @@ Also accepts every standard `button` attribute, such as `onClick`, `disabled`, a
|
|
|
963
651
|
| `CardFieldsFailureReason` | `'load_error'`, `'timeout'`, `'blocked'` or `'other'` |
|
|
964
652
|
| `CardFieldsEvent` | `CardFieldsReadyEvent \| CardFieldsFailedEvent` |
|
|
965
653
|
|
|
654
|
+
### Breaking changes in 2.0.0
|
|
655
|
+
|
|
656
|
+
`@flopay/react` 2.0.0 keeps every 1.x component name (`FloPayProvider`, `FloPayCheckout`, `FloPayAutomaticPaymentButton`, `DirectPayPalButton`, `FloPayCardSetup`, `FloPayPaymentMethodSetup`, `SplitCardForm`, `VaultCardFields`). Each one now loads the hosted checkout runtime, passes its props to it and relays its events to the same callbacks with the payload unchanged. The package holds no business rules, no buyer-facing wording and no payment processor SDK: `@stripe/stripe-js`, `@stripe/react-stripe-js` and `@paypal/paypal-js` are no longer dependencies. `FloPayRuntimeCheckout`, `FloPayRuntimeCardSetup` and `FloPayRuntimePaymentMethodSetup` are aliases of `FloPayCheckout`, `FloPayCardSetup` and `FloPayPaymentMethodSetup`. `@flopay/js`, `@flopay/react`, `@flopay/vue`, `@flopay/node` and `@flopay/shared` are released together as 2.0.0.
|
|
657
|
+
|
|
658
|
+
No public prop, option or type names a payment processor any more. Payment methods are hidden by method with `hiddenPaymentMethods`, a list of `'card' | 'paypal' | 'apple_pay' | 'google_pay' | 'apms'` forwarded to the runtime, which does the hiding.
|
|
659
|
+
|
|
660
|
+
- `showStripe`: `showStripe: false` becomes `hiddenPaymentMethods={['apple_pay', 'google_pay', 'apms']}` (the wallets and other methods, not the card form and not PayPal).
|
|
661
|
+
- `showApplePay`: `showApplePay: false` becomes `hiddenPaymentMethods={['apple_pay']}`.
|
|
662
|
+
- `showGooglePay`: `showGooglePay: false` becomes `hiddenPaymentMethods={['google_pay']}`.
|
|
663
|
+
- `fallbackPublishableKey`: `fallbackPublishableKey` is deleted with no replacement.
|
|
664
|
+
- CheckoutGateways (`gateways.stripe`, `gateways.paypal`): `paymentMethods`: availability of `card`, `paypal`, `wallets` and `apms`, with no processor key. `gateways.stripe` becomes `card`, `wallets` and `apms`; `gateways.paypal` becomes `paypal`.
|
|
665
|
+
|
|
666
|
+
`showPayPal` stays: `showPayPal: false` is forwarded as hiding `paypal`, merged with any `hiddenPaymentMethods` you pass. Omitting both hides nothing. The presentation props the runtime accepts (`appearance`, `strings`, `layout`, `paymentMethodLayout`, and the setup components' `theme`, `appearance` and `buttonsStyles`) are forwarded, not interpreted. Seven more 1.x checkout props stay and are forwarded too; see **Known limits in 2.0.0** below.
|
|
667
|
+
|
|
668
|
+
**Default checkout mode.** A session created with no `checkoutMode` now defaults to `'full'` (it was `'confirm'` in 1.x), in `@flopay/js` and `@flopay/node`. An explicit `'confirm'`, `'auto'` or `'full'` is sent unchanged. Merchants who want the old default must set `checkoutMode: 'confirm'` and create the session from a server with merchant credentials (`@flopay/node` `checkout.sessions.createOneClick`, handed to `getSession`).
|
|
669
|
+
|
|
670
|
+
### Known limits in 2.0.0
|
|
671
|
+
|
|
672
|
+
`FloPayCheckout`, `SplitCardForm`, `FloPayAutomaticPaymentButton`, `DirectPayPalButton` and `VaultCardFields` accept seven 1.x props and forward them to the hosted runtime unchanged, but **the runtime does not act on them yet, so in 2.0.0 they have no effect**: `theme`, `showCardBrandIcons`, `showCardFieldLabels`, `cardFieldLabels`, `cardFieldPlaceholders`, `enabledPaymentMethods` and `initialPayPalOrderId`. They are not removed. A page that sets them keeps compiling and raises no error, and it needs no change once the runtime supports them. Omitted, nothing is sent.
|
|
673
|
+
|
|
674
|
+
- `theme` leaves the checkout's look as it is. On `FloPayCardSetup` and `FloPayPaymentMethodSetup`, `theme` is applied, as described under **Themes and layouts**.
|
|
675
|
+
- `showCardBrandIcons`, `showCardFieldLabels`, `cardFieldLabels` and `cardFieldPlaceholders` leave the hosted card form's own icons, labels and placeholder text as they are. `cardFieldLabels` and `cardFieldPlaceholders` take optional `number`, `expiry`, `cvv` and `name` text.
|
|
676
|
+
- `enabledPaymentMethods` does not narrow the payment methods on offer. The session's `paymentMethods` decide which methods the runtime offers, and `hiddenPaymentMethods` hides them.
|
|
677
|
+
- `initialPayPalOrderId` does not resume a PayPal order.
|
|
678
|
+
|
|
679
|
+
`appearance` still carries any `.Label` rule you set for the labels. In 1.x the labels used its `color`, `fontSize`, `fontWeight`, `letterSpacing`, `textTransform` and `marginBottom`, and every other `.Label` property was ignored.
|
|
680
|
+
|
|
681
|
+
```tsx
|
|
682
|
+
// Forwarded unchanged in 2.0.0.
|
|
683
|
+
<FloPayCheckout
|
|
684
|
+
sessionId={sessionId}
|
|
685
|
+
nonce={sessionNonce}
|
|
686
|
+
showCardFieldLabels
|
|
687
|
+
cardFieldPlaceholders={{ number: 'Card number', expiry: 'MM / YY', cvv: 'CVC', name: 'Name on card' }}
|
|
688
|
+
/>
|
|
689
|
+
```
|
|
690
|
+
|
|
966
691
|
## Errors
|
|
967
692
|
|
|
968
693
|
Checkout errors reach `onError` (and the `error` render prop) as `FloPayError` values from `@flopay/shared`. Branch on `type` and `code`; raw provider messages are never shown to buyers or passed to callbacks. Declines are not errors: they reach `onDecline` with a `DeclineEvent`.
|
|
@@ -980,7 +705,6 @@ Checkout errors reach `onError` (and the `error` render prop) as `FloPayError` v
|
|
|
980
705
|
| `CheckoutInitializationFailed` | `api_error` | Checkout could not start for a reason that is neither a network failure nor a provider script failure, with `sessionId` set once the session exists. |
|
|
981
706
|
| `paypal_init_timeout` | `api_error` | A PayPal-only checkout could not start PayPal after automatic recovery. The **Retry PayPal** button tries again. |
|
|
982
707
|
| `external_payment_method_failed` | `api_error` | A wallet, PayPal, or alternative method failed technically after the buyer clicked it. The chooser offers a retry. |
|
|
983
|
-
| `InvalidCardSetupSurface` | `validation_error` | `FloPayCheckout` was given a card-setup session; use `FloPayCardSetup`. |
|
|
984
708
|
| `three_ds_aborted` / `three_ds_timeout` | `api_error` | The buyer cancelled, or did not finish, the authentication challenge for a saved card in confirm or auto mode. |
|
|
985
709
|
| `checkout_processing_timeout` | `api_error` | The payment's outcome is not known yet: the SDK could not confirm it in time and it may still complete. Do not resubmit; reconcile from `payment.*` webhooks. `FloPayAutomaticPaymentButton` reports it through `onError`, not `onDecline`, shows a "don't pay again" notice under the button, and opens no fallback checkout. |
|
|
986
710
|
| `stored_payment_method_unsupported` | `api_error` | The backend-selected saved method cannot be used for this transaction. Show the supplied buyer-safe instruction and let the buyer choose another method. |
|
|
@@ -1043,12 +767,7 @@ losing focus in such a viewport, the SDK reports it through `onError` with this
|
|
|
1043
767
|
method, instead of silently redrawing the wallet buttons. A buyer who dismisses
|
|
1044
768
|
a sheet that did open still gets the silent reset.
|
|
1045
769
|
|
|
1046
|
-
|
|
1047
|
-
merchant's `onBeforeButtonClick` hook, or the session patch it returned, did not
|
|
1048
|
-
finish within the 900 ms a wallet click allows, so the click was rejected. It is
|
|
1049
|
-
reported once per click; a late result from that hook is ignored.
|
|
1050
|
-
|
|
1051
|
-
A `validation_error` is also reported when both `showStripe` and `showPayPal` are false with no PayPal gateway, or when a session advertises no supported gateway. When saving the AVS billing address is rejected with a `4xx`, `onError` receives the parsed billing API error while the message shows inline; the buyer corrects it for the next attempt.
|
|
770
|
+
A `validation_error` is also reported when a session offers no supported payment method. When saving the AVS billing address is rejected with a `4xx`, `onError` receives the parsed billing API error while the message shows inline; the buyer corrects it for the next attempt.
|
|
1052
771
|
|
|
1053
772
|
`FloPayCardSetup` reports failures to `onError` as `FloPayCardSetupError`, which adds `retryable`. Network, rate-limit, `5xx`, card-form timeout, and unexpected failures are retryable; validation failures are not.
|
|
1054
773
|
|
|
@@ -1059,7 +778,6 @@ A `validation_error` is also reported when both `showStripe` and `showPayPal` ar
|
|
|
1059
778
|
| `InvalidCardSetupSession` | The session is not a zero-amount, product-free setup session |
|
|
1060
779
|
| `UnsupportedBackendVaultCapability` | The setup session has no hosted card capability |
|
|
1061
780
|
| `card_setup_widget_failed` | The hosted card form failed at runtime (retryable) |
|
|
1062
|
-
| `card_setup_load_failed` | Loading the session or card form failed for another reason |
|
|
1063
781
|
|
|
1064
782
|
`FloPayPaymentMethodSetup` reports the codes above, plus:
|
|
1065
783
|
|
|
@@ -1067,7 +785,6 @@ A `validation_error` is also reported when both `showStripe` and `showPayPal` ar
|
|
|
1067
785
|
|------|------|
|
|
1068
786
|
| `InvalidPaymentMethodSetupSession` | The session is not a zero-amount, product-free setup session |
|
|
1069
787
|
| `NoAdvertisedPaymentMethods` | The setup session advertises no payment method, or only Stripe wallets or alternative methods while the read carries no currency (the message names them) |
|
|
1070
|
-
| `payment_method_setup_unavailable` | None of the advertised methods can be offered here, for example a wallet the device does not have or a method Stripe does not support in the session currency (`retryable: false`) |
|
|
1071
788
|
| `payment_method_setup_unverified` | The provider accepted the method but the billing API had not verified it in time (retryable) |
|
|
1072
789
|
| `payment_method_setup_expired` | The setup session expired before the method was verified |
|
|
1073
790
|
| `payment_method_setup_failed` | A wallet or alternative method failed technically (retryable) |
|