WPLoyalty Knowledgebase
Back to WPLoyaltySupportMy Account
  • WPLoyalty Knowledgebase
  • Installation & Updates
    • Installation
    • Updates
    • License Key Validation
  • Quick Start Guides
    • Creating a Loyalty Points program
    • Creating a Referral Program
    • Creating a Customer Reward Page
  • Campaigns
    • Creating a Campaign
    • Campaign Types
    • Campaign Rules
    • Creating a Reward
  • Campaign Types
    • Points for Purchase
    • Reward for spending
    • Review Reward
    • Referral Campaign
    • Social Share Campaigns
    • Birthday Reward
    • Sign Up Reward
    • Social Pages Follow Campaign
    • Achievement Campaign
      • Custom Action
  • Reward Types
    • Points Conversion
    • Fixed Discount
    • Percentage Discount
    • Free Product
    • Free Shipping
  • Add-ons
    • WPLoyalty - Launcher
    • WPLoyalty - Points Expiry
    • WPLoyalty - Multi Currency
    • WPLoyalty - Discount Rule Integration
    • WPLoyalty - Judge.Me
    • WPLoyalty- Migration
      • Migration from WPSwings Points and Rewards
      • Migration from WooCommerce Loyalty Points & Rewards
      • Migration from WooCommerce Points and Rewards
    • WPLoyalty - Guest Referral
  • WPLoyalty - Brand Condition
    • WooCommerce Brands
    • Perfect Brands for WooCommerce
    • Page
  • WPLoyalty - Level Action
  • Customers, Levels & VIP
    • Creating Levels / Badges
    • Creating Tiered Levels / VIP Customer Rewards
    • Importing Customers and points
  • Translating WPLoyalty
    • Using LocoTranslate
    • Translating Dynamic Strings with LocoTranslate
    • Using WPML
    • Translate dynamic strings via WPML
    • Using TranslatePress
  • Guides
    • How does WPLoyalty work on websites with multiple languages ?
    • How to create user role specific campaigns in WPLoyalty ?
    • Purchase History conditions with examples
  • Settings
    • Display Settings
    • Customizing Emails for Points & Rewards Earned / Expiry
  • Developers
    • REST API with WPLoyalty PRO Plugin
Powered by GitBook
On this page

Was this helpful?

  1. Developers

REST API with WPLoyalty PRO Plugin

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

PreviousCustomizing Emails for Points & Rewards Earned / Expiry

Last updated 1 month ago

Was this helpful?

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 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.

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

Next Steps:

Learn more about WPLoyalty and related guides:

Still unclear ?

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

Click here to purchase WPLoyalty PRO.
Click here to learn more about WPLoyalty Customer tab and import option
Learn about how to provide Points while purchasing
Learn how to convert earned Points to a Reward/ Discount
Available types of Campings in WPLoyalty
Checkout our cool Launcher Widget
support request.
WPLoyalty PRO
Click here to purchase WPLoyalty PRO.