@flopay/react 1.17.0 → 1.18.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 CHANGED
@@ -142,6 +142,29 @@ Set `showCardBrandIcons` on `FloPayCheckout` or `SplitCardForm` to show the Visa
142
142
  - **Compatibility.** A billing API whose card form predates the icons ignores the setting and keeps the field as it was.
143
143
  - **Custom layouts.** `FloPayCheckout` forwards the prop to its built-in form. A `SplitCardForm` you render as a custom-layout child takes its own `showCardBrandIcons`.
144
144
 
145
+ #### Card field placeholders
146
+
147
+ 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):
148
+
149
+ ```tsx
150
+ <FloPayCheckout
151
+ sessionId={sessionId}
152
+ nonce={sessionNonce}
153
+ cardFieldPlaceholders={{
154
+ number: 'Card number',
155
+ expiry: 'MM / YY',
156
+ cvv: 'CVC',
157
+ name: 'Name on card',
158
+ }}
159
+ />
160
+ ```
161
+
162
+ - **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.
163
+ - **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.
164
+ - **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.
165
+ - **Security.** Like the submit label, the text is sent only to the hosted form's exact origin, bound to the session.
166
+ - **Custom layouts.** `FloPayCheckout` forwards the prop to its built-in form. A `SplitCardForm` you render as a custom-layout child takes its own `cardFieldPlaceholders`.
167
+
145
168
  #### Wallets and alternative payment methods
146
169
 
147
170
  The payment-method list is gateway-driven: the billing API sends `gateways.stripe.enabledPaymentMethods` for each session, derived from the payment methods enabled on the merchant's Stripe account. Apple Pay, Google Pay, PayPal, Link, Amazon Pay, and Klarna render as express buttons; every other enabled method (for example Cash App Pay, Affirm, iDEAL, Bancontact, SEPA Debit) renders in an accordion. Enabling a new method in Stripe needs no SDK or application change. Wallets render only on supported devices.
@@ -722,6 +745,7 @@ export function ComposedCheckout({ session, nonce }: { session: CheckoutSession;
722
745
  | `avsLayout` | `'row' \| 'column'` | AVS field layout |
723
746
  | `cardFieldOrder` | `VaultCardFieldKey[]?` | Order of the hosted card rows |
724
747
  | `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 |
748
+ | `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 |
725
749
  | `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 |
726
750
  | `cardFieldsTimeoutMs` | `number?` | Milliseconds the card fields may take to become interactive before `onCardFieldsFailed` reports `timeout` (default 15 000) |
727
751
  | `onCardFieldsReady` | `(event: CardFieldsReadyEvent) => void` | The hosted card fields are interactive; once per card form, with `elapsedMs` since it mounted |
@@ -836,6 +860,7 @@ Also accepts every standard `button` attribute, such as `onClick`, `disabled`, a
836
860
  | `enableAVS` | `boolean \| AVSFieldConfig` | Collect and validate the billing address |
837
861
  | `cardFieldOrder` | `VaultCardFieldKey[]?` | Order of the hosted card rows |
838
862
  | `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 |
863
+ | `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 |
839
864
  | `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 |
840
865
  | `cardFieldsTimeoutMs` | `number?` | Milliseconds the card fields may take to become interactive before `onCardFieldsFailed` reports `timeout` (default 15 000) |
841
866
  | `onCardFieldsReady` / `onCardFieldsFailed` | callbacks | Card-field lifecycle; see **Card-field lifecycle** above |
@@ -188,6 +188,14 @@ export interface FloPayCheckoutProps {
188
188
  * Vault card path only; an older hosted form ignores it.
189
189
  */
190
190
  showCardBrandIcons?: boolean;
191
+ /**
192
+ * Placeholder text for the hosted card fields (`number`, `expiry`, `cvv`,
193
+ * `name`), each optional. Only the fields given are sent; the rest keep the
194
+ * hosted form's wording, and `''` shows no placeholder. A change updates the
195
+ * mounted form live, without a remount. Omitted sends nothing. Vault card
196
+ * path only.
197
+ */
198
+ cardFieldPlaceholders?: import('@flopay/shared').CardFieldPlaceholders;
191
199
  /**
192
200
  * Opt out of the hosted card widget's automatic initial focus (and the host-side
193
201
  * initial identity/AVS field focus). `false` disables it; omitted or `true` keeps
@@ -271,4 +279,4 @@ export interface FloPayCheckoutProps {
271
279
  * />
272
280
  * ```
273
281
  */
274
- 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, showCardBrandIcons, cardAutoFocus, onCardFieldsReady, onCardFieldsFailed, cardFieldsTimeoutMs, cardPreFormSlot, avsLayout, submitLabel, className, initialErrorMessage, initialPayPalOrderId, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;
282
+ 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, showCardBrandIcons, cardFieldPlaceholders, cardAutoFocus, onCardFieldsReady, onCardFieldsFailed, cardFieldsTimeoutMs, cardPreFormSlot, avsLayout, submitLabel, className, initialErrorMessage, initialPayPalOrderId, children, checkoutMode: checkoutModeProp, confirmLabel, renderConfirmButton, onSessionCompleted, }: FloPayCheckoutProps): React.ReactElement;