Creating a Payment Gateway

Our new 3.0 Payment Gateway API has been a part of WP eCommerce since 3.9.0, and we've continued to iterate on it over the last several releases. It is now a mature, highly functional API. It replaces our deprecated 2.0 API, which was in use from the mid-2000s until the 3.8.9 release.

We're going to show you best practices for creating a payment gateway plugin with this new API, as well as what each method in the base class does, and how you can add special support for different functionality in your gateway plugin. As the API continues to mature, we'll update this documentation with the latest and greatest that your payment gateway can get for free from this awesome API.

Rather than tell you how to create your own payment gateway - why don't we show you?

We're going to make a simple assumption that you're already comfortable making plugins. Below are two files that you'd be likely to place in your plugin. First, the plugin file, then the gateway file.

Payment Gateway Plugin: Main File.

The plugin file is fairly straight-forward. While it's overly simplistic, it's helpful to understand the right functions to use to register a payment gateway, the right hooks to hook into, etc. It would also be the ideal place to do something like a PHP version check if you depend on an SDK that uses namespaces, for example, and would need to require PHP 5.3+.