Authentication
”Missing API key” or 401 errors
Cause: TheX-API-Key header is missing or the key is invalid.
Fix:
- Check that you’re passing the header:
X-API-Key: sk_live_...(orsk_test_...for test mode) - Verify the key in the Dashboard under Settings > API Keys
- Ensure the key hasn’t been revoked
- If using the SDK, check your environment variable:
NEXT_PUBLIC_CRAVEUP_API_KEY
”Location mismatch” or 403 errors
Cause: The API key is scoped to a different location than the one in the request. Fix: Each API key is tied to a specific location. Use the key generated for the location you’re querying, or generate a new key for the target location.Cart & Ordering
”Cart not found” (404)
Cause: The cart has expired or been deleted. Fix:- Carts expire after a period of inactivity. Start a new ordering session.
- If you’re persisting
cartIdin localStorage, clear it and create a fresh session.
”Cart locked” (400)
Cause: A payment is being processed for this cart. Items can’t be modified during payment. Fix: Wait for the payment to complete or fail. If the payment fails, the cart unlocks automatically. If it succeeds, the cart transitions toCOMPLETED.
”Invalid modifier selection” (400)
Cause: The selected modifiers don’t satisfy the group’smin/max rules.
Fix:
- Check the modifier group’s constraints before submitting
- Ensure the number of selected options is between
minandmax - Verify that individual modifier item quantities don’t exceed their
maxQuantity
”Location closed” (422)
Cause: The location is not accepting orders at the requested time. Fix:- Fetch order times:
storefront.locations.getOrderTimes(locationId) - If
requireScheduledOrdersis true, show a time picker - If no time slots are available, the location is closed — show a message
”Minimum order not met” (400)
Cause: The cart total is below the location’s minimum order amount. Fix: Display the minimum amount to the customer and prompt them to add more items. The minimum is available in the location settings.Payments
Payment intent fails to create
Cause: Cart is missing required data (customer details, fulfillment method, or order time). Fix: Ensure all checkout steps are complete before creating a payment intent:- Fulfillment method is set
- Order time is set (ASAP or scheduled)
- Customer details are validated
- For delivery: address is set with coordinates
Stripe Elements not rendering
Cause: Stripe.js is not loaded or theclientSecret is invalid.
Fix:
- Verify
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEYis set - Pass the
stripeAccountIdfrom the payment intent response when initializing Stripe - Ensure the
clientSecretis passed to the Elements provider
3D Secure / SCA authentication popup not appearing
Cause: Missingreturn_url in the confirmPayment call.
Fix: Always provide a return_url:
Fulfillment
”Delivery out of range” (422)
Cause: The customer’s address is outside the location’s delivery zone. Fix:- Check distance before setting delivery:
storefront.locations.getDistance(locationId, { lat, lng, unit: 'miles' }) - Compare against the location’s delivery radius
- Show a clear message if out of range
Table-side / room service not available
Cause: The fulfillment method is not enabled for the location. Fix: Checklocation.methodsStatus and only show enabled methods:
Webhooks
Webhooks not being received
Check:- Your endpoint URL is correct and publicly accessible
- Your server returns
200within 10 seconds - The endpoint isn’t behind authentication (webhook requests don’t include session cookies)
- Check the delivery log in Dashboard under Settings > Webhooks for failed attempts
Signature verification failing
Cause: TheCRAVEUP_WEBHOOK_SECRET doesn’t match, or the body is being parsed before verification.
Fix:
- Use the raw request body for signature verification (not the parsed JSON)
- Ensure the secret matches the one shown in the Dashboard
SDK
”TypeError: storefront.X is not a function”
Cause: Incorrect SDK version or wrong import. Fix:- Update to the latest SDK:
pnpm add @craveup/storefront-sdk@latest - Verify the import:
import { createStorefrontClient } from '@craveup/storefront-sdk' - Check that you’re calling methods on the correct namespace (e.g.,
storefront.cart.get()notstorefront.get())
SDK requests failing in Server Components
Cause: The SDK usesfetch internally. In Next.js Server Components, ensure your API key is available server-side.
Fix: Use a server-side environment variable (without NEXT_PUBLIC_ prefix) or ensure the public variable is accessible in the server context.
Build & Deployment
Next.js build fails with SDK type errors
Fix: Ensure yourtsconfig.json includes "moduleResolution": "bundler" or "node" and that the SDK is installed (not just a peer dependency).
Images not loading in production
Cause: Next.js Image Optimization requires configured domains. Fix: Add the Crave CDN domain to yournext.config.ts: