FloPay
API Reference@flopay/react

PayPalButton

Standalone PayPal button component that handles the full PayPal payment flow.

PayPalButton

Standalone PayPal button that handles the full PayPal payment flow including intent creation, confirmation, and redirect resume.

function PayPalButton(props: PayPalButtonProps): React.ReactElement

Important

PayPal requires its own FloPayProvider -- it cannot share the same Stripe Elements instance as card fields when they use paymentMethodCreation: 'manual'. Use a separate provider with paymentMethodCreation: 'auto' (or unset).

Props

NameTypeRequiredDefaultDescription
sessionIdstringYes--Checkout session ID (UUID from billing API).
billingApiUrlstringYes--Billing API base URL.
emailstringNo--User's email.
userIdstringNo--User ID for processing payments.
firstNamestringNo--First name for billing.
lastNamestringNo--Last name for billing.
chvstringNo--Checkout version for tracking.
onTokenizedBody(body: TokenizedBody) => voidNo--Called with tokenized data after PayPal authorization. If omitted, processes payment internally.
onComplete() => voidNo--Called on successful payment (self-contained mode).
onErrorChange(error: string | null) => voidNo--Called when an error occurs.
isProcessingbooleanNofalseExternal processing state.

Example

{/* Card fields provider */}
<FloPayProvider
  flopay={flopay}
  options={{ amount: 4999, currency: 'usd', paymentMethodCreation: 'manual' }}
>
  <SplitCardForm ... />
</FloPayProvider>
 
{/* PayPal provider (separate instance) */}
<FloPayProvider
  flopay={flopay}
  options={{ amount: 4999, currency: 'usd', paymentMethodCreation: 'auto' }}
>
  <PayPalButton
    sessionId="uuid-xxx"
    billingApiUrl="https://api.example.com"
    email="user@example.com"
    userId="user_1"
    onComplete={() => router.push('/success')}
    onErrorChange={(err) => setError(err)}
  />
</FloPayProvider>

Flow

  1. User clicks the PayPal button.
  2. A PaymentIntent is created via POST /v1/checkouts/payments/intents.
  3. Payment is confirmed via flopay.confirmPayment() -- may redirect to PayPal.
  4. After redirect return, the component detects payment_intent URL parameters and resumes the flow.
  5. On success, calls onTokenizedBody (delegated mode) or processPayment (self-contained mode).

On this page