2 min. read
Categories: Technical
New Docs: Adding a payment gateway in Sylius

Adding a new payment gateway is one of the most common tasks when working with an eCommerce platform like Sylius. While our ecosystem already provides many payment integrations, including some of the most popular like PayPal and Stripe, there is plenty of local or niche gateways that need to be integrated. 

In order to make your life easier as a Sylius Developer, we have prepared a new Cookbook article: “How to integrate a Payment Gateway as a Plugin?” Kudos to our excellent Core Team Member Łukasz Chruściel, who prepared the new documentation. But let’s start with the basics.

Payments Architecture in Sylius

Sylius contains a component called “Payments”, which handles the data storage (like the history of payments, their statuses, amounts, etc.) and contains a thin layer for integrating the gateways.

The heavy lifting is currently done by Payum library, built by our friend Max Kotliar. Payum is PHP 7+ payment processing library. It offers everything you need to work with payments: Credit card & offsite purchasing, subscriptions, payouts, etc. It already provides a vast number of adapters that need a bit of glue to work with Sylius.

Plugin Development

Sometimes there is no ready adapter or you need to integrate one with Sylius. The best way to do this is to create a plugin. We provide a fantastic “PluginSkeleton” that you can just start from:

$ composer create-project sylius/plugin-skeleton SyliusMyGatewayPlugin

This command will create the whole boilerplate code that is the base of a plugin. From then you can start adding the code of the gateway. Did I mention that the skeleton includes the testing framework that allows you to run tests from inside of the plugin? No need to set up a separate “fake” project to do the testing. Thanks, Symfony!

If you are looking to build a plugin other than payment gateway, make sure to check out our Plugin Development Guide.

How to start?

Before you create your own payment plugin, please review the following lists and possibly re-use and improve an existing one. Zero waste!

In case you did not find a plugin you are looking for, then follow this cookbook.

Once you start working with it, make sure to let us know if you find it useful. All kind of feedback is much appreciated, including GitHub Pull Requests that could directly improve this documentation.

Want to learn more?

If you need professional guidance to better understand payment processing in Sylius, have a look at our online course program overview. Within 8 hours of specially designed video lessons, you will learn everything you need to know to start your first project or structure the experience you already have.

Take advantage of the maximum 40% PRE-SALE discount and buy your ticket until August 31!


Paweł Jędrzejewski
Self-taught developer and entrepreneur, who has built an entire career and business through Open Source technology. Speaker at international conferences. PHPers meetups co-organizer. Keen on helping other young entrepreneurs and companies who may want to follow a similar path.
More from our blog
Business News Technical 2 min read 28.09.2020
Get ready for global sales & operations with the most advanced payment solution from the famous fintech giant, now available in Sylius out of the box. Read More
Business News 2 min read 14.09.2020
We proudly present to you the latest version of the Sylius eCommerce Platform – 1.8, which comes with a brand new, unified API powered by API Platform, Loyalty points system for Sylius Plus, and as you can probably see, a brand new sylius.com website! Numbers This new release is a… Read More
Business Ecosystem News 2 min read 13.08.2020
Read why the French market leader trusted Sylius in a strategic re-platforming process to get a competitive eCommerce advantage. Read More