@flopay/react 1.1.6 → 1.2.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
@@ -170,21 +170,49 @@ function UpsellButton() {
170
170
 
171
171
  `children` render inside the button, so you can treat them as slot content. If omitted, the default buttons-layout card content is used.
172
172
 
173
- #### Wallet Buttons
173
+ #### Wallet Buttons & alternative payment methods
174
174
 
175
- Apple Pay, Google Pay, and PayPal are enabled by default. Toggle them with props:
175
+ The payment-method list is now **gateway-driven**: the billing API ships
176
+ `gateways.stripe.enabledPaymentMethods` per session, derived from the Stripe
177
+ Payment Method Configurations enabled on the merchant account. The SDK
178
+ partitions that list into two regions inside `SplitCardForm`:
179
+
180
+ - `ExpressCheckoutElement` — `apple_pay`, `google_pay`, `paypal`, `link`,
181
+ `amazon_pay`, `klarna` (everything supported as a native big button).
182
+ - `PaymentElement` (accordion) — every other enabled method, e.g. `cashapp`,
183
+ `affirm`, `ideal`, `bancontact`, `sepa_debit`.
184
+
185
+ Enabling Cash App Pay (or any future Stripe method) in the Stripe dashboard is
186
+ the entire integration change — no SDK redeploy or consumer code update is
187
+ required. Wallets only render on supported devices regardless of dashboard
188
+ state (Apple Pay on Safari/macOS/iOS, Google Pay on Chrome).
189
+
190
+ Toggle the whole Stripe region or the PayPal region independently with the
191
+ two gateway-level props:
176
192
 
177
193
  ```tsx
178
194
  <FloPayCheckout
179
195
  sessionId="sess_abc123"
180
- showApplePay={true} // default: true
181
- showGooglePay={true} // default: true
182
- showPayPal={true} // default: true
196
+ showStripe={true} // default: true — card + ECE + PaymentElement
197
+ showPayPal={true} // default: true — DirectPayPal when gateway present,
198
+ // Stripe-rendered PayPal otherwise
183
199
  onComplete={handleSuccess}
184
200
  />
185
201
  ```
186
202
 
187
- Apple Pay and Google Pay only render on supported devices (Apple Pay on Safari/macOS/iOS, Google Pay on Chrome).
203
+ Setting both to `false` (with no PayPal gateway configured) is treated as a
204
+ bootstrap-time validation error — `onError` fires with a
205
+ `FloPayError({ type: 'validation_error' })` so the misconfiguration surfaces
206
+ during integration instead of silently rendering an empty form.
207
+
208
+ ##### Deprecated props
209
+
210
+ `showApplePay`, `showGooglePay`, and `directPaypal` are still accepted but
211
+ emit a one-time `console.warn` when supplied alongside the new
212
+ `enabledPaymentMethods` payload. They are no-ops once the backend ships the
213
+ field — Apple Pay / Google Pay are dashboard-controlled at Stripe, and direct
214
+ PayPal is auto-resolved from `gateways.paypal` on the session response. The
215
+ legacy props will be removed in `2.0`.
188
216
 
189
217
  #### Theming
190
218
 
@@ -565,11 +593,14 @@ Shares most props with `CheckoutFormProps`, plus:
565
593
 
566
594
  | Prop | Type | Description |
567
595
  |------|------|-------------|
568
- | `showPayPal` | `boolean` | Show PayPal button (default: `true`) |
569
- | `showApplePay` | `boolean` | Show Apple Pay button (default: `true`) |
570
- | `showGooglePay` | `boolean` | Show Google Pay button (default: `true`) |
571
- | `totalAmount` | `number` | Amount in dollars for PayPal config |
572
- | `currency` | `string` | Currency code for PayPal config (default: `'usd'`) |
596
+ | `showStripe` | `boolean` | Show the whole Stripe surface (card + ECE + PaymentElement). Default: `true`. Setting `showStripe={false}` together with `showPayPal={false}` (or no PayPal gateway) emits a `FloPayError({ type: 'validation_error' })` via `onError`. |
597
+ | `showPayPal` | `boolean` | Show PayPal. Renderer chosen by `gateways.paypal` presence (DirectPayPal JS SDK when present; Stripe-rendered PayPal otherwise). Default: `true`. |
598
+ | `enabledPaymentMethods` | `string[]?` | Per-session list of Stripe method type identifiers (`apple_pay`, `google_pay`, `cashapp`, `klarna`, `link`, `amazon_pay`, `sepa_debit`, `affirm`, `ideal`, …). Normally threaded automatically from `gateways.stripe.enabledPaymentMethods` by `FloPayCheckout`. The SDK partitions it into the ExpressCheckoutElement big-button row (intersected with `STRIPE_EXPRESS_METHODS`) and the accordion PaymentElement region (everything else; `card` is always dropped because the split fields render the card path). |
599
+ | `showApplePay` | `boolean` | *Deprecated.* Apple Pay availability is dashboard-controlled at Stripe and surfaces through `enabledPaymentMethods`. Emits a one-time `console.warn` when supplied alongside `enabledPaymentMethods` and is otherwise ignored. Removed in `2.0`. |
600
+ | `showGooglePay` | `boolean` | *Deprecated.* See `showApplePay`. |
601
+ | `directPaypal` | `{ clientId: string; environment?: GatewayEnvironment }?` | *Deprecated input on `FloPayCheckout`* — auto-resolved from `gateways.paypal` on the session response. Still accepted on `SplitCardForm` for advanced consumers wiring providers manually. |
602
+ | `totalAmount` | `number` | Amount in cents for PayPal / wallet config |
603
+ | `currency` | `string` | Currency code for PayPal / wallet config (default: `'usd'`) |
573
604
  | `onFirstNameChange` | `(value: string) => void` | First name change callback |
574
605
  | `onLastNameChange` | `(value: string) => void` | Last name change callback |
575
606
  | `submitLabel` | `string` | Button text (default: `'CONFIRM PAYMENT'`) |