REST API with WPLoyalty PRO Plugin

Learn how to use REST API to add or reduce points using the WPLoyalty PRO plugin.

The WPLoyalty REST API enables users to perform two actions:

  • add points

  • reduce points.

This document provides a guide on how to use the REST API to perform these actions using the WPLoyalty PRO plugin.

Please note that before proceeding, you must have installed and activated the WPLoyalty PRO plugin. It is important to note that this feature requires the PRO version.

Click here to purchase WPLoyalty PRO.

Let’s get started,

Step 1: Creating REST API credentials

  • Go to WordPress backend -> Woocommerce -> Settings -> Advanced.

  • Under REST API, click on the "add key" button.

Step 2: Generating API key:

  • Give a description and set the permission as Read/Write which can be set as Read/Write according to your specific needs.

  • Click on "Generate API key" to proceed.

Step 3: Getting REST API credentials

Now, you will get an consumer key and consumer secret from woocommerce.

Note: Make sure to save a copy of your new keys locally because the secret key will no longer be visible once you navigate away from this page.

To Add Points:

POST /wp-json/wc/v3/wployalty/customers/points/add

To authenticate the API: Woocommerce provides supported authentication.

Parameters/ attributes:

Field

Required

Field Type

Description

user_email

yes

email

WPLoyalty customer email ID

points

yes

int

amount of points to add

Note: If the email ID is not present in the WPLoyalty Customer list, a new customer record will be created in the WPLoyalty Customer Dashboard while adding points. Please note that authentication is handled by Woocommerce, and WPLoyalty supports the actions to add/ reduce points.

To Reduce Points:

POST /wp-json/wc/v3/wployalty/customers/points/reduce

To authenticate the API: Woocommerce provides supported authentication.

Parameters/ attributes:

Field

Required

Field Type

Description

user_email

yes

email

WPLoyalty customer email ID

points

yes

int

amount of points to reduce

Error code for both add/ reduce points:

Error code

Response Error Code

Message

rest_invalid_param

400

Invalid parameter(s) : user_email, points

rest_no_route

404

No route was found matching the URL and request method

This above discussed feature is only available in the WPLoyalty PRO version. To access it, click on the

Click here to purchase WPLoyalty PRO.

Next Steps:

Learn more about WPLoyalty and related guides:

Still unclear ?

Please submit a support request. We are always happy to assist you :)

Last updated