๐ณ Payments โ
KitchenAsty supports three payment methods: Stripe, PayPal, and Cash.
๐ฐ Stripe โ
๐ ๏ธ Setup โ
- Create a Stripe account
- Get your API keys from the Stripe Dashboard
- Set environment variables:
dotenv
STRIPE_SECRET_KEY=sk_test_...
STRIPE_WEBHOOK_SECRET=whsec_...๐ Webhooks โ
Stripe notifies KitchenAsty of payment status changes via webhooks.
- In the Stripe Dashboard, go to Developers โ Webhooks
- Add an endpoint:
https://your-domain.com/api/payments/webhook - Select the event
payment_intent.succeeded - Copy the signing secret to
STRIPE_WEBHOOK_SECRET
For local development, use the Stripe CLI:
bash
stripe listen --forward-to localhost:3000/api/payments/webhook๐ Payment Flow โ
- Client calls
POST /api/payments/create-intentwith the order ID - Server creates a Stripe PaymentIntent and returns the
clientSecret - Client uses Stripe.js to confirm the payment
- Stripe sends a webhook to
/api/payments/webhook - Server updates the payment and order status
๐ ฟ๏ธ PayPal โ
๐ ๏ธ Setup โ
- Create a PayPal developer account
- Create a REST API app in the developer dashboard
- Set environment variables:
dotenv
PAYPAL_CLIENT_ID=your-client-id
PAYPAL_CLIENT_SECRET=your-client-secret๐ Payment Flow โ
- Client calls
POST /api/payments/paypal/createwith the order ID - Server creates a PayPal order and returns the PayPal order ID
- Client redirects to PayPal for approval
- Client calls
POST /api/payments/paypal/captureafter approval - Server captures the payment and updates order status
๐ต Cash โ
Cash payments are recorded by staff:
- Customer places an order with cash payment method
- Staff marks the payment as received via
POST /api/payments/cash - Order status is updated accordingly
No external configuration is required for cash payments.