Skip to content
<Rojit />
5 min read· August 1, 2026

How I Integrated Khalti, eSewa, and Stripe for a Restaurant SaaS

How I built one payment interface for a Nepal restaurant SaaS using Khalti, eSewa, and Stripe, with provider adapters, webhook reconciliation, and idempotency keys.

Written by Rojit Pokharel — Full-Stack Web Developer & System Architect, Kathmandu, Nepal

PaymentsLaravelRestaurant SaaSNepalWebhooks
How I Integrated Khalti, eSewa, and Stripe for a Restaurant SaaS
$

A Nepal restaurant SaaS needed to accept Khalti and eSewa for domestic outlets and Stripe for international orders. The chains also needed owners to reconcile all three without double-counting a payment. I built the payment layer for that system instead of treating gateway integration as a generic checkout tutorial.

The real constraint: one payment model, three provider behaviors

The platform served restaurant chains and multi-outlet food businesses in Nepal. Orders came from counters and online channels, while owners wanted a single revenue view across outlets. An off-the-shelf POS did not fit the payment landscape or the operating flow, so I designed a gateway abstraction before adding the second provider.

Khalti, eSewa, and Stripe each returned different webhook payloads and retry semantics. A callback could arrive more than once, and a naive update could create a duplicate financial record. That was the hard part: the app needed one payment state while each provider described success differently.

What I built

I wrote a provider adapter for each gateway and a normalization layer behind it. The order service called one payment interface; the adapter handled initiation, callback verification, status mapping, and retry behavior. Webhook endpoints used idempotency keys so repeated delivery could not mark the same order paid twice.

php
$gateway = match($restaurant->region) {
    'nepal' => $restaurant->payment_method === 'khalti'
        ? new KhaltiGateway()
        : new eSewaGateway(),
    default => new StripeGateway(),
};

$gateway->charge($order->total, $order->paymentMeta());

Nepal-based restaurants routed to Khalti or eSewa; international orders routed to Stripe. Queue workers processed payment updates and notifications outside the HTTP request, while webhook reconciliation kept the order ledger aligned with provider state.

What changed in production

The platform now runs for multiple restaurant chains and handles daily orders. Owners get one dashboard across outlets and reconciled multi-gateway payments. The real lesson was timing: the abstraction had to exist before the second gateway, not after payment behavior started leaking into orders, reports, and support workflows.

Building a product like this?

I build production web applications end-to-end — custom code, real-time systems, and deployments. Let's discuss your project.

Get in Touch