Set up Stripe integration for secure payment processing in your storefront.
Crave uses Stripe Connect to process payments. This guide covers how to create payment intents, integrate Stripe.js on the frontend, and test in development.
Wrap your checkout page with the Stripe Elements provider.
'use client';import { loadStripe } from '@stripe/stripe-js';import { Elements } from '@stripe/react-stripe-js';const stripePromise = loadStripe( process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY!, // For Stripe Connect, pass the connected account // { stripeAccount: payment.stripeAccountId });export default function CheckoutLayout({ children }: { children: React.ReactNode }) { return ( <Elements stripe={stripePromise}> {children} </Elements> );}
You must use the restaurant’s stripeAccountId from the payment intent response when initializing Stripe. This routes the payment to the correct connected account.
Set your environment to use Stripe test keys (pk_test_... / sk_test_...) during development. Crave sandbox locations automatically use Stripe test mode.