If you’ve ever tried to integrate a payment gateway with an online shop you know how hard it is. Things get worse when you need several payment providers to be integrated. From my experience it takes from one week to a month to integrate a payment gateway and fix the associated bugs.
Also, we have to do the same thing from project to project. It is not efficient. Even more, developers do not work with payments all the time, so they may not have enough knowledge in this area. They will learn on the job and hence will spend more time on it. You can imagine how much time it takes.
In general, all the payments do the same thing. They just transfer money from point A to point B or the other way around. In real life, gateways do this differently. For example:
These are just a few examples, but actually there are many more gateways. They act differently, have unique protocols, api endpoints, transport formats and so on. Apart from gateways you have to think about your application. Is your application secure enough? Do you audit changes in database, http requests coming to you? Do you store information that you may need in future? It sounds like a hell if you ever decide to work out this stuff.
If you do not fall in love with microservices. I suggest doing so.
I realized sometime ago ago there was a solution. What if we could create a service that stands between our application and a wild world (all those fancy payment gateways)? That means we will have a full control over the service and be able to configure it, tweak its code. What is the most important, We can control database to which the service is connected. The service will provide us with a REST API and backend UI. It will be easy to set up, Indeed it’ll take a minute to get it up and run. Sounds good, doesn’t it?
It would be also nice if the service is invisible for the end user. Everything happens on your application’s page. If a gateway needs a credit card it is shown at the page. If a gateway needs a redirect, it does this but returns a user onto your site’s page.
Too good to be true? Not really. There is a solution. PayumServer. It is a proof of concept. By the way it already covers some payment gateways. Paypal Express Checkout, Stripe.js Stripe Checkout. Be2Bill, Klarna Checkout, Authorize.NET just to name a few.
Do you want to see it in action? Here’s the demo:
- Demo application: https://server.payum.forma-pro.com/demo.html
- Backend UI: https://server-ui.payum.forma-pro.com
- Payum server: https://server.payum.forma-pro.com
I have spent a lot of time integrating payment gateways into various projects and I see that it is time to use microservices. Let’s keep up with the times and spend our time more efficiently!
In the next article I’ll show how to setup the server in a blink of an eye