EventEspresso.com just got a fresh makeover; enjoy the new brew! ☕️
Payment Methods in EE4 are now modular keeping code lightweight, and allowing more flexibility to add new features, without lots of bloat.
Posted by Seth Shoultes
Welcome! Let’s take a brief look at the payment methods as of Event Espresso 4.6.
In the old days of Event Espresso (EE3), all of the “payment gateways” (as we called them, then) were included in the core Event Espresso file system, which made the overall file size rather large and unwieldy over time. Some gateway folders ended up weighing in at around 2 – 3 megabytes each!
One of the many reasons we rebuilt Event Espresso 4 (EE4) from the ground up, was to make the gateway system more modular. So, in the beginning, we decided to build a simple payment gateway interface, that included only four of our most popular online payment gateways from EE3. This approach allowed us to ship a working product, or rather a Minimum Viable Product (MVP), while allowing our developers time to fine tune Event Espresso and rebuild the entire gateway system.
We’ve now finished the “Gateway Rewrite”, or GWRW as we called it, in Event Espresso 4.6 and things are looking pretty sweet for Event Espresso gateway developers. We are now taking the approach of renaming “payment gateways” to “payment methods” in Event Espresso 4.6.
Payment Methods are now modular, and can be developed as an Event Espresso add-on. This allows us to keep EE4 core code and files lightweight, while providing our developers, as well as any third-party developers more flexibility to add new features, without lots of bloat.
As of Event Espresso 4.6, developers are now invited to start developing new gateways, by following our in-depth payment method documentation.
Ok, so you’re ready to build your own payment method? Head over to the EE4 Payment Method Development page on our developer documentation website.
Don’t forget, in order to give you a head-start, our developer’s have created an Add-on Skeleton that has two working payment methods in it: one onsite and the other offsite. Of course neither actually communicates with a Payment Gateway, that’s what you’re going to do by following our gateway documentation!
The skeleton add-on is located in the event-espresso-core/tests/mocks/addons/new-payment-method. Currently the “tests” folder isn’t included by default in order to reduce plugin size, so you’ll need to get it from our github repo.
In Event Espresso 4.6+, payment methods are PHP classes and associated files that take care of accepting payments from customers. They define a form for its settings, possibly a form for billing information which can be displayed during Single Page Checkout, and possibly a gateway class which takes care of communicating with a payment gateway (eg Paypal.com) to actually transfer funds from the customer to you. They fall into 3 general categories:
Payment methods are more narrow in scope than EE Modules, and are generally placed in an EE4 Add-on. If you are building your own Payment Method as an add-on, please feel free to use our sample “New Payment Method” Add-on. For details, see the section “Using the New Payment Method Add-on Skeleton” section of our documentation.
So, you’ve created a new gateway, and now you want to release it to the Event Espresso 4 community? First you need to decide if you want to sell and support the gateway, release it for free with limited support, or just keep it to yourself. Here’s some helpful tips on where to go next:
We hope that our gateway documentation works as a helpful guide to incorporating your own payment methods in Event Espresso 4. If you have technical questions, please feel free to post in our support forums. Developers with access to Event Espresso on Github can post questions there.