API Archives - WordPress Membership Plugin - Membership Sites https://wishlistmember.com Quickly Protect Your Content With WishList Member Wed, 02 Aug 2023 19:09:36 +0000 en-US hourly 1 https://wordpress.org/?v=6.4.2 https://wishlistmember.com/wp-content/uploads/2020/03/cropped-WishList-Member-logomark-32x32.png API Archives - WordPress Membership Plugin - Membership Sites https://wishlistmember.com 32 32 API URL – WishList Member API Data Not Being Received https://wishlistmember.com/docs/api-url-api-data-not-being-received/ Thu, 27 Jul 2023 15:22:23 +0000 https://wishlistmember.com/?post_type=ht_kb&p=19153 WishList Member includes an API and a selection of the included integration options create a connection using that API. The API can also be used to create further customization for your membership site. You will find the API information used to connect to WishList Member in the Advanced Options > API section. This includes the […]

The post API URL – WishList Member API Data Not Being Received appeared first on WordPress Membership Plugin - Membership Sites.]]>
API URL

WishList Member includes an API and a selection of the included integration options create a connection using that API. The API can also be used to create further customization for your membership site.

You will find the API information used to connect to WishList Member in the Advanced Options > API section.

This includes the API URL.

WishList Member API

A selection of integrations with WishList Member also require the API URL field and those can be accessed in the Setup > Integrations > Payment Providers section of WishList Member. Examples include ThriveCart and Digistore24.

If you run into issues like member accounts aren't being created or memberships aren't being cancelled in WishList Member when payments fail at the payment provider, this could be related to the API URL format.

These types of issue are related to some servers that can include a firewall/security feature such as a captcha. This can prevent the data sent to the API URL ending in /wp-admin to be processed. There are also WordPress plugins that can rename the /wp-admin portion of the API URL for security purposes which can potentially cause issues if the data is being sent to /wp-admin.

In these types of cases, you can use one of the two available API URLs to resolve the issue.

The first API option to use is your site URL including /wp-admin on the end.

Example: https://wlmtest.com/wp-admin

If you encounter issues like the ones mentioned above, you can remove /wp-admin from the end of the API URL.

Example: https://wlmtest.com

You can first try the API URL including /wp-admin at the end and if you experience an issue, you can use the API URL without /wp-admin at the end instead.

The post API URL – WishList Member API Data Not Being Received appeared first on WordPress Membership Plugin - Membership Sites.]]>
WebHooks Integration with WishList Member https://wishlistmember.com/docs/webhooks/ Thu, 07 Jul 2022 14:59:19 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=2348 The Webhooks Integration with WishList Member allows WishList Member to send (outgoing) data when certain events occur in WishList Member and trigger actions when data is received (incoming) from external sources. Table of Contents Enabling WebHooks Integration with WishList Member Integration Go to the Setup > Integrations > Other Services > section in WishList Member […]

The post WebHooks Integration with WishList Member appeared first on WordPress Membership Plugin - Membership Sites.]]>
The Webhooks Integration with WishList Member allows WishList Member to send (outgoing) data when certain events occur in WishList Member and trigger actions when data is received (incoming) from external sources.

Table of Contents

Enabling WebHooks Integration with WishList Member Integration

Go to the Setup > Integrations > Other Services > section in WishList Member and select WebHooks.

Enable the WebHooks integration by turning the toggle switch on.

Incoming WebHooks

Incoming WebHooks can be configured under the “Incoming” tab.

It allows external applications to add, remove, cancel and uncancel a user to/from membership levels and pay per posts in WishList Member via HTTP Posts sent to the URLs provided by WishList Member.

Furthermore, user account will be created if it doesn't exist yet.

Creating Incoming WebHooks

  1. Click the “Link New WebHook” button.
  2. Enter a name for your WebHook in the Name filed under the “Settings” tab.
Webhooks Integration with WishList Member
  1. Configure the WebHook under the “Actions” tab. See Actions for more info.
Webhooks Integration with WishList Member
  1. You may also configure the “field names” under the “Data Mapping” tab if the fields do not match WishList Member's default field names. See Data Mapping for more info.
Webhooks Integration with WishList Member
  1. Click “Save” or “Save & Close”.
  2. You may now use the auto-generated URL for your incoming webhook to trigger actions in WishList Member.

See Sample cURL Request for a technical example.

Actions

Incoming WebHooks allows you to trigger 4 actions in WishList Member.

  1. Add To
  2. Remove From
  3. Cancel From
  4. Uncancel From

Add To

This action adds a user to:

  • Membership Levels
  • Pay Per Posts

Remove From

This action removes a user from:

  • Membership Levels
  • Pay Per Posts

Cancel From

This action cancels a user from:

  • Membership Levels

Uncancel From

This action uncancels a user from:

  • Membership Levels

Data Fields

By default WishList Member's WebHooks integration accepts the following data fields:

Required Field:

  • email – Email address.

Optional Fields:

  • username – User's username. Will be auto-created based on the configured “Username Format” if not specified.
  • password – User's password. Will auto-generated if not specified.
  • firstname – User's first name.
  • lastname – User's last name.

Data Mapping

Should your application send data fields with different names, you may choose to map them under the “Data Mapping” tab.

Sample cURL Request

Request:

curl -X POST -d "email=e@ma.il&firstname=John&lastname=Doe" {incoming-webhook-url}

Response:

{
    "success": 1,
    "code": 1
}

Outgoing WebHooks

Outgoing WebHooks can be configured under the “Outgoing” tab.

This allows the Webhooks Integration with WishList Member to send data to URLs your provided when a user is added, removed, cancelled, uncancelled, expired, unexpired to/from membership levels and pay per posts.

Configuring Outgoing WebHooks

  1. Choose a Membership Level or Pay Per Post to configure.
  2. This will open a popup with 6 tabs, each representing an event.
  3. Choose the event that you wish to monitor and enter the URL or URLs (one URL per line) that you want the outgoing webhook data to be sent to.
  1. Click “Save” or “Save & Close”.

Events

Outgoing WebHooks allows you to monitor 6 events in WishList Member.

  1. When Added
  2. When Removed
  3. When Cancelled
  4. When Uncancelled
  5. When Expired
  6. When Unexpired

When Added

This event is fired when a user is added to:

  • Membership Levels
  • Pay Per Posts

When Removed

This event is fired when a user is removed from:

  • Membership Levels
  • Pay Per Posts

When Cancelled

This event is fired when a user is cancelled from:

  • Membership Levels

When Uncancelled

This event is fired when a user is uncancelled from:

  • Membership Levels

When Expired

This event is fired when a user is expired from:

  • Membership Levels

When Unexpired

This event is fired when a user is unexpired from:

  • Membership Levels

Outgoing WebHook Data

The following data are sent to the Outgoing WebHook URL(s)

  • trigger (string) Triggered event. Can be one of “add”, “remove”, “cancel”, “uncancel”, “expire”, “unexpire”
  • trigger_levels (array) Array of Level and Pay Per Post IDs that triggered the event.
  • id (integer) User ID
  • email (string) User Email
  • login (string) User Login (aka Username)
  • firstname (string) First Name
  • lastname (string) Last Name
  • nicename (string) Nice Name
  • display_name (string) Display Name
  • levels (array) Array of membership level objects assigned to the user keyed by the membership level ID.
  • pay_per_posts (array) Post IDs of the Pay Per Posts that the user has access to grouped by post type.

Sample Data:

{
  "trigger": "add",
  "trigger_levels": [
    "payperpost-1"
  ],
  "id": "1234",
  "email": "e@ma.il",
  "login": "e@ma.il",
  "firstname": "John",
  "lastname": "Doe",
  "nicename": "ema-il",
  "display_name": "John Doe",
  "levels": {
    "1650533556": {
      "Level_ID": "1650533556",
      "Name": "Alpha",
      "Timestamp": "1657204233",
      "Cancelled": 0,
      "CancelDate": 0,
      "CancelDateReason": "",
      "CancelledDate": 0,
      "Pending": 0,
      "UnConfirmed": 0,
      "Expired": 0,
      "ExpiryDate": 0,
      "SequentialCancelled": 0,
      "Scheduled": 0,
      "ParentLevel": 0,
      "Active": 1,
      "Status": [
          "Active"
      ],
      "TxnID": "WL-56-1650533556"
    },
  },
  "pay_per_posts": {
    "page": [
      2
    ],
    "post": [
      1
    ]
  }
}

Custom Registration Fields

Custom registration fields have been included in the data sent by Outgoing WebHooks since WishList Member v3.22.6.

Custom fields are automatically prepended with “custom_” so if you created a custom registration form with a custom registration field named “motto” then the Outgoing WebHook will send it as “custom_motto“.

Sample Data with custom fields:

{
  "trigger": "add",
  "trigger_levels": [
    "payperpost-1"
  ],
  "id": "1234",
  "email": "e@ma.il",
  "login": "e@ma.il",
  "firstname": "John",
  "lastname": "Doe",
  "nicename": "ema-il",
  "display_name": "John Doe",
  "custom_motto": "I believe I can fly",
  "custom_tshirt_size": "Large",
  "levels": {
    "1650533556": {
      "Level_ID": "1650533556",
      "Name": "Alpha",
      "Timestamp": "1657204233",
      "Cancelled": 0,
      "CancelDate": 0,
      "CancelDateReason": "",
      "CancelledDate": 0,
      "Pending": 0,
      "UnConfirmed": 0,
      "Expired": 0,
      "ExpiryDate": 0,
      "SequentialCancelled": 0,
      "Scheduled": 0,
      "ParentLevel": 0,
      "Active": 1,
      "Status": [
          "Active"
      ],
      "TxnID": "WL-56-1650533556"
    },
  },
  "pay_per_posts": {
    "page": [
      2
    ],
    "post": [
      1
    ]
  }
}

Please feel free to reach out to our support team if you have any questions.

The post WebHooks Integration with WishList Member appeared first on WordPress Membership Plugin - Membership Sites.]]>
Digest Auth Username and API Key / Digest Auth Password https://wishlistmember.com/docs/digest-auth-username-and-api-key-digest-auth-password/ Mon, 06 Jun 2022 18:55:53 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=2011 What is a Digest Auth Username? How about a Digest Auth Password? WishList Member includes an API and the authentication method has typically been through an API URL and API Key. But another method is also available. That is where a Digest Auth Username and Digest Auth Password come in. — The API URL and […]

The post Digest Auth Username and API Key / Digest Auth Password appeared first on WordPress Membership Plugin - Membership Sites.]]>
Digest Auth Username and Digest Auth Password - WishList Member

What is a Digest Auth Username? How about a Digest Auth Password? WishList Member includes an API and the authentication method has typically been through an API URL and API Key. But another method is also available. That is where a Digest Auth Username and Digest Auth Password come in.

The API URL and API Key option works with the older authentication method. The Digest Auth Username and Digest Auth Password option works with both the older method (using just the API Key) and also works with the more standard HTTP Digest Authentication by using the Digest Auth Username and the Digest Auth Password.

This can be found in the Advanced Options > API section of WishList Member.

WishList Member API

API URL: The API URL option cannot be edited but is required for developers to access the WishList Member API when using the API Key method.

Digest Auth Username: The Digest Auth Username option cannot be edited but is required for developers to access the WishList Member API when using the Digest Auth method.

API Key / Digest Auth Password: This key/password is used by developers to access the WishList Member API. It is also used by certain WishList Member integrations. Any integrations that use the API Key/Digest Auth Password would need to be updated and reconnected if this key/password is modified.

You can find more in depth information on the WishList Member API right here.

Note: Some of the payment provider integrations that use the WishList Member API (JVZoo, etc.) can use the Digest Auth options.

The post Digest Auth Username and API Key / Digest Auth Password appeared first on WordPress Membership Plugin - Membership Sites.]]>
Checking For Supported Verbs https://wishlistmember.com/docs/checking-for-supported-verbs/ Wed, 11 Jul 2018 15:11:48 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=316 Each request to an API Resource except for the /resources and /auth resources will also return a list of supported verbs. This information is returned in the supported_verbs array. This is helpful if you want to make a quick check on what kind of actions you can do with a resource. <?php $response = $api->get('/levels'); […]

The post Checking For Supported Verbs appeared first on WordPress Membership Plugin - Membership Sites.]]>
Each request to an API Resource except for the /resources and /auth resources will also return a list of supported verbs. This information is returned in the supported_verbs array. This is helpful if you want to make a quick check on what kind of actions you can do with a resource.

<?php
$response = $api->get('/levels');
$response = unserialize($response);
print_r($response['supported_verbs']);
?>

TIP: You can also just call /resources and get a full list of available resources and their supported verbs.

The post Checking For Supported Verbs appeared first on WordPress Membership Plugin - Membership Sites.]]>
Checking For a Successful Request https://wishlistmember.com/docs/checking-for-a-successful-request/ Wed, 11 Jul 2018 15:10:58 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=315 An API request can either by successful or not. The best way to explain how to check for this is through code so let's go through it. <?php $response = $api->get('/levels'); $response = unserialize($response); if($response['success']==1){ echo 'Request successful'; // do stuff here } else { echo 'Request failed'; echo '<br />'; echo 'Error Code:' . […]

The post Checking For a Successful Request appeared first on WordPress Membership Plugin - Membership Sites.]]>
An API request can either by successful or not. The best way to explain how to check for this is through code so let's go through it.

<?php
$response = $api->get('/levels');
$response = unserialize($response);
if($response['success']==1){
echo 'Request successful';
// do stuff here
} else {
echo 'Request failed';
echo '<br />';
echo 'Error Code:' . $response['ERROR_CODE'];
echo '<br />';
echo 'Error Description:' . $response['ERROR'];
}
?>
The post Checking For a Successful Request appeared first on WordPress Membership Plugin - Membership Sites.]]>
DELETE: Deleting Data https://wishlistmember.com/docs/delete-deleting-data/ Wed, 11 Jul 2018 15:10:13 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=314 The DELETE method will let you delete specific resources such as members, membership levels, etc. Note that this action cannot be reversed so use it with care. Syntax $response = $api->delete($resource); Where: $resource – an API resource (i.e. /levels) Returns: $response – string: can be either serialized PHP data, JSON or XML Example To delete […]

The post DELETE: Deleting Data appeared first on WordPress Membership Plugin - Membership Sites.]]>
The DELETE method will let you delete specific resources such as members, membership levels, etc. Note that this action cannot be reversed so use it with care.

Syntax

$response = $api->delete($resource);

Where:

  • $resource – an API resource (i.e. /levels)

Returns:

$response – string: can be either serialized PHP data, JSON or XML

Example

To delete a membership level

<?php
$level_id = 1234567890;
$response = $api->delete('/levels/'.$level_id);
?>
The post DELETE: Deleting Data appeared first on WordPress Membership Plugin - Membership Sites.]]>
PUT: Updating Data https://wishlistmember.com/docs/put-updating-data/ Wed, 11 Jul 2018 15:08:10 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=313 The PUT method allows you to update the data in resources that support it. Syntax $response = $api->put($resource , $data); Where: $resource – an API resource (i.e. /levels) $data – an associative array of data to pass to the API Returns: $response – string: can be either serialized PHP data, JSON or XML Example To […]

The post PUT: Updating Data appeared first on WordPress Membership Plugin - Membership Sites.]]>
The PUT method allows you to update the data in resources that support it.

Syntax

$response = $api->put($resource , $data);

Where:

  • $resource – an API resource (i.e. /levels)
  • $data – an associative array of data to pass to the API

Returns:

$response – string: can be either serialized PHP data, JSON or XML

Example

To change the name of a membership level

<?php
$level_id = 1234567890;
$data = array('name' => 'New Level Name');
$response = $api->put('/levels/'.$level_id, $data);
?>
The post PUT: Updating Data appeared first on WordPress Membership Plugin - Membership Sites.]]>
GET: Retrieving Data https://wishlistmember.com/docs/get-retrieving-data/ Wed, 11 Jul 2018 15:05:09 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=312 The GET method is most probably going to be the most used method when using the API. It allows you to retrieve data specific to a resource. Syntax $response = $api->get($resource [, $data]); Where: $resource – an API resource (i.e. /levels) $data – (optional) an associative array of data to pass to the API Returns: […]

The post GET: Retrieving Data appeared first on WordPress Membership Plugin - Membership Sites.]]>
The GET method is most probably going to be the most used method when using the API. It allows you to retrieve data specific to a resource.

Syntax

$response = $api->get($resource [, $data]);

Where:

  • $resource – an API resource (i.e. /levels)
  • $data – (optional) an associative array of data to pass to the API

Returns:

$response – string: can be either serialized PHP data, JSON or XML

Example

To retrieve a list of all membership levels

<?php
$response = $api->get('/levels');
// we unserialize the response because we're using PHP as return format
$response = unserialize($response);
// dump the response to output
print_r($response);
?>

To retrieve details of a particular membership level

<?php
$level_id = 1234567890;
$response = $api->get('/levels/'.$level_id);
// we unserialize the response because we're using PHP as return format
$response = unserialize($response);
// dump the response to output
print_r($response);
?>
The post GET: Retrieving Data appeared first on WordPress Membership Plugin - Membership Sites.]]>
POST: Creating New Data https://wishlistmember.com/docs/post-creating-new-data/ Wed, 11 Jul 2018 15:01:03 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=311 Where possible, WishList Member allows you to create new data through the API by making a HTTP POST request to a specific resource. Syntax $response = $api->post($resource , $data); Where: $resource – an API resource (i.e. /levels) $data – an associative array of data to pass to the API Returns: $response – string: can be […]

The post POST: Creating New Data appeared first on WordPress Membership Plugin - Membership Sites.]]>
POST: Creating New Data - WishList Member API

Where possible, WishList Member allows you to create new data through the API by making a HTTP POST request to a specific resource.

Syntax

$response = $api->post($resource , $data);

Where:

  • $resource – an API resource (i.e. /levels)
  • $data – an associative array of data to pass to the API

Returns:

$response – string: can be either serialized PHP data, JSON or XML

Example

To create a new Membership Level using the API.

<?php
$data = array('name' => 'Silver Level');
$response = $api->post('/levels', $data);
?>

Get more details are available on the WishList Member API.

The post POST: Creating New Data appeared first on WordPress Membership Plugin - Membership Sites.]]>
wlmapiclass.php https://wishlistmember.com/docs/wlmapiclass-php/ Fri, 29 Jun 2018 15:05:38 +0000 https://wishlistmember.com/docs/?post_type=ht_kb&p=310 Using wlmapiclass.php To make things easier for third-party developers, we developed a PHP class to handle most of the hard stuff in using the API. This class makes use of the cURL library to handle HTTP communication with the WishList Member API as well as all authentication requirements. You can download the API Class for […]

The post wlmapiclass.php appeared first on WordPress Membership Plugin - Membership Sites.]]>
Using wlmapiclass.php

To make things easier for third-party developers, we developed a PHP class to handle most of the hard stuff in using the API. This class makes use of the cURL library to handle HTTP communication with the WishList Member API as well as all authentication requirements.

You can download the API Class for free Right Here.

To use the API class, you will need to put the following code at the top of your application

<?php
include('wlmapiclass.php');
$api = new wlmapiclass('http://yourblog.com/', 'yourAPIKey');
$api->return_format = 'php'; // <- value can also be xml or json
?>

Replace:

http://yourblog.com/ with the full URL of your WordPress installation.
yourAPIKey with the WishList Member API key found under the settings tab

Yup, that easy. Initializing the class handles all authentication requirements between your application and the WishList Member API.

It's best to put those 3 lines of code in a separate config file and include it on top of your application.

Support for Other Programming Languages

WishList Member only provides a PHP version of wlmapiclass at the moment and will only support official versions of this class. You are however allowed and encouraged to translate the class to any language of your choice if you need to.

API Class Methods

The WishList Member API makes use of the Create, Retrieve, Update and Delete (CRUD) model in managing data. To complement this, the API Class has four (4) methods that you can use to communicate with the WishList Member API. Each method represents one of the four (4) HTTP verbs that the API supports, namely:

API MethodHTTP VerbAction
$api->postPOSTCreate
$api->getGETRead
$api->putPUTUpdate
$api->deleteDELETEDelete

With this four methods/verbs, it is possible to manipulate all data that is exposed by WishList Member through its API. You can learn more about the class methods here.

The post wlmapiclass.php appeared first on WordPress Membership Plugin - Membership Sites.]]>