← Back to Documentation Home

FoodFeast — Complete Payment Gateway Integration Guide (Sandbox to Live)

FoodFeast — Complete Payment Gateway Integration Guide (Sandbox to Live)

FoodFeast — Complete Payment Gateway Integration Guide (Sandbox to Live)

On this page
  1. 1. Stripe Payment Gateway Setup
  2. 2. PayPal Gateway Setup
  3. 3. Confirming Payment in the Admin Panel
  4. 4. Go-Live Production Checklist
  5. 5. Common Payment Errors & Troubleshooting

FoodFeast supports four integrated payment methods:

  1. Stripe (Credit / Debit Cards & Digital Wallets)
  2. PayPal (PayPal Express Checkout & Wallets)
  3. Cash on Delivery (COD) (Cash payment directly to the delivery courier)
  4. Digital Customer Wallet (Preloaded in-app balance)

This guide covers the complete sandbox-to-live transition, test credential simulation, webhook synchronization, and administrative verification.


Payment gateway settings
Payment gateway settings

1. Stripe Payment Gateway Setup

1.1 Where Keys Are Placed

Stripe API credentials are read from the PaymentGateway record configured in the Admin Panel. The webhook signing secret is read from .env.

Option A: Via Admin Portal UI (Recommended):

  1. Log in to the Admin Portal (/login).
  2. Navigate to Business Settings → Payment Settings (/payment-gateways/edit).
  3. Under the Stripe Configuration card:
    • Toggle Enable Stripe to Active.
    • Set Stripe Mode to sandbox (for testing) or live (for production).
    • Enter your Test / Live Publishable Key (pk_test_... or pk_live_...).
    • Enter your Test / Live Secret Key (sk_test_... or sk_live_...).
  4. Click Save Changes.

Webhook secret in .env: Set STRIPE_WEBHOOK_SECRET=whsec_... in Laravel .env; place publishable and secret API keys in the payment gateway settings UI.


1.2 Running an End-to-End Test Transaction (Stripe Sandbox)

To test card processing without spending real money:

  1. Ensure Stripe Mode is set to sandbox (or pk_test_... is entered).
  2. Open the FoodFeast Customer App.
  3. Add food items to the cart and proceed to Checkout.
  4. Select Credit / Debit Card (Stripe) as the payment method.
  5. Enter official Stripe test card credentials (source: Stripe Official Documentation):
Card Type Card Number Expiry Date CVC Postal / ZIP
Standard Visa (Success) 4242 4242 4242 4242 Any future date (e.g. 12/30) 123 Any (e.g. 90210)
Mastercard (Success) 5555 5555 5555 4444 Any future date 123 Any
3D Secure Verification 4000 0027 6000 3184 Any future date 123 Any (Triggers 3DS popup)
Card Declined Test 4000 0000 0000 0002 Any future date 123 Any (Simulates decline)
  1. Complete the checkout. The app navigates to order tracking only after the backend confirms payment; otherwise check Orders for pending status.

1.3 Configuring the Stripe Webhook

Webhooks notify your server asynchronously if a customer completes payment in an external browser tab or mobile sheet:

  1. Log in to your Stripe Dashboard.
  2. In the top navigation, navigate to Developers → Webhooks.
  3. Click Add Endpoint.
  4. In Endpoint URL, enter: https://your-domain.com/api/stripe/webhook
  5. Under Select events to listen to, select:
    • checkout.session.completed
    • checkout.session.async_payment_succeeded
  6. Click Add Endpoint.
  7. Copy the Signing secret (whsec_...) and paste it into STRIPE_WEBHOOK_SECRET in your .env.

2. PayPal Gateway Setup

2.1 Where Keys Are Placed

Configure PayPal credentials through the Admin Payment Settings UI. The following variables are configuration examples and may not be consumed by the present PayPal service without additional integration:

In .env:

PAYPAL_MODE=sandbox          # Set to 'live' when launching
PAYPAL_SANDBOX_CLIENT_ID=your_sandbox_client_id_here
PAYPAL_SANDBOX_CLIENT_SECRET=your_sandbox_client_secret_here
PAYPAL_LIVE_CLIENT_ID=your_live_client_id_here
PAYPAL_LIVE_CLIENT_SECRET=your_live_client_secret_here
PAYPAL_CURRENCY=USD          # Match your platform currency

2.2 Running a Test Transaction (PayPal Sandbox)

  1. Go to the PayPal Developer Portal.
  2. Under Testing Tools → Sandbox Accounts, create or note your Personal Buyer Account email and password.
  3. In the Customer App, select PayPal at checkout.
  4. When the PayPal in-app browser opens, log in with your sandbox buyer credentials.
  5. Click Approve Payment.
  6. The app redirects to order tracking only after the Laravel callback verifies the transaction with PayPal. If confirmation is pending, open Orders and refresh.

3. Confirming Payment in the Admin Panel

To verify that an order was paid successfully:

  1. Open the Admin Panel and navigate to Order Management → Orders (/orders).
  2. Locate the placed test order in the table.
  3. Verify the following columns:
    • Payment Method: Displays Stripe or PayPal.
    • Payment Status: Displays a green Paid badge (instead of red Unpaid).
    • Order Status: Transitions to Pending / Confirmed.
  4. Click View Details:
    • The transaction ID returned by the payment gateway is logged in the order audit summary.

4. Go-Live Production Checklist

Before accepting real payments from actual customers, verify each item:

  • [ ] Mode Switch: Both Stripe and PayPal toggled to Live in Admin Portal → Payment Settings.
  • [ ] Live Keys: All pk_test_ and sk_test_ replaced with pk_live_ and sk_live_.
  • [ ] Live PayPal App: Live Client ID and Secret generated from a verified PayPal Business Account.
  • [ ] SSL (HTTPS): Ensure your domain has an active SSL certificate (HTTPS is mandatory for Stripe & PayPal).
  • [ ] Supported Currency: Ensure your configured currency (e.g. USD, EUR, GBP) is officially supported by both Stripe and PayPal.
  • [ ] Real 1-Cent Test: Run a live credit card test with a real card for a small amount (e.g. $1.00) to confirm your bank payout routing works.

5. Common Payment Errors & Troubleshooting

Error Code / Symptom Root Cause Solution
No such API key: pk_test... Secret key and publishable key mismatch. Ensure both keys belong to the same Stripe account and mode (test vs live).
Payment Failed / Webview Blank Backend URL is insecure (http:// instead of https://). Stripe and PayPal require valid HTTPS certificates. Verify your domain SSL.
Invalid Currency Code Currency configured in Admin Panel is not supported by PayPal. Check PayPal's supported currencies list and set matching code in PAYPAL_CURRENCY.
Order remains Unpaid after card charge Webhook URL is blocked or STRIPE_WEBHOOK_SECRET is incorrect. Check your Stripe Dashboard webhook attempt logs. Ensure firewall does not block /api/stripe/webhook.

Currency limitation (this patched version): Stripe and PayPal charge in USD only. Checkout intentionally refuses an incompatible configured payment currency instead of applying an incorrect conversion. Multi-currency charging requires a separate, fully tested currency conversion design.

FoodFeast Documentation