Skip to content
All posts
paymentsegyptmarketplaceb2bescrow

B2B Payments in Egypt: Why We Chose InstaPay and Escrow

November 12, 2026 11 min read· Mahmoud Makhlouf
اقرأ هذا المقال بالعربية

An elevator contractor in Cairo orders a custom cabin that a factory will spend weeks building. He is not going to type a six-figure amount into a card form. He will open his banking app, send a transfer, screenshot the receipt and ask on WhatsApp: "Did it arrive?"

Short answer: for B2B orders in Egypt, card gateways are often the wrong default. Buyers pay large amounts by bank transfer or InstaPay, and percentage fees on big tickets add up. We moved Montra to receipt-based payments: the buyer transfers, uploads the receipt, finance verifies, and only then does fulfilment start. Custom cabins go further, with the deposit held in escrow until delivery.

The business problem

Montra is the B2B elevator-parts marketplace we build and run in Egypt. Its buyers are installers, maintenance companies and contractors. They buy controllers, ropes, door operators and full cabins, often for a specific lift on a specific site, and their tickets are much larger than a typical consumer basket.

That changes the payment question in three ways.

Fees scale with the ticket. A card gateway charges a percentage of each transaction. On a 500-pound phone case, that is noise. On a 100,000-pound cabin, it is a line item somebody has to absorb, either the platform's margin or the buyer's price. Our own design notes from the wallet work put it plainly: the priority was to avoid gateway fees and to hold the money in the company's own account.

Buyers already pay by transfer. Trade buyers in Egypt settle with suppliers by bank transfer, InstaPay or cash. Asking them to switch to a card for a purchase this size adds friction, and large amounts can run into card spending limits.

Some orders need trust in both directions. A cabin is manufactured to order. The factory wants proof the buyer is serious before it cuts steel. The buyer does not want to hand a large deposit to a factory he has never dealt with. Someone neutral has to hold the money.

InstaPay matters here because it made bank-to-bank transfers instant. The Central Bank of Egypt launched the Instant Payment Network (IPN) in March 2022, and InstaPay is the consumer app on top of it. According to figures the CBE reported in November 2026, the network has more than 24 million registered InstaPay users and processed around EGP 7 trillion through September 2026. InstaPay transfers have per-transaction and monthly caps set by the CBE, so the largest payments still go by regular bank transfer. Check your bank for the current limits.

The options for a B2B platform

OptionWorks well forWatch out for
Card gateway (Paymob and similar)Retail baskets, instant automated confirmationPercentage fees on large tickets, card limits, buyers who don't pay by card
Cash on deliverySmall orders, first-time buyersFake orders, cash handling, stock reserved for buyers who never show up
Bank transfer / InstaPay with receipt reviewLarge tickets, trade buyersManual review time, fake or reused receipts, orders stuck "awaiting payment"
Escrow deposit held by the platformCustom manufacturing, unknown counterpartiesSettlement accounting, refund and forfeit rules, double-billing the seller

Gateways like Paymob and Fawry do exactly what they are built for, and many Egyptian stores depend on them. For Montra the question was fit. The design document that retired our card path in August 2026 records the decision in one line: the business did not want to hold a payment-gateway relationship or process cards, because money arrives in the platform's bank account by transfer and is verified there. The receipt-review step already existed for wallet top-ups and cabin deposits, so we extended it to every order.

How we built it in Montra

The migration happened in two steps.

August 2026: card gateway out. We deleted the Paymob module, its webhook handler, the payment page and its environment variables. The CARD and MOBILE_WALLET values stay in the database enum, marked "historical orders only", so old orders still read correctly.

September 2026: every order is a transfer. New orders are paid by bank transfer or InstaPay to Montra's account. An admin setting decides whether deposits are allowed and at what percentage. When they are, the buyer picks FULL (the whole total now) or DEPOSIT (a share now, the balance in cash to the courier at delivery). When they are not, it is FULL only.

checkout payment step with FULL / DEPOSIT choice, InstaPay pay button and QR beside the bank detailscheckout payment step with FULL / DEPOSIT choice, InstaPay pay button and QR beside the bank details

Three flows now share one pattern:

  1. Orders. The order is placed on hold, the buyer transfers and uploads the receipt, an admin confirms, and only then is the order split to suppliers.
  2. Wallet top-ups. A customer wallet handles cashback, compensation, refunds and penalties. Customers top it up by transfer with a receipt. A negative balance (a penalty the customer owes) blocks new orders until it is settled.
  3. Cabin deposits in escrow. The deposit goes to Montra's account, not the factory's. It is held through manufacturing and settled to the factory after delivery.

client wallet top-up card: amount, reference code, bank/InstaPay details, receipt upload and status lineclient wallet top-up card: amount, reference code, bank/InstaPay details, receipt upload and status line

Under the hood: one state machine, three tables

Every receipt flow follows the same shape:

PENDING ──buyer uploads receipt──▶ RECEIPT_SUBMITTED
                                     ├─ finance confirms ─▶ CONFIRMED  (money is in our account)
                                     ├─ finance rejects  ─▶ PENDING / REJECTED (+ reason)
                                     └─ admin waives     ─▶ WAIVED     (exceptional, orders and cabins)

Cabin deposits continue:
CONFIRMED ──delivered, admin settles──▶ SETTLED   (deposit − dues paid to the factory)
CONFIRMED ──cancelled──▶ REFUNDED  (back to the buyer)
                     └─▶ FORFEITED (to the factory, only if an admin cancels a taken job with the buyer at fault)

The hard part is that finance and the customer act on the same row at the same time. Four problems came up, each with a specific answer in the code.

1. A late receipt must not undo a decision

A customer can upload a receipt at the exact moment finance rejects the top-up or the customer cancels it from another tab. If the code reads the row, checks the status, then writes, the upload can overwrite a decision that committed in between. So every write is conditional on the status it expects:

const { count } = await tx.walletTopup.updateMany({
  where: { id: topupId, status: { in: ["PENDING", "RECEIPT_SUBMITTED"] } },
  data: { proofImageUrl: url, proofAssetId: asset.id, status: "RECEIPT_SUBMITTED" },
});
if (count !== 1) {
  throw new ConflictException("The top-up changed meanwhile, reload and try again");
}

Confirmation takes a row lock (SELECT ... FOR UPDATE) before crediting the wallet, so two finance clicks serialize. The second one sees CONFIRMED and stops instead of crediting twice. Cabin deposits use the same lock for confirm, reject, waive and cancel, and a repeated confirm is a no-op with no second notification.

2. One transfer, one credit

The most obvious fraud on a receipt flow is to upload the same screenshot twice. Every uploaded receipt gets an asset row with the uploader, size and SHA-256 hash. When a receipt is attached to a top-up, that asset is claimed for good, and the top-up stores the asset id under a unique index. Two racing submissions get a success and a conflict, never two credits.

The URL itself is not trusted either. A customer can only attach a file they uploaded themselves, and the stored URL is rebuilt on the server from that asset rather than taken from the request.

3. Receipts are private documents

A transfer receipt shows names, account numbers and amounts. Montra stores receipts in a private folder outside the public static root and serves them through a guarded route: the uploader and finance or admin staff can read them, nobody else. Uploads accept raster images only (JPEG, PNG, WebP, GIF) up to 5 MB, and the file's magic bytes must match the declared type before anything is written. SVG is refused because it can carry script. Receipts that were uploaded but never attached are swept daily, and each user has a storage quota.

admin receipt review queue: order, expected amount, receipt image, reference, Confirm / Reject / Waiveadmin receipt review queue: order, expected amount, receipt image, reference, Confirm / Reject / Waive

4. The payment link must be ours

Every "pay us" screen shows an InstaPay button and a QR code of the platform's InstaPay payment link, next to the plain bank details. A payment link stored in settings is a phishing target: whoever edits it redirects the money. So the link is validated on save and again on read:

export function isValidInstapayLink(url: string): boolean {
  let parsed: URL;
  try { parsed = new URL(url.trim()); } catch { return false; }
  if (parsed.protocol !== "https:") return false;
  if (parsed.username || parsed.password || parsed.port) return false;
  const host = parsed.hostname.toLowerCase();
  return host === "ipn.eg" || host.endsWith(".instapay.com.eg");
}

An invalid link is refused when an admin saves it, and dropped when it is read, so a tampered value never reaches a customer. The QR is hidden on small screens, since the buyer would be scanning with the phone they are holding. The button is always there.

Stale holds release stock

Checkout reserves the chosen supplier's stock before any money arrives. A buyer who never transfers would hold that stock indefinitely. A cron job runs every 30 minutes and cancels holds older than an admin-configured number of hours, releasing the reservation. Orders already in RECEIPT_SUBMITTED are skipped: the buyer has paid and is waiting on us, and our review queue is not their fault.

Escrow settlement without double-billing

This is the part that took the most care. Montra earns its dues on a cabin from the price spread plus a supplier commission, and factories also receive a monthly commission invoice. If the deposit settlement collected dues and the monthly invoice billed them again, the factory would pay twice.

The settlement treats the commission record as the single source of truth:

if (record.status === "INVOICED") {
  throw new BadRequestException(
    "Commission is already on an invoice: mark that invoice paid, then settle the deposit.",
  );
}
const collectFromDeposit = record.status === "ACCRUED";
const dues = collectFromDeposit ? record.margin : 0;
const payout = depositAmount - dues;
// mark the record PAID ("Collected from deposit escrow") in the same transaction

Dues collected from the deposit mark the commission record paid inside the same transaction that writes the ledger entry and the payout, so the monthly invoice run never sees it as outstanding. If the dues are larger than the deposit, settlement refuses and the order goes through the invoice instead. A retry with the same transfer reference is a no-op; a different reference on a settled deposit is refused.

Two more rules came from real conversations about cabins. First, the job is only offered to factories after the deposit is confirmed, so no factory starts on an unfunded order. Second, the refund-or-forfeit outcome is fixed at the moment of cancellation. A factory cancelling, or any cancellation before a factory took the job, is always a full refund. The deposit goes to the factory only when an admin cancels a job already in production with the buyer at fault.

cabin order deposit status timeline: receipt submitted, confirmed in escrow, delivered, settledcabin order deposit status timeline: receipt submitted, confirmed in escrow, delivered, settled

Checklist: before you launch receipt-based payments

  1. Model payment as a state machine with explicit states for "receipt submitted" and "rejected with reason", not a boolean paid.
  2. Make every status write conditional on the status you read, and lock the row when money moves.
  3. Store a hash and owner for each receipt, and bind one receipt to one payment with a unique constraint.
  4. Keep receipts out of any public folder. Serve them through an authorized route.
  5. Validate uploads by content, not by filename or declared type.
  6. Validate any payment link or bank detail an admin can edit, on write and on read.
  7. Expire unpaid holds so stock is never locked by buyers who never transferred, and never expire an order whose receipt is waiting on you.
  8. For escrow, decide refund and forfeit rules before launch and record the outcome at cancellation time.
  9. Have one source of truth for platform dues, so settlement and monthly invoices cannot both bill the seller.
  10. Write tests for the races (double confirm, upload during cancel), not only the happy path.

Frequently asked questions

Is InstaPay suitable for B2B payments in Egypt?

For many B2B orders, yes. It is instant, moves money between bank accounts, Meeza cards and mobile wallets, and trade buyers already use it. It does have per-transaction and monthly caps set by the Central Bank of Egypt, so the largest payments still need a regular bank transfer. A platform should offer both and treat them the same way in its review flow.

Can a marketplace accept InstaPay automatically without manual review?

Montra confirms every transfer against the platform's own bank account, which is why it has a finance review queue. That review is the step a buyer waits on, so we keep the queue visible to admins and never expire an order whose receipt is already in it. The state machine itself does not care who confirms, so an automated confirmation source could replace the human step later without changing the flow for buyers.

How do you stop fake transfer receipts?

You verify the money in your own bank account, never the screenshot alone. The receipt speeds up matching by giving finance an amount, a time and a reference. On the software side, bind each uploaded receipt to one payment, record its hash and uploader, and reject reused files.

What is an escrow deposit in a marketplace?

It is a deposit the platform holds on behalf of both sides until the order is delivered. In Montra, a cabin buyer pays the deposit to the platform, the factory starts once it is confirmed, and the platform settles it to the factory after delivery, minus its dues. Cancellation rules decide whether it goes back to the buyer or to the factory.

Should a new marketplace in Egypt start with a card gateway?

It depends on the ticket size and who pays. Consumer stores with small baskets usually benefit from cards and wallets with automatic confirmation. B2B platforms with large orders often do better starting with transfers and receipt review, and adding a gateway later for the segment that wants it.

Next step

If you are planning payments for a marketplace in Egypt, start by writing down your typical ticket size, how your buyers pay their suppliers today, and which orders need a deposit. Those three answers decide most of the architecture. Our guide to building a marketplace in Egypt covers the rest of the stack, and the spare-parts marketplace MVP checklist covers what belongs in version one.

When you are ready, send us a short brief and we will tell you how we would structure payments for your case.

// Let's build

Have a product in mind? Get a clear plan and a free 15-minute intro call.

Tell us what you're building. We'll come back with an approach, a rough timeline, and a ballpark — usually within 24 hours.

Book a free discovery call WhatsApp