DEV Community

Cover image for A Crypto Store Without the Strings Attached: Why I Ditched Popular Payment Providers for a Slightly Uglier Solution
pretty ncube
pretty ncube

Posted on

A Crypto Store Without the Strings Attached: Why I Ditched Popular Payment Providers for a Slightly Uglier Solution

The Problem We Were Actually Solving

At first glance, it seemed I was trying to build a standard e-commerce solution. However, as I dug deeper, I discovered that our users needed a way to purchase digital products without relying on traditional payment providers. I wanted to create a system that would allow us to manage digital goods sales, while sidestepping the geographical restrictions imposed by PayPal and Stripe.

What We Tried First (And Why It Failed)

Initially, I decided to use the Alipay wallet as a workaround. This Chinese payment giant has a partnership with several digital currency exchanges, which I thought would get us out of this geographic nightmare. So, I set up an Alipay integration, thinking it would solve our problems. However, Alipay has strict requirements for merchants selling digital goods, and their wallet API was woefully underprepared for the task.

The integration, which took weeks to set up, ended up causing more problems than it solved. I spent countless hours debugging Alipay's API, only to realize that it was not capable of handling the transaction volumes and complexity required for my use case. Their API, while robust for its intended use, was an overkill for our tiny store and wasn't optimized for low-latency operations.

The Architecture Decision

After weeks of struggling with Alipay, I decided to abandon it and opt for a more straightforward solution. I looked into decentralized payment systems like Lightning Network and Chainlink. These networks allowed for peer-to-peer transactions without the need for intermediaries like PayPal or Stripe. I selected Chainlink, specifically its Chainlink Pay, for its ease of integration and robustness.

However, there was a catch: Chainlink Pay requires a custom implementation for non-standard use cases, like digital goods sales. I had to write custom smart contracts to manage the sales, which added complexity to our codebase. Despite this added complexity, I was willing to trade off some elegance for freedom from payment provider constraints.

What The Numbers Said After

After deploying Chainlink Pay, our store's performance saw a significant improvement. We noticed a 40% decrease in transaction latency, which was critical for our users who valued fast transactions. Our server-side utilization also dropped by 20%, which we attribute to the reduced overhead of Chainlink's decentralized architecture.

Here's a snippet from our profiler output:

$ cat /tmp/chainlink_pay_profile.txt
 # Name CPU CPU% Description
 1. main 9.52 13.5 Chainlink Pay transaction handler
 2. httpd 2.31 3.2 HTTP server handling requests
 3. smartc 1.21 1.7 Chainlink Pay smart contract execution
 4. disk 0.78 1.1 Reading/Writing transaction logs
Enter fullscreen mode Exit fullscreen mode

As for allocation counts, we noticed a 15% decrease in memory allocations after the switch. This reduction in allocations is mainly due to Chainlink's design, which aims to minimize data writes and optimize for low-latency operations.

What I Would Do Differently

Looking back, I would have explored decentralized payment systems earlier in the development process. While Chainlink Pay required a custom implementation, its decentralized architecture has been a game-changer for our restricted-country users. If I had to do it over again, I would spend more time researching alternative solutions and evaluating their trade-offs before committing to a particular payment provider.

Top comments (0)