@flopay/react 1.7.0 → 1.8.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
@@ -791,57 +791,13 @@ The SDK exposes the relevant pieces in three ways:
791
791
 
792
792
  - **`DirectPayPalButton`** (standalone): can be rendered outside `SplitCardForm` when you only need the PayPal button. Pass `clientId`, `currency`, `environment`, `isSubscription`, and the backend-advertised `providerObjectType` when present. `isSubscription` remains the compatibility fallback when the field is absent.
793
793
 
794
- - **`PayPalButton`** (standalone): Must be rendered inside its own `FloPayProvider`:
795
-
796
- ```tsx
797
- {/* Main checkout provider */}
798
- <FloPayProvider flopay={flopay} options={{ amount, currency }}>
799
- <SplitCardForm ... />
800
- </FloPayProvider>
801
-
802
- {/* PayPal provider (separate instance) */}
803
- <FloPayProvider flopay={flopay} options={{ amount, currency, paymentMethodCreation: 'auto' }}>
804
- <PayPalButton
805
- sessionId="session_uuid"
806
- billingApiUrl="https://billing.example.com"
807
- email="user@example.com"
808
- onComplete={() => router.push('/success')}
809
- />
810
- </FloPayProvider>
811
- ```
812
-
813
- ### Using Individual Non-card Elements
814
-
815
- ```tsx
816
- import { AddressElement, PaymentElement } from '@flopay/react';
817
-
818
- function CustomForm() {
819
- return (
820
- <div>
821
- <PaymentElement
822
- options={{
823
- layout: 'tabs',
824
- paymentMethodTypes: ['cashapp', 'ideal'],
825
- }}
826
- />
827
- <AddressElement />
828
- </div>
829
- );
830
- }
831
- ```
832
-
833
- These elements support wallet/APM and address collection. `PaymentElement`
834
- requires a non-empty `paymentMethodTypes` allowlist and rejects `card`; use the
835
- hosted vault checkout surface for card payments.
836
-
837
794
  ### Using Hooks
838
795
 
839
796
  ```tsx
840
- import { useFloPay, useElements, useCheckout } from '@flopay/react';
797
+ import { useFloPay, useCheckout } from '@flopay/react';
841
798
 
842
799
  function PaymentStatus() {
843
800
  const flopay = useFloPay(); // FloPay | null
844
- const elements = useElements(); // FloPayElements | null
845
801
  const checkout = useCheckout(); // { session, loading, error, claimPending }
846
802
 
847
803
  if (!flopay) return <div>Loading SDK...</div>;
@@ -855,22 +811,18 @@ function PaymentStatus() {
855
811
 
856
812
  | Component | Description |
857
813
  |-----------|-------------|
858
- | `FloPayProvider` | Context provider. Accepts `flopay` (instance or promise), `options?`, and `children`. Creates the elements group automatically. |
814
+ | `FloPayProvider` | Context provider. Accepts `flopay` (instance or promise), optional `paypalFlopay`, `options?`, and `children`. |
859
815
  | `FloPayCheckout` | Recommended self-contained session checkout. Resolves gateways, mounts hosted-vault cards, and preserves wallets/APMs/PayPal/saved-payment flows. |
860
816
  | `FloPayCardSetup` | Browser-only no-charge card verification for a merchant-server-created setup session. Requires `sessionId` + `nonce`; reports ready, verified completion, decline, validation, retryable technical error, and cancellation outcomes. |
861
817
  | `SplitCardForm` | Advanced checkout surface combining hosted-vault cards with wallets, APMs, and PayPal. Supports `ref` for imperative next-action handling. |
862
818
  | `VaultCardFields` | Hosted vault PCI card fields. Used internally by `SplitCardForm` on the vault path; consumes a `CardCaptureAdapter` from `useFloPay().cardCapture()`. |
863
- | `PayPalButton` | Standalone PayPal button. Requires its own `FloPayProvider` with `paymentMethodCreation` set to something other than `'manual'`. |
864
819
  | `DirectPayPalButton` | Standalone direct PayPal Order, provider-managed Subscription, or setup-token button using the session-scoped intent contract. |
865
- | `PaymentElement` | Provider element for an explicitly declared non-card `paymentMethodTypes` allowlist. |
866
- | `AddressElement` | Address input element |
867
820
 
868
821
  ### Hooks
869
822
 
870
823
  | Hook | Returns | Description |
871
824
  |------|---------|-------------|
872
825
  | `useFloPay()` | `FloPay \| null` | Current FloPay instance from context. `null` while loading. |
873
- | `useElements()` | `FloPayElements \| null` | Current elements group from context. `null` while loading. |
874
826
  | `useCheckout()` | `CheckoutState` | `{ session, loading, error, claimPending }` from CheckoutContext. `claimPending` remains true while a detached shell is not safe to charge. |
875
827
 
876
828
  ### FloPayProviderProps
@@ -878,12 +830,8 @@ function PaymentStatus() {
878
830
  | Prop | Type | Description |
879
831
  |------|------|-------------|
880
832
  | `flopay` | `Promise<FloPay> \| FloPay` | SDK instance or promise from `loadFloPay()` |
881
- | `options.locale` | `string?` | Locale |
882
- | `options.appearance` | `FloPayAppearance?` | Theme appearance |
883
- | `options.clientSecret` | `string?` | Existing non-card PaymentIntent or SetupIntent secret; the SDK verifies the provider intent against `PaymentElement`'s explicit wallet/APM allowlist before mounting and rejects card or undeclared methods. Card checkout uses the hosted vault. |
884
- | `options.amount` | `number?` | Amount in cents for deferred non-card Elements without a `clientSecret` |
885
- | `options.currency` | `string?` | ISO 4217 currency code for deferred non-card Elements without a `clientSecret` |
886
- | `options.paymentMethodCreation` | `'manual' \| 'auto'` | How payment methods are created |
833
+ | `paypalFlopay` | `Promise<FloPay> \| FloPay \| null` | Optional Stripe instance used for the Stripe-rendered PayPal redirect leg. |
834
+ | `options.billingApiUrl` | `string?` | Billing API base URL exposed to child components. |
887
835
  | `onInstrument` | `(event: FloInstrumentEvent) => void` | Versioned, privacy-safe checkout funnel and phased error feed for merchant analytics. |
888
836
 
889
837
  ### FloPayCardSetupProps
@@ -998,20 +946,6 @@ Backend rollout verification should confirm that create/read/replay no longer
998
946
  invoke PCIVault and that capture issuance occurs only through the deferred
999
947
  endpoint when a buyer enters the card path.
1000
948
 
1001
- ### ElementComponentProps (shared by all element components)
1002
-
1003
- | Prop | Type | Description |
1004
- |------|------|-------------|
1005
- | `className` | `string?` | CSS class for wrapper div |
1006
- | `id` | `string?` | HTML id for wrapper div |
1007
- | `style` | `CSSProperties?` | Inline styles for wrapper div |
1008
- | `options` | `Partial<ElementOptions>?` | Options for the underlying element |
1009
- | `onChange` | `(event: ElementChangeEvent) => void` | Value change handler |
1010
- | `onReady` | `() => void` | Element ready handler |
1011
- | `onFocus` | `() => void` | Focus handler |
1012
- | `onBlur` | `() => void` | Blur handler |
1013
- | `onEscape` | `() => void` | Escape key handler |
1014
-
1015
949
  ### Types
1016
950
 
1017
951
  | Type | Description |
@@ -1023,7 +957,5 @@ endpoint when a buyer enters the card path.
1023
957
  | `FloPayCardSetupCancelEvent` | Unmount-before-terminal cancellation |
1024
958
  | `FloPayCardSetupError` | Structured setup failure with stable `code` and `retryable` classification |
1025
959
  | `SplitCardFormProps` | Props for `SplitCardForm` |
1026
- | `PayPalButtonProps` | Props for `PayPalButton` |
1027
- | `ElementComponentProps` | Shared props for all element components |
1028
960
  | `CheckoutState` | `{ session, loading, error, claimPending }` |
1029
961
  | `FloInstrumentEvent` | Versioned merchant instrument union with seven lifecycle names, four `checkout_error` phases, and an optional gateway. |