<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: OBAIDA attaee</title>
    <description>The latest articles on DEV Community by OBAIDA attaee (@obaidaattaee).</description>
    <link>https://dev.to/obaidaattaee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3959774%2F86b537d8-69d6-4f03-8400-90171c92c425.jpg</url>
      <title>DEV Community: OBAIDA attaee</title>
      <link>https://dev.to/obaidaattaee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/obaidaattaee"/>
    <language>en</language>
    <item>
      <title>Stripe-only breaks the moment you sell in Cairo — so I open-sourced a Laravel SaaS boilerplate with 13 payment gateways</title>
      <dc:creator>OBAIDA attaee</dc:creator>
      <pubDate>Sun, 31 May 2026 08:12:42 +0000</pubDate>
      <link>https://dev.to/obaidaattaee/stripe-only-breaks-the-moment-you-sell-in-cairo-so-i-open-sourced-a-laravel-saas-boilerplate-with-3lpi</link>
      <guid>https://dev.to/obaidaattaee/stripe-only-breaks-the-moment-you-sell-in-cairo-so-i-open-sourced-a-laravel-saas-boilerplate-with-3lpi</guid>
      <description>&lt;p&gt;Every Laravel SaaS boilerplate I've ever used makes the same quiet assumption: &lt;strong&gt;your customers pay with Stripe.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That assumption holds right up until you try to sell to a business in Cairo, Riyadh, Dubai, Doha, Kuwait City, or Kuala Lumpur — where the cards, wallets, and kiosk-payment habits people actually use&lt;br&gt;
run through Paymob, Fawry, HyperPay, MyFatoorah, Telr, HitPay, and a dozen others. Suddenly the boilerplate that was going to save you a month of work can't take a single payment from your real market.&lt;/p&gt;

&lt;p&gt;I kept hitting this on client projects, so I built the thing I wanted to fork from. It's called &lt;strong&gt;Quartz&lt;/strong&gt;, it's MIT-licensed, and it ships with &lt;strong&gt;13 payment gateways behind one interface&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Global&lt;/strong&gt; — Stripe, PayPal&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Egypt&lt;/strong&gt; — Paymob, Fawry, PayTabs, Geidea&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;GCC&lt;/strong&gt; — Amazon Payment Services, Telr, HyperPay, MyFatoorah&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Malaysia&lt;/strong&gt; — HitPay, Billplz, iPay88&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;→ &lt;strong&gt;&lt;a href="https://github.com/Quartz-Solutions/saas" rel="noopener noreferrer"&gt;github.com/Quartz-Solutions/saas&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But the interesting part isn't the list. It's that these gateways don't agree on &lt;em&gt;anything&lt;/em&gt; about how checkout works — and making them look uniform to the rest of the app was the actual engineering&lt;br&gt;
problem.&lt;/p&gt;
&lt;h2&gt;
  
  
  The problem: 13 gateways, 5 completely different checkout flows
&lt;/h2&gt;

&lt;p&gt;When you call "start a payment" on these gateways, here's what they hand you back:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stripe / PayPal / PayTabs / MyFatoorah&lt;/strong&gt; → a hosted URL you redirect the browser to.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paymob&lt;/strong&gt; → an &lt;strong&gt;iframe&lt;/strong&gt; you embed in your page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HyperPay&lt;/strong&gt; → a &lt;strong&gt;JavaScript widget&lt;/strong&gt; (COPYandPAY) you script into the DOM.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Payment Services / iPay88&lt;/strong&gt; → a set of signed fields you render as a &lt;strong&gt;self-submitting form POST&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fawry&lt;/strong&gt; → a &lt;strong&gt;kiosk reference number&lt;/strong&gt; the customer takes to a physical kiosk and pays in cash, days later.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A naive boilerplate leaks this everywhere — the controller ends up with a &lt;code&gt;match ($gateway)&lt;/code&gt; for every decision, and adding a gateway means touching the UI in ten places. That's not polymorphism; it's a&lt;br&gt;
tagged union wearing a trench coat.&lt;/p&gt;
&lt;h2&gt;
  
  
  The fix: a discriminated &lt;code&gt;CheckoutResult&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Every gateway implements one interface:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;CheckoutGateway&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;initiateCheckout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;CheckoutSession&lt;/span&gt; &lt;span class="nv"&gt;$session&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kt"&gt;CheckoutResult&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="cd"&gt;/** @return array&amp;lt;int, string&amp;gt; ISO 4217 codes this gateway can settle */&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;supportedCurrencies&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;array&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 

    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;function&lt;/span&gt; &lt;span class="n"&gt;supportsSubscriptions&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;initiateCheckout() returns one of five known result kinds — a discriminated union the front end knows how to render:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RedirectCheckout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$sessionId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$stripeSession&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;// or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;IframeCheckout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$sessionId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;iframeUrl&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$paymobUrl&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'height'&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'700'&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;// or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;KioskReferenceCheckout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$sessionId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reference&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'1234567890'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;// …plus FormPostCheckout and WidgetCheckout&lt;/p&gt;

&lt;p&gt;The result is persisted on a CheckoutSession row (result_kind + result_payload jsonb), and a single React component switches on it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="k"&gt;switch&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;result_kind&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s1"&gt;'redirect'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;   &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;RedirectTo&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s1"&gt;'iframe'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;CheckoutIframe&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;...&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s1"&gt;'form_post'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;AutoSubmittingForm&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;...&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s1"&gt;'widget'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;     &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ScriptedWidget&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;...&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="s1"&gt;'kiosk_ref'&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;KioskReferenceCard&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;...&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now adding a 14th gateway is one driver class returning the right CheckoutResult — zero controller or UI changes. Webhooks reconcile back to the CheckoutSession by (gateway, gateway_session_id),&lt;br&gt;
idempotently, so a re-delivered event never double-creates a subscription.&lt;/p&gt;

&lt;p&gt;This also fixed a subtler bug: with a single "Subscribe" button silently posting a default gateway, disabling Stripe used to 500 the page. Now picking a plan creates a checkout intent, the user picks an&lt;br&gt;
enabled gateway that supports the plan's currency, and only then does any gateway API get touched.&lt;br&gt;
enabled gateway that supports the plan's currency, and only then does any gateway API get touched.&lt;/p&gt;

&lt;p&gt;What else is in the box&lt;/p&gt;

&lt;p&gt;The gateways are the headline, but a SaaS needs the boring parts done too. Quartz ships:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Multi-tenancy — path-based (/t/{slug}/…) with a TenantResolver seam so subdomain/custom-domain is a swap, not a rewrite. Roles per tenant via Spatie teams, invitations, owner transfer, soft-delete +
30-day GDPR purge.&lt;/li&gt;
&lt;li&gt;Auth — Fortify (2FA, email verification, password reset), magic links, social login, session management, login history.&lt;/li&gt;
&lt;li&gt;Admin scope — super-admin with impersonation, audit log, webhook event replay, feature flags, and a real metrics dashboard (MRR, churn).&lt;/li&gt;
&lt;li&gt;Public REST API — Sanctum tokens with a scoped ability catalog, per-category rate limits, idempotency keys, outbound webhooks (HMAC-signed, retried), and Scribe-generated docs.&lt;/li&gt;
&lt;li&gt;A block-based CMS for the marketing site, with versioning and preview.&lt;/li&gt;
&lt;li&gt;674 feature tests, green on both SQLite and real Postgres 16.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Stack: &lt;strong&gt;Laravel 13&lt;/strong&gt; · &lt;strong&gt;Inertia&lt;/strong&gt; · &lt;strong&gt;React 19&lt;/strong&gt; · &lt;strong&gt;TypeScript&lt;/strong&gt; · &lt;strong&gt;Tailwind 4&lt;/strong&gt; · &lt;strong&gt;Postgres 16&lt;/strong&gt; · &lt;strong&gt;Redis&lt;/strong&gt;, with Docker dev + prod stacks.&lt;/p&gt;

&lt;p&gt;It's MIT — fork it and ship&lt;/p&gt;

&lt;p&gt;Quartz is meant to be cloned per project (git clone … my-saas) and made your own. No license fee, no attribution required, commercial use fine.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone https://github.com/Quartz-Solutions/saas.git my-saas
&lt;span class="nb"&gt;cd &lt;/span&gt;my-saas &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; docker compose up &lt;span class="nt"&gt;-d&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you're building a SaaS that needs to take money in MENA, the GCC, or Southeast Asia — or you just want a head start that isn't Stripe-only — I'd love for you to try it and tell me where it falls&lt;br&gt;
short.&lt;/p&gt;

&lt;p&gt;⭐ &lt;a href="https://github.com/Quartz-Solutions/saas" rel="noopener noreferrer"&gt;https://github.com/Quartz-Solutions/saas&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Built by Quartz Solutions (&lt;a href="https://github.com/Quartz-Solutions" rel="noopener noreferrer"&gt;https://github.com/Quartz-Solutions&lt;/a&gt;) — we build multi-tenant SaaS products and wire up the regional payment gateways most shops can't. If that's a problem you have, say hi&lt;br&gt;
(&lt;a href="https://github.com/Quartz-Solutions" rel="noopener noreferrer"&gt;https://github.com/Quartz-Solutions&lt;/a&gt;).&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>saas</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
