Welcome! Let’s take a brief look at the payment methods as of Event Espresso 4.6.
In the Beginning…
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.
Fast Forward to Event Espresso 4.6
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.
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.
How Does the New Payment Method System Work?
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:
- ONSITE (where the customer enters their billing info directly on your site, and your site transfers billing data to the payment gateway directly),
- OFFSITE ( where the customer is redirected to the payment gateway, enters their billing info, and then returns to your site afterwards), and
- OFFLINE (where payment is marked to occur offline without a separate payment gateway).
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:
- Selling & Supporting Your Custom Gateway – The best option is to list the plugin for sale on your website, using a shopping cart system, such as Easy Digital Downloads or eJunkie. Once the plugin is available on your website, please let us know so we can list it for you.
- Release for Free With Limited Support – There are a few possible options. The easiest is to just release the plugin on Github. If you want other Event Espresso and WordPress users to find it easier, you can post it on WordPress.org plugin repository. Once you’ve uploaded it to one, or both of these locations, please let us know so we can list it on our website for you.
- Keep it to Yourself – This is by far the easiest option, but no one else benefits from your hardwork 🙁
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.