Update (6/5/2015): We’ve published a documentation page for adding a new gateway option. See: Adding a New Gateway

One of our goals for PMPro v1.8 is to be able to add new payment gateways to PMPro without having to edit any core PMPro files. To this end, we’ve added a ton of new hooks to the payment settings admin page, the checkout page, and checkout preheader code.Banner for General About Paid Memberships Pro Guide

We’ve overhauled the existing gateways to use the new methods and hooks so that nearly all of the custom code for each gateway is now contained with the gateway classes.

If you are developing a new gateway, you will want to grab the latest version of v2.0 from GitHub upgrade to the latest version of Paid Memberships Pro in the WordPress repository and then develop your gateway on top of that version. We will have more thorough documentation when we can, but the basics of adding a gateway now are:

1. Create a custom plugin to house your gateway code.

2. Create a class for your gateway PMProGateway_gatewayname that extends the PMProGateway class. (The Stripe gateway class is a good one to use for reference.)

3. Override the class methods to use your gateway specific APIs.
Because this is all still in development, there may be bugs with this gateway code or other parts of PMPro. And there are likely to be updates to the PMPro plugin that might affect your custom gateway. Stay tuned to the blog here. At some point, we will announce an official “beta” period for v2.0 where we will be adding no new features and only fixing bugs with it.

Here are some of the new and old hooks and filters that you should consider using to integrate your gateway into the front and backend of PMPro.

  • pmpro_gateways – Filter to add your gateway to the list of gateway options.
  • getGatewayOptions – Which option names/keys, including new ones you are adding, should be loaded on the payment settings page.
  • pmpro_payment_options – Save new options you add to the payment settings page.
  • pmpro_payment_option_fields – Code to add fields to the payment options page.
  • pmpro_checkout_preheader – Run code within preheaders/checkout.php.
  • pmpro_checkout_order – Filter the order object to adjust or add properties to it before sending it to the process method of your gateway class.
  • pmpro_include_billing_address_fields – Set to __return_false to not include billing address fields at checkout. Can also use the filter to swap in your own version of the billing address code.
  • pmpro_show_billing_address_fields – Set to __return_false to include the HTML for the billing address fields but use CSS to hide it from display.
  • pmpro_include_payment_information_fields – Set to __return_false to not include payment information fields at checkout. Can also use the filter to swap in your own version of the payment info code.
  • pmpro_show_payment_information_fields – Set to __return_false to include the HTML for the payment information fields but use CSS to hide it from display.
  • pmpro_required_billing_fields – Filter which fields are required at checkout.
  • pmpro_registration_checks – Use this to check extra fields added to the checkout.
  • pmpro_checkout_before_processing – Called just before calling the process method of the gateway.
  • pmpro_checkout_confirmed – Used by the PayPal Express gateway to handle it’s own token/review/confirm process.
  • pmpro_checkout_before_change_membership_level – Called just before changing the user’s membership level during checkout.
  • pmpro_after_checkout – Do stuff after checkout is processed.

Again, v2.0 is still in very active development. These hooks may change and are not documented well yet if at all.

These updates are live as of version 1.8. If you have any questions or notice any bugs, please post to our member forums or open an issue at GitHub. Thanks!

Was this article helpful?