Test mode
Use a test API key (prefixed withsk_test_) to make requests against the production API without creating real orders or processing real payments.
| Behavior | Production | Test mode |
|---|---|---|
| Orders | Sent to restaurant | Logged but not sent |
| Payments | Real charges | Stripe test mode |
| Webhooks | Production URL | Test URL (if configured) |
| Rate limits | 200/10 min | 200/10 min (same) |
Test Stripe payments
In test mode, Crave automatically uses Stripe’s test environment. Use Stripe’s test card numbers:| Card | Scenario |
|---|---|
4242 4242 4242 4242 | Successful payment |
4000 0000 0000 3220 | 3D Secure required |
4000 0000 0000 0002 | Card declined |
4000 0025 0000 3155 | SCA authentication required |
Unit testing the SDK
The SDK accepts a customfetch 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.