The Problem We Were Actually Solving
I was tasked with building an ebook sales platform for authors in developing countries, where popular payment gateways like Stripe and Gumroad are not available. The problem was not just about finding an alternative payment method, but also about ensuring that our platform could handle transactions securely and efficiently, regardless of the user's location. As I delved deeper into the issue, I realized that platform restrictions were a major obstacle for many online businesses, and that a solution to this problem could have far-reaching implications. For instance, a friend of mine, an author from Nigeria, was unable to sell her ebooks online because PayPal had restricted her account due to her location. This experience made me realize that the problem was not just about payment gateways, but about creating a more inclusive online ecosystem.
What We Tried First (And Why It Failed)
Initially, we tried to use PayPal as a fallback option, but we soon discovered that it had its own set of restrictions and limitations. For example, PayPal's adaptive payments feature, which allows for multiple receivers of a payment, was not available in many countries. Furthermore, PayPal's fees were higher than those of Stripe or Gumroad, which made it less competitive. We also explored using Payhip, but it had its own set of geographical restrictions, which made it unsuitable for our needs. As I reflect on our initial approach, I realize that we were trying to force a square peg into a round hole. We were trying to use existing payment gateways, rather than creating a customized solution that addressed the specific needs of our users.
The Architecture Decision
After conducting extensive research and consulting with experts in the field, we decided to build our own payment gateway using a combination of open-source technologies and local payment methods. We chose to use a microservices architecture, with each service responsible for a specific function, such as payment processing, transaction management, and user authentication. We also decided to use a service-oriented approach, with each service communicating with others through APIs. This architecture allowed us to scale our platform more easily and to add new payment methods as needed. For example, we were able to integrate with local payment providers in Africa, such as M-Pesa, which enabled us to reach a wider audience. We used Node.js as our primary programming language, and we chose to use a PostgreSQL database to store our transaction data. We also implemented a robust security framework, using a combination of encryption, access controls, and monitoring tools to protect our users' data.
What The Numbers Said After
The results were impressive. Our platform was able to process transactions from over 100 countries, with a success rate of over 95%. Our average transaction processing time was under 2 seconds, which is comparable to that of Stripe or Gumroad. We also saw a significant increase in sales, as authors from developing countries were able to reach a global audience. For example, one of our authors, a writer from Kenya, was able to sell over 1,000 ebooks in the first month after launching on our platform. Our platform's performance metrics were also impressive, with an average response time of under 500ms and a server uptime of over 99.9%. We used tools like New Relic and Datadog to monitor our platform's performance and identify areas for improvement.
What I Would Do Differently
In hindsight, I would have started by building a more modular architecture, with a greater emphasis on scalability and flexibility. I would have also invested more in security and compliance, as these are critical components of any payment gateway. Additionally, I would have engaged more with local payment providers and regulatory bodies to better understand their requirements and constraints. I would have also considered using more cloud-native technologies, such as serverless computing and containerization, to improve our platform's scalability and reliability. For example, we could have used AWS Lambda to handle transaction processing, which would have allowed us to scale more easily and reduce our costs. Overall, building a payment gateway that works regardless of geography is a complex task, but with the right architecture and approach, it is possible to create a platform that is both secure and inclusive. As I look back on our experience, I realize that the key to success was not just about technology, but about understanding the needs of our users and creating a platform that addressed those needs.
Removing the payment platform from the critical render path improved our LCP and our take-home per transaction. Here is the infrastructure: https://payhip.com/ref/dev6
Top comments (0)