Skip to main content
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.

How payments work

1

Cart is finalized

The customer has added items, set fulfillment, and provided their details.
2

Create a payment intent

Your server calls the Crave API to get a Stripe clientSecret.
3

Collect payment on the client

Stripe.js securely collects card details using the clientSecret.
4

Stripe confirms the charge

The payment is processed through the restaurant’s connected Stripe account.
Crave handles Stripe Connect setup for each restaurant. You only need to integrate Stripe.js on your storefront frontend.

Create a payment intent

The response includes:
FieldDescription
clientSecretThe Stripe PaymentIntent client secret
stripeAccountIdThe connected Stripe account to pass to stripe.confirmPayment

Install Stripe.js

Set up the Stripe provider

Wrap your checkout page with the Stripe Elements provider.
You must use the restaurant’s stripeAccountId from the payment intent response when initializing Stripe. This routes the payment to the correct connected account.

Collect payment

Full checkout integration

Testing payments

Use Stripe’s test card numbers in development:
Card NumberScenario
4242 4242 4242 4242Successful payment
4000 0000 0000 3220Requires 3D Secure authentication
4000 0000 0000 0002Card declined
4000 0025 0000 3155Requires authentication (SCA)
Use any future expiry date and any 3-digit CVC.
Set your environment to use Stripe test keys (pk_test_... / sk_test_...) during development. Crave sandbox locations automatically use Stripe test mode.

Environment variables

Add these to your .env.local:
The Stripe secret key is managed by Crave on the backend — you only need the publishable key on the client.

Next steps

Order Tracking

Track order status after payment.

Error Codes

Handle payment and API errors.