@flopay/react 1.15.0 → 1.16.1

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 CHANGED
@@ -221,8 +221,9 @@ One value styles non-card Stripe Elements, the SDK-rendered wrapper and AVS fiel
221
221
  `paymentMethodLayout` sets the order of the payment method groups: `'card'`, `'paypal'`, `'wallets'` (Apple Pay and Google Pay) and `'apms'` (alternative payment methods such as Klarna, iDEAL or SEPA), with optional rules for buyers in particular countries. Without it, the order is PayPal, wallets, APMs, then card, and nothing extra is requested.
222
222
 
223
223
  - `order` is the default order. Groups you leave out follow the ones you list, in the default order, so `order: ['card']` puts card first and keeps the rest as they were.
224
- - `countryRules` gives buyers in some countries their own `order`. Each rule lists ISO 3166-1 alpha-2 `countries`; the first rule naming the buyer's country applies, and a rule without `order` uses the default `order`.
225
- - The FloPay billing API applies the rules to each buyer and the checkout shows the order it resolves. The buyer's country is the checkout session's country when it has one, otherwise the buyer's IP country. The IP country is used only to pick the rule and never reaches your page. Unknown or repeated values are ignored, and the API's warnings about them are logged to the console.
224
+ - `moreOptions` puts groups behind a closed **More payment options** link, so they stay available without competing for the buyer's first tap. See **More payment options** below.
225
+ - `countryRules` gives buyers in some countries their own `order` and `moreOptions`. Each rule lists ISO 3166-1 alpha-2 `countries`; the first rule naming the buyer's country applies, and a field a rule leaves out uses the default one.
226
+ - The FloPay billing API applies the rules to each buyer and the checkout shows the order it resolves. The buyer's country is the checkout session's country when it has one (with inline `createSession`, `account.country`; the checkout asks once the session's details are attached, so that country is used), otherwise the buyer's IP country. The IP country is used only to pick the rule and never reaches your page. Unknown or repeated values are ignored, and the API's warnings about them are logged to the console.
226
227
  - Until the order is known the payment methods show placeholders, so nothing moves once it is on screen. If the API is slow or unavailable, the default `order` applies without country rules.
227
228
  - In `layout="buttons"` every group follows the order, and Card is the **Credit / Debit Card** button. In the default layout PayPal, wallets and APMs follow the order among the buttons; Card first puts the card form above them, with an "or pay another way" divider, and anywhere else the card form stays below "or pay with card".
228
229
  - A group that is hidden (`showPayPal={false}`) or unavailable (no wallet on the device, no APM for the currency) is skipped and leaves no gap. Hiding a group is still the job of the show/hide props.
@@ -236,16 +237,31 @@ One value styles non-card Stripe Elements, the SDK-rendered wrapper and AVS fiel
236
237
  layout="buttons"
237
238
  paymentMethodLayout={{
238
239
  order: ['card', 'wallets', 'apms', 'paypal'],
239
- countryRules: [{ countries: ['US', 'GB', 'CA', 'AU', 'NZ', 'IE'], order: ['paypal'] }],
240
+ moreOptions: ['paypal'],
241
+ countryRules: [
242
+ { countries: ['US', 'GB', 'CA', 'AU', 'NZ', 'IE'], order: ['paypal'], moreOptions: [] },
243
+ ],
240
244
  }}
241
245
  />
242
246
  ```
243
247
 
248
+ Here buyers outside the six countries see card, Apple Pay / Google Pay and APMs, with PayPal behind the link; buyers inside them see PayPal first, with no link.
249
+
250
+ ##### More payment options
251
+
252
+ - **Placement.** In `layout="buttons"` the link sits under the buttons, and any group can go behind it, Card included. In the default layout it sits under the buttons and above "or pay with card"; the card form always stays in view there, so `'card'` in `moreOptions` applies to the buttons layout only.
253
+ - **Opening.** The link is closed at first. Opening it reveals the groups behind it in place, in the resolved order, and they stay revealed. The groups load while the link is closed, so PayPal and the wallets are ready the moment it opens, and everything behind it works as it does in view, PayPal's popup or redirect included.
254
+ - **Edge cases.** When nothing available would stay in view, every group shows and there is no link. When nothing behind the link is available (hidden by the show/hide props, or no wallet on the device), there is no link.
255
+ - **Text and look.** The link reads "More payment options". Set `moreOptionsLabel` to final, already-localized plain text to change it. It takes the theme's accent colour (`appearance.variables.colorPrimary`) and font.
256
+ - **Accessibility.** The link is a button: it is reached by Tab, opened with Enter or Space, and announces itself as collapsed. Opening it moves focus to the revealed group, which is labelled with the link's text.
257
+ - **Analytics.** Opening it emits `more_options_opened` on `onInstrument`, once per checkout, so you can measure how often buyers open it.
258
+ - `FloPayCheckout` injects `moreOptionsLabel`, like `paymentMethodLayout`, into custom-layout children that do not set their own.
259
+
244
260
  #### Merchant instrument feed
245
261
 
246
262
  `onInstrument` on `FloPayCheckout` or `FloPayProvider` forwards a stable, privacy-safe checkout funnel to your own analytics as `FloInstrumentEvent` values. `schemaVersion` is always `1`, and `gateway` (`stripe` or `paypal`) is included only when an event is attributable to that provider.
247
263
 
248
- - Lifecycle names are `checkout_mount`, `sdk_loaded`, `form_rendered`, `card_expanded`, `tokenize`, `process_attempt`, and `3ds_challenge`. `checkout_mount`, `sdk_loaded`, `form_rendered`, and `card_expanded` arrive at most once per logical checkout; `tokenize`, `process_attempt`, and `3ds_challenge` may repeat for each attempt.
264
+ - Lifecycle names are `checkout_mount`, `sdk_loaded`, `form_rendered`, `card_expanded`, `more_options_opened`, `tokenize`, `process_attempt`, and `3ds_challenge`. `checkout_mount`, `sdk_loaded`, `form_rendered`, `card_expanded`, and `more_options_opened` arrive at most once per logical checkout; `tokenize`, `process_attempt`, and `3ds_challenge` may repeat for each attempt.
249
265
  - `checkout_error` adds one of four phases: `session_create`, `sdk_load`, `process`, or `wallets`.
250
266
 
251
267
  The callback is an allowlisted projection with no card data, tokens, provider object IDs, secrets, or raw PII. A throwing `onInstrument` consumer never breaks checkout, and `telemetry={false}` does not disable this merchant-owned feed.
@@ -628,7 +644,8 @@ export function ComposedCheckout({ session, nonce }: { session: CheckoutSession;
628
644
  | `checkoutMode` | `CheckoutMode?` | Overrides the session's checkout mode |
629
645
  | `billingApiUrl` | `string?` | Billing API base URL; defaults to the configured environment |
630
646
  | `layout` | `'default' \| 'buttons'` | Payment form layout |
631
- | `paymentMethodLayout` | `PaymentMethodLayoutRules?` | Order of `'card'`, `'paypal'`, `'wallets'` and `'apms'`, with per-country rules, resolved for each buyer by the billing API; without it, PayPal, wallets, APMs, card |
647
+ | `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 |
648
+ | `moreOptionsLabel` | `string?` | Text of the "More payment options" link, as final, already-localized plain text |
632
649
  | `theme` | `ThemeId?` | Theme bundle for the whole checkout |
633
650
  | `appearance` | `FloPayAppearance?` | Stripe-side appearance overrides |
634
651
  | `buttonsStyles` | `ButtonsLayoutStyles?` | Wrapper style overrides layered on the theme |
@@ -743,7 +760,8 @@ Also accepts every standard `button` attribute, such as `onClick`, `disabled`, a
743
760
  | `totalAmount` | `number?` | Amount in the smallest currency unit, for wallet and PayPal configuration |
744
761
  | `currency` | `string?` | Currency code for wallet and PayPal configuration |
745
762
  | `layout` | `'default' \| 'buttons'` | Payment form layout |
746
- | `paymentMethodLayout` | `PaymentMethodLayoutRules?` | Order of `'card'`, `'paypal'`, `'wallets'` and `'apms'`, with per-country rules, resolved for each buyer by the billing API; without it, PayPal, wallets, APMs, card |
763
+ | `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 |
764
+ | `moreOptionsLabel` | `string?` | Text of the "More payment options" link, as final, already-localized plain text |
747
765
  | `theme` | `ThemeId?` | Theme bundle |
748
766
  | `submitLabel` | `(string \| null)?` | Live wording for the hosted card submit button; omitted, `null`, or blank shows the hosted default `CONFIRM PAYMENT` |
749
767
  | `showStripe` / `showPayPal` | `boolean?` | Toggle Stripe methods and PayPal |
@@ -803,8 +821,8 @@ Also accepts every standard `button` attribute, such as `onClick`, `disabled`, a
803
821
  | `InlineSessionPatch` | Partial draft returned from `FloPayCheckoutProps.onBeforeButtonClick` |
804
822
  | `WalletPresentation` | Closed wallet presentation preference: `auto`, `popup`, or `prefer_redirect` |
805
823
  | `PaymentMethodGroup` | A group `paymentMethodLayout` can place: `'card'`, `'paypal'`, `'wallets'` or `'apms'` |
806
- | `PaymentMethodLayoutRules` | `{ order?: PaymentMethodGroup[]; countryRules?: PaymentMethodCountryRule[] }`, the merchant's layout rules |
807
- | `PaymentMethodCountryRule` | `{ countries: string[]; order?: PaymentMethodGroup[] }`, a rule for buyers in the listed ISO 3166-1 alpha-2 countries |
824
+ | `PaymentMethodLayoutRules` | `{ order?: PaymentMethodGroup[]; moreOptions?: PaymentMethodGroup[]; countryRules?: PaymentMethodCountryRule[] }`, the merchant's layout rules |
825
+ | `PaymentMethodCountryRule` | `{ countries: string[]; order?: PaymentMethodGroup[]; moreOptions?: PaymentMethodGroup[] }`, a rule for buyers in the listed ISO 3166-1 alpha-2 countries |
808
826
  | `FloInstrumentEvent` | Versioned merchant instrument union |
809
827
 
810
828
  ## Errors
@@ -109,11 +109,18 @@ export interface FloPayCheckoutProps {
109
109
  * and `'apms'`, with optional per-country rules. The billing API applies
110
110
  * them to each buyer and the checkout shows the order it resolves. Without
111
111
  * the prop the order is PayPal, wallets, APMs, then card. Can change after
112
- * mount; a group whose place changes is mounted again. Injected into
112
+ * mount; a group whose place changes is mounted again. `moreOptions` puts
113
+ * groups behind a closed "More payment options" link. Injected into
113
114
  * custom-layout children that set none. See
114
115
  * `SplitCardFormProps.paymentMethodLayout`.
115
116
  */
116
117
  paymentMethodLayout?: PaymentMethodLayoutRules;
118
+ /**
119
+ * The text of the "More payment options" link, as final, already-localized
120
+ * plain text. Injected into custom-layout children that set none. See
121
+ * `SplitCardFormProps.moreOptionsLabel`.
122
+ */
123
+ moreOptionsLabel?: string;
117
124
  /**
118
125
  * High-level theme bundle that styles non-card Stripe Elements, the FloPay
119
126
  * wrapper / AVS inputs, and the hosted vault widget. One of: `'classic'`
@@ -252,4 +259,4 @@ export interface FloPayCheckoutProps {
252
259
  * />
253
260
  * ```
254
261
  */
255
- export declare function FloPayCheckout({ sessionId: sessionIdProp, nonce: nonceProp, createSession: createSessionParams, billingApiUrl, telemetry, appearance: appearanceOverride, locale, loading: loadingNode, error: errorNode, onComplete, onError, onInstrument, onDecline, onCancel, onCountryChange, onZipChange, showPayPal, showStripe, walletPresentation, enabledPaymentMethods: enabledPaymentMethodsProp, showApplePay, showGooglePay, debug, layout, paymentMethodLayout, theme, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter: _showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, cardFieldOrder, cardAutoFocus, cardPreFormSlot, avsLayout, submitLabel, className, initialErrorMessage, initialPayPalOrderId, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
262
+ export declare function FloPayCheckout({ sessionId: sessionIdProp, nonce: nonceProp, createSession: createSessionParams, billingApiUrl, telemetry, appearance: appearanceOverride, locale, loading: loadingNode, error: errorNode, onComplete, onError, onInstrument, onDecline, onCancel, onCountryChange, onZipChange, showPayPal, showStripe, walletPresentation, enabledPaymentMethods: enabledPaymentMethodsProp, showApplePay, showGooglePay, debug, layout, paymentMethodLayout, moreOptionsLabel, theme, buttonsTheme, buttonsStyles, cardButtonContent, cardBackButtonContent, cardTitleContent, showSecurityFooter: _showSecurityFooter, onButtonClick, onBeforeButtonClick, enableAVS, cardFieldOrder, cardAutoFocus, cardPreFormSlot, avsLayout, submitLabel, className, initialErrorMessage, initialPayPalOrderId, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;