PayPal Integration
Add PayPal as a payment method alongside card payments.
PayPal Integration
FloPay supports PayPal payments through Stripe's ExpressCheckoutElement. PayPal has a specific architectural requirement: it needs its own Stripe Elements instance without paymentMethodCreation: 'manual'.
Using SplitCardForm (Recommended)
The simplest way to offer PayPal is through SplitCardForm, which handles the dual-Elements architecture automatically:
The component internally creates two Elements instances:
- Card Elements -- uses the parent
FloPayProviderwithpaymentMethodCreation: 'manual'for card tokenization - PayPal Elements -- creates a separate Stripe
<Elements>wrapper withoutpaymentMethodCreationfor theExpressCheckoutElement
When showPayPal is enabled, you must provide totalAmount (in dollars) and currency. These are used to configure the PayPal Elements instance with the correct amount (converted to cents) and currency values.
PayPal Payment Flow
The PayPal flow differs from the card flow:
- User clicks the PayPal button (rendered by
ExpressCheckoutElement) - Stripe opens the PayPal approval window
- The
confirmPayPalPaymentmethod on theFloPayinstance is called:- Creates a payment intent via the billing API
- Confirms the PayPal payment with Stripe
- Handles any redirect if needed
- On return from PayPal redirect,
resumePayPalPaymentpicks up the flow - Payment is processed via the billing API
Wallet Resume Across Redirects
PayPal payments may redirect the user away from your site and back. SplitCardForm and CheckoutForm persist payment state to localStorage under the key flopay_wallet_resume before the redirect, then automatically resume the flow when the user returns.
Why Separate Elements?
Stripe's ExpressCheckoutElement (which renders PayPal, Apple Pay, Google Pay) requires an Elements instance configured with mode, amount, and currency. Card-based flows that use paymentMethodCreation: 'manual' are incompatible with this configuration. SplitCardForm solves this by mounting the PayPal button in its own <Elements> wrapper while keeping card fields in the parent provider's context.