v1.8+ allows you to add new payment gateways to PMPro without having to edit any core PMPro files. If you are developing a new gateway, you will want to upgrade to the latest version of Paid Memberships Pro in the WordPress repository and then develop your gateway on top of that version.

If there is a payment gateway that is not currently offered in the core Paid Memberships Pro plugin, see below for the steps needed to create a new plugin.

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

You can use the gateway plugin linked to below as a starting point for your new gateway development. Not all hooks and functions will be needed for your gateway class, it just depends on the gateway you are integrating and how that integration works.

Download Example Gateway

2. Create a class for your gateway PMProGateway_gatewayname that extends the PMProGateway class.

See the example gateway class addon or the gateway classes included in Paid Memberships Pro for reference.

3. Override the class methods to use your gateway specific APIs.

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.