<?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>Forem: Idorenyin Williams</title>
    <description>The latest articles on Forem by Idorenyin Williams (@idywilliams).</description>
    <link>https://forem.com/idywilliams</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%2F3657835%2F32492fea-a7bc-4f3c-b764-6a49673a885e.jpeg</url>
      <title>Forem: Idorenyin Williams</title>
      <link>https://forem.com/idywilliams</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/idywilliams"/>
    <language>en</language>
    <item>
      <title>I Got Tired of Rewriting Payment Code, So I Built a Unified SDK for Africa</title>
      <dc:creator>Idorenyin Williams</dc:creator>
      <pubDate>Thu, 11 Dec 2025 19:08:16 +0000</pubDate>
      <link>https://forem.com/idywilliams/i-got-tired-of-rewriting-payment-code-so-i-built-a-unified-sdk-for-africa-2e33</link>
      <guid>https://forem.com/idywilliams/i-got-tired-of-rewriting-payment-code-so-i-built-a-unified-sdk-for-africa-2e33</guid>
      <description>&lt;p&gt;Last weekend, I hit a wall.&lt;/p&gt;

&lt;p&gt;I was working on a project that needed payment integration. I started with Paystack. Halfway through, I realized for business reasons, I needed to switch to Flutterwave.&lt;/p&gt;

&lt;p&gt;"Should be a quick 10-minute job," I thought.&lt;/p&gt;

&lt;p&gt;I was wrong. It was a nightmare.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Fragmentation Problem
&lt;/h3&gt;

&lt;p&gt;Switching from Paystack to Flutterwave wasn't a simple swap. It was a complete refactor.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;Inconsistent Data:&lt;/strong&gt; Paystack expects the amount in &lt;code&gt;kobo&lt;/code&gt; (&lt;code&gt;50000&lt;/code&gt;). Flutterwave wants &lt;code&gt;Naira&lt;/code&gt; (&lt;code&gt;500&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Prop Name Hell:&lt;/strong&gt; Was it &lt;code&gt;publicKey&lt;/code&gt; or &lt;code&gt;public_key&lt;/code&gt;? &lt;code&gt;ref&lt;/code&gt; or &lt;code&gt;tx_ref&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;Different Response Objects:&lt;/strong&gt; Success callbacks returned completely different data structures.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My clean codebase was suddenly littered with &lt;code&gt;if (provider === 'paystack')&lt;/code&gt; statements. It was messy, hard to maintain, and felt incredibly inefficient. If I was struggling with this, thousands of other African developers probably were too.&lt;/p&gt;

&lt;p&gt;A senior engineer's solution would be to write an &lt;strong&gt;Adapter pattern&lt;/strong&gt;—a translation layer to normalize the data. But that’s dozens of lines of boilerplate code just to get started.&lt;/p&gt;

&lt;p&gt;There had to be a better way. So I built one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Introducing &lt;code&gt;use-africa-pay&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;use-africa-pay&lt;/code&gt; is an open-source SDK that unifies Africa's top payment gateways (Paystack, Flutterwave, Monnify, and Remita) under one simple, consistent API.&lt;/p&gt;

&lt;p&gt;It’s the Adapter pattern you don't have to write.&lt;/p&gt;

&lt;h4&gt;
  
  
  Before: The Manual, Messy Way
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// Every provider needs its own config and logic
if (provider === 'paystack') {
// ...handle Paystack's props, amount in kobo, and response
}
if (provider === 'flutterwave') {
// ...handle Flutterwave's props, amount in Naira, and response
}``
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  After: The Unified, Clean Way
&lt;/h4&gt;

&lt;p&gt;With &lt;code&gt;use-africa-pay&lt;/code&gt;, you write your logic once.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useAfricaPay } from '@use-africa-pay/core';

function PaymentButton({ provider, amount, email }) {
const { initializePayment } = useAfricaPay({
provider: provider, // 'paystack' | 'flutterwave' | 'monnify'
apiKey: '...',
amount: amount, // Always in the base currency (e.g., Naira)
email: email,
onSuccess: (response) =&amp;gt; {
// Standardized response!
console.log('Success! Transaction ID:', response.transactionId);
},
onClose: () =&amp;gt; console.log('Payment closed.'),
});

return &amp;lt;button onClick={initializePayment}&amp;gt;Pay Now&amp;lt;/button&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That’s it. Now, switching from Paystack to Flutterwave is as simple as changing the &lt;code&gt;provider&lt;/code&gt; prop. The SDK handles all the messy translation in the background.&lt;/p&gt;

&lt;h3&gt;
  
  
  We Need Your Help! This is an Open-Source Project
&lt;/h3&gt;

&lt;p&gt;I built this over a weekend, but its potential is huge. The goal is to create the ultimate payment layer for African developers, built by the community.&lt;/p&gt;

&lt;p&gt;This is a perfect opportunity if you're looking for your first open-source contribution. We have several issues labeled &lt;code&gt;good first issue&lt;/code&gt; that are ready to be picked up.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How you can contribute:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  ⭐ &lt;strong&gt;Star the repo on GitHub&lt;/strong&gt; to show your support.&lt;/li&gt;
&lt;li&gt;  💻 &lt;strong&gt;Pick up an issue&lt;/strong&gt; and submit a PR.&lt;/li&gt;
&lt;li&gt;  💡 &lt;strong&gt;Suggest a new feature&lt;/strong&gt; or request integration for another payment gateway.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's work together to solve this problem for everyone.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;NPM Package:&lt;/strong&gt; &lt;a href="https://www.npmjs.com/package/@use-africa-pay/core" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/@use-africa-pay/core&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;GitHub Repo:&lt;/strong&gt; &lt;a href="https://github.com/idyWilliams/use-africa-pay/issues" rel="noopener noreferrer"&gt;https://github.com/idyWilliams/use-africa-pay/issues&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What other payment gateways should we add next? Let me know in the comments!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>opensource</category>
      <category>goodfirstissue</category>
    </item>
  </channel>
</rss>
