This guide explains the order processing flow from a storefront perspective. Important: Storefronts don’t directly create or manage orders - this is handled by Crave’s backend via webhooks after successful payments.
// Show immediate confirmationfunction showOrderConfirmation(paymentIntent) { return ( <div className="order-success"> <h2>Payment Successful!</h2> <p>Your order has been placed and sent to the restaurant.</p> <p>Order ID: {paymentIntent.id}</p> <p>Amount: ${(paymentIntent.amount / 100).toFixed(2)}</p> <div className="next-steps"> <h3>What's next?</h3> <ul> <li>✅ Payment processed</li> <li>🔄 Order sent to restaurant</li> <li>⏳ Restaurant will confirm your order</li> <li>👨🍳 Food preparation begins</li> </ul> </div> </div> );}
function handleOrderError(error) { switch (error.type) { case 'payment_failed': return 'Payment failed. Please try again with a different payment method.'; case 'payment_cancelled': return 'Payment was cancelled. Your order was not placed.'; case 'network_error': return 'Network error. Please check your connection and try again.'; default: return 'An error occurred. Please try again or contact support.'; }}// In your checkout componentconst handlePaymentError = (error) => { const errorMessage = handleOrderError(error); setError(errorMessage); // Log error for debugging console.error('Payment error:', error);};
As a storefront developer, your responsibility ends when the payment succeeds. The order creation and management is handled by Crave’s backend and the merchant. Focus on:
Smooth checkout experience
Clear payment confirmation
Proper error handling
Setting correct expectations
The merchant handles everything after payment success through the Crave Business Manager.