#payments December 8, 2025 12 min
Integrating 6 Payment Gateways
How we unified 6 providers under a single abstraction layer.
Payments are the lifeblood of e-commerce. At Sharaf DG, we integrated 6 different payment gateways to serve customers across the Middle East — APS, Checkout.com, Tabby, Tamara, STC Pay, and Paymob.
Why 6 Gateways?
No single payment provider covers all the needs of a multi-country e-commerce platform in the Middle East:
- APS (Amazon Payment Services) — Primary gateway for card payments in the UAE
- Checkout.com — International card processing with strong fraud tools
- Tabby — Buy Now, Pay Later for UAE and Saudi Arabia
- Tamara — BNPL focused on Saudi Arabia
- STC Pay — Mobile wallet popular in Saudi Arabia
- Paymob — Payment processing for Egypt
The Abstraction Layer
Rather than scattering gateway-specific code throughout the application, we built a unified payment abstraction layer. Every gateway implements the same interface:
initiatePayment()— Start a payment sessioncapturePayment()— Capture an authorized paymentrefundPayment()— Process a refundgetPaymentStatus()— Check transaction status
This means the checkout flow doesn’t care which gateway is being used. The routing logic selects the appropriate gateway based on the customer’s country, payment method, and order value.
Lessons Learned
- Build the abstraction first — Don’t integrate gateways directly into your checkout flow
- Handle webhooks carefully — Each gateway has different webhook formats and retry policies
- Test with real cards — Sandbox environments don’t catch all edge cases
- Monitor everything — Payment failures should trigger immediate alerts
- Plan for reconciliation — You need to match gateway records with your order system daily