Overview of Using the MemberPress Developer Tools Addon

This add-on is only included with your purchase of the MemberPress Plus and Pro Editions.

If you're not a developer, you might find our Zapier integration or the Uncanny Automator easier to use.

Our MemberPress Developer Tools Add-on extends MemberPress to include a full REST API and full Webhook event capability.

If the documentation on this page seems light for developer tools that's because all of the documentation for the webhook events and REST API urls can be found in the plugin's interface. It will actually give you dynamic results to work from and an ability to test webhooks directly from your site.

Getting Started couldn't be easier ... here's how:

  1. Ensure your MemberPress activation key is for a MemberPress Developer Edition License.
  2. Install the MemberPress Developer Tools Add-on by going to "MemberPress" -> "Activate" -> "Add-ons" and clicking on the "Install" button next to the add-on.

  3. If you want to use MemberPress' REST API then you'll need to run WordPress 4.7+ or you'll need to install the WP REST API plugin (Version 2).
  4. Once the Developer Tools add-on is installed and activated you should see a new menu item on your MemberPress menu:

  5. From the Developer Menu you'll now be able to setup Webhooks, view dynamic documentation on and test Webhook Events and view dynamic documentation on all of MemberPress's REST API urls:

Sample PHP cURL Code

This example adds a Member, plus assigns them to a Membership (via a transaction), and also triggers a welcome email in the process:

$url = 'http://testsite.w6.wpsandbox.pro/wp-json/mp/v1/members';

$ch = curl_init($url);

$data_string = json_encode(
    'email'               => '[email protected]',
    'username'            => '[email protected]',
    'first_name'          => 'test',
    'last_name'           => 'test_last_name',
    'send_welcome_email'  => true, // Trigger a welcome email - this only works if adding a transaction (below)
    'transaction'         => [
      'membership'  => 376, // ID of the Membership
      'amount'      => '0.00',
      'total'       => '0.00',
      'tax_amount'  => '0.00',
      'tax_rate'    => '0.000',
      'trans_num'   => 'mp-txn-' . uniqid(),
      'status'      => 'complete',
      'gateway'     => 'free',
      'created_at'  => gmdate( 'c' ),
      'expires_at'  => '0000-00-00 00:00:00'

curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch, CURLOPT_CUSTOMREQUEST, "POST" );
curl_setopt( $ch, CURLOPT_POSTFIELDS, $data_string );

$header = array();
$header[] = 'MEMBERPRESS-API-KEY: MgCUGSO5Qg'; // Your API KEY from MemberPress Developer Tools Here
$header[] = 'Content-Type: application/json';
$header[] = 'Content-Length: ' . strlen($data_string);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);

$response = curl_exec($ch);

  throw new Exception(curl_error($ch));

echo $response;


Troubleshooting Basic Authentication

The Authentication piece is handled solely by the WP API. Although MemberPress has nothing to do with this part, we've seen some issues along the way the we'll cover here.

The preferred method for authentication is via the use of the oauth plugin. And we definitely recommend reading through this WP API Authentication documentation.

We've also found that many of you also use the less secure - Basic Authentication method - to connect to the WP-API. However, this presents a few challenges which hopefully the links below can assist you with.

If you're struggling to get Basic Authentication to work, be sure you've installed this plugin and followed instructions for it near the bottom of this post.

If you're still unable to authenticate, then your hosting server may have some configuration issues, and could require the following line in the .htaccess file. Read more about this issue here.

SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1

If all else fails, you might find it best to just use the API Key in the  MEMBERPRESS-API-KEY HTTP request header instead. Below is some sample code with the API Key and PHP cURL:

$url = 'http://testsite.com/wp-json/mp/v1/me';
$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$headers = [ 'MEMBERPRESS-API-KEY: MdCUPSO5Qr', 'Content-Type: application/json' ];
curl_setopt( $ch, CURLOPT_HTTPHEADER, $headers );
$response = curl_exec( $ch );
if( curl_errno( $ch ) ) { throw new Exception( curl_error( $ch ) ); }
echo $response;

Troubleshooting Webhooks

If your test webhooks are working, but your live tests are not firing. Then most likely WP Cron is disabled, or is not working as it should. MemberPress Developer Tools rely on WP Cron to send out the webhooks.

When possible, we'd recommend disabling WP Cron, and instead triggering it from a server-side cron that runs every minute. HostGator has a great article on doing this here. - and WordPress.org has some additional information here.

If you're unable to get WP Cron firing correctly, you may (as a last resort) need to issue the following query:

UPDATE wp_options SET option_value = '' WHERE option_name = 'cron';