Building an External Payment Gateway with the Twitter API

Core concepts

Add any payment gateway. Anywhere.

July 5, 2022 Seth Bindernagel

One of the most powerful and fundamental ways to grow a business is to expand into new markets. Becoming a multi-market commerce engine adds new dimensions to your business, but requires detailed planning and execution. Going international enables a company to offer SKUs local to that market, local prices, local promotions, local tax calculations, and local payment options. Localization is key, and at the top of the list is the ability to add any local payment gateways.

In this post, we will discuss why local payment gateways are a necessity as you scale internationally and how to add any payment gateway anywhere.

What are payment gateways and payment methods?

Let’s start by understanding what payment gateways are and why they are so important. Payment gateways are the technology that websites, apps, and other digital experiences use to allow money to flow between a customer and a business when a transaction takes place. Think of payment gateways as the technology that connects a website to the card readers you might use during checkout at a grocery store. When you swipe your credit card to pay for your groceries, a bunch of stuff happens to complete the transaction. Payment gateways do the same for websites when no physical credit card is present.

Specifically, they:

  • Connect a site to a payment processor (aka the "card reader at a grocery store")
  • Authenticate a user before the transaction amount is sent anywhere
  • Capture payment details
  • Route payment to the processor
  • Send approval back to a merchant

Payment gateways offer several additional services to merchant sites, including multiple payment methods, fraud protection, recurring billing, and payment analytics.

Payment methods are probably the most familiar concept to most readers. They are the methods by which a person can pay for some goods they want to purchase. These include credit cards, debit cards, cash, bank transfers, mobile payments, e-wallets, crypto, etc. Increasingly, customers expect to be able to pay with whatever method is most convenient to them, and that is why we are starting to see firms like Stripe offer crypto as a payment method for brands to offer their customers.

Why add local payment gateways?

Why is adding local payment options so important? In a 2022 study by the Baymard Institute regarding Reasons for Abandonments During Checkout, 18% of U.S. adults surveyed said they didn’t trust a site with their credit card information. 9% said that it was due to the lack of enough payment methods.

The Baymard summary concludes that if the industry looked at the «combined ecommerce sales of $738 billion in the U.S. and EU, the potential for a 35.26% increase in conversion rate translates to $260 billion worth of lost orders which are recoverable solely through a better checkout flow & design.»

Trusted, local, recognizable payment gateways offer consumers better checkout flows and confidence in the purchase process.

So, how hard is it to add a payment gateway with Commerce Layer? And what are the payment gateway options Commerce Layer offers, both out-of-the-box and custom? Let’s dive in.

Payment gateways out-of-the-box

Commerce Layer provides out-of-the-box server-side integrations with the most popular payment gateways: PayPal, Stripe, Adyen, Braintree, Checkout.com, and Klarna. All solutions are compliant with the PSD2 European regulation so that you can implement a payment flow that supports SCA and 3DS2. With these integrations, a website or app (or any digital experience) can get up and running and start taking payments with Commerce Layer. Using these integrations, you can offer your customers as many payment methods as the gateway supports.

The technology is pretty straightforward to understand. The payment method gets associated with the order that comes from the customer’s purchase, the market where the order takes place, and the payment gateway itself, like Stripe. As the Commerce Layer user, you choose your payment gateway and the payment methods offered by that gateway. It’s all very neatly illustrated in our data model diagram that shows these associations. Take a look at the specific docs that describe:

We’ve made a handy guide called Selecting a payment method that details this process.

But what happens if there is a local payment gateway that we don’t offer out-of-the-box? No problem. With our flexible API and custom lambda functions, you can pretty much turn anything into a payment gateway.

Add any payment gateway. Anywhere.

When we say that Commerce Layer can "make anything shoppable, anywhere", our vision is to empower developers to build the most relevant, local ecommerce experience for their customers. This vision extends directly to payment gateways.

Nothing should stop you from offering the most relevant local payment gateways, or even the most creative ways to pay for something.

The question becomes: what if your current digital interface needs to offer the most relevant, hyper-local payment gateways that your customers expect to use? Building a connection to an external payment gateway may make the most sense for your commerce experience. Further, integrating with a specific payment gateway technology gives your customers something they know and trust. At this point, you need to go beyond the out-of-the-box solutions mentioned above.

Commerce Layer makes adding any payment gateway a possibility. For example, if you choose to work with a local Buy Now Pay Later solution, you can use Commerce Layer to offer that as a payment gateway to your customers. Or, let’s say you want to get really creative and allow your customers to "pay" for their goods using a non-traditional platform as a payment gateway? As long as that platform has a public API that you can build upon, you can use Commerce Layer and lambda functions to create a very creative payment experience.

We encourage you to think about the possibilities that make the most sense for you, and then start building them. If you want to add any external payment gateway, our how-to guide is the best starting point for you to get the job done.

What Next?

In a follow-up article, we will present just how creative someone can get with our external payment gateway functionality. Using a lambda function, we will transform an incredibly recognizable global platform that has an open API into a payment gateway. How about paying with a Tweet? Stay tuned for the upcoming blog post to see how we can turn Twitter into a payment gateway.