Using Golang to create
faster e-commerce checkouts

If your e-commerce site uses a payment gateway to process transactions, then it’s likely that you know that at times they are slow to respond. Sometimes, perhaps, they might even time out during a transaction. This kind of problem is clearly going to act as a barrier to sales, just as a poorly performing website will.

Payment gateways tend to carry out a lot of parallel transactions and requests at the same time, once the customer hits the payment button. For example, the gateway may have to score the customer, check their identity, retrieve a previous transaction history, convert currencies and much more.

What is a Payment Gateway?

A payment gateway is used by e-commerce merchants that require online payment. It’s used to authorize credit and debit cards.

Payment gateways are operated by so called Payment Solution Providers and use encryption to make sure that credit and debit card details are protected when in transit online. This allows the payment gateway provider and the merchant to ensure that information is secure and compliant with PCI DSS (Payment Card Industry Data Security Standard).

In e-commerce, when a customer makes a purchase on a merchant’s website, typically the website will create a secure checkout where it will use SSL (Secure Socket Layer) to encrypt information that is entered by the customer. A payment gateway bypasses the merchant’s systems in order to reduce the compliance obligations of the merchant. Instead of the merchant processing credit card details, they are forwarded to the payment gateway where the payment is then sent to and processed by the acquiring bank.

The transaction is authorized by the credit card issuing bank and sent back to the payment gateway which in turn sends the authorization back to the merchant. Typically, the entire process takes around 2-3 seconds and the merchant then fulfills the order.

Dashboard graphs

Issues with Payment Gateways

As discussed previously, while payment gateways are a tried and trusted method for online transactions they can be slow or time out when lots of parallel transactions are necessary. This is a frustrating problem for merchants and customers, and often results in a proportion of lost sales.

So what can be done to improve a payment gateway performance?

Enter Golang.

Golang is an open source programming language developed by Google, which aims to make developers more productive. As a language, it’s similar to C and C++ but much more advanced in terms of performance and expression.

According to The New Stack:

“[Golang] focuses on real-world practices for building next-generation applications in the cloud as well as distributed and concurrent computing environments, and for system programming.”

So in a nutshell, Golang is designed to improve performance of software products, including payment gateways and is perfect for modern technologies such as the cloud. While Golang is a relatively new language, it’s already gained a reputation for being robust and fast. This means that for merchants, using a payment gateway that’s written in Golang reduces the number of canceled or timed out transactions as the gateway is able to process several transactions at the same time.

We at Upnext are working on a payment gateway written in Golang. A decision had to be made between Go and C, which both have asynchronous operation built into the language at a low level, making it easy for large groups of people to write asynchronous code. Go routines were much more lightweight than threads. And frankly we were most excited about writing Go code, so we chose Go.

The first performance results where stunning and we have to say we love Go. We’ve found it really fast to deploy, really easy to instrumentalize, really lightweight and inexpensive in terms of resources. It’s taken a while to get here, but the journey was more than worth it.

Go focuses on real-world practices for building next-generation applications in the cloud as well as distributed and concurrent computing environments.

Bottom line - we think that Go is a great opportunity when it comes to rewriting large legacy software architecture and we hope to see more clients leveraging this amazing technology.

The payment gateway we are working on is currently in PCI certification process. Once this process is completed, we will introduce you to the gateway’s capabilities and the performance of Go, which we think can become a milestone for a more performant and robust e-commerce industry.