Skip to main content

PaymentForm

Need an API key?

Get one from Crave Dashboard > Developers > API Development > Step 1 - API Keys. Copy the matching locationId from Step 2 - Location IDs on the same page.
Renders payment input fields using the merchant’s configured payment provider (Square or Stripe). Handles tokenization and payment submission.

Preview

Import

Usage

Props

'square' | 'stripe'
required
The payment provider configured for this merchant.
number
required
The total amount to charge in cents.
(token: string) => void
required
Callback fired with the payment token after successful tokenization.
(error: PaymentError) => void
required
Callback fired when payment processing fails.

Behavior

  • Loads the appropriate payment provider SDK (Square Web Payments or Stripe Elements)
  • Secure iframe-based card input fields
  • Supports Apple Pay and Google Pay when available
  • Displays inline validation errors
  • Shows loading state during payment processing