Crave handles payment processing through Stripe, but you’ll need to integrate Stripe’s client-side components in your storefront. This guide shows you how to add secure payment processing to your storefront.
# Stripe ConfigurationNEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_...# Crave API Configuration (already set up)CRAVEUP_API_KEY=your_api_key_hereCRAVEUP_API_BASE_URL=https://api.cravejs.comNEXT_PUBLIC_LOCATION_ID=your_location_id_here
function getErrorMessage(error) { switch (error.code) { case 'card_declined': return 'Your card was declined. Please try a different card.'; case 'insufficient_funds': return 'Insufficient funds. Please try a different card.'; case 'expired_card': return 'Your card has expired. Please use a different card.'; case 'incorrect_cvc': return 'Your card security code is incorrect.'; default: return 'Payment failed. Please try again.'; }}