Skip to main content
Crave provides tools for testing your storefront integration without affecting live data. This guide covers test API keys, mock data patterns, and example test suites.

Test mode

Use a test API key (prefixed with sk_test_) to make requests against the production API without creating real orders or processing real payments.
Test mode behaves identically to production with these differences:
BehaviorProductionTest mode
OrdersSent to restaurantLogged but not sent
PaymentsReal chargesStripe test mode
WebhooksProduction URLTest URL (if configured)
Rate limits200/10 min200/10 min (same)
Generate a test API key from the Dashboard under Settings > API Keys > Test Keys.

Test Stripe payments

In test mode, Crave automatically uses Stripe’s test environment. Use Stripe’s test card numbers:
CardScenario
4242 4242 4242 4242Successful payment
4000 0000 0000 32203D Secure required
4000 0000 0000 0002Card declined
4000 0025 0000 3155SCA authentication required
Use any future expiry date and any 3-digit CVC.

Unit testing the SDK

The SDK accepts a custom fetch implementation, making it easy to mock API responses in tests:

Test error handling

Verify your app handles API errors correctly:

Integration testing

For integration tests against the real API, use your test API key and clean up after each test:

Testing webhook handlers

Send mock webhook payloads to your local handler:

Next steps

Error Codes

Handle every error the API can return.

Deployment

Deploy your storefront to production.