Advanced Coupons API
  • REST API
  • coupons/v1
    • Virtual Coupons (Premium)
      • Query a list of virtual coupons
      • Fetch virtual coupon stats
      • Create a virtual coupon
      • Retrieve a virtual coupon
      • Update a virtual coupon
      • Delete a virtual coupon
      • Bulk create virtual coupons
      • Bulk delete virtual coupons
    • Search Customers (Premium)
    • Settings
  • loyalty-program/v1
    • Dashboard
    • Customers
    • Settings
    • My Points
  • wc-loyalty-program/v1
    • Dashboard
    • Customers
    • Settings
  • wc-store-credits/v1
    • Entries
      • Query a list of store credit entries
      • Create a store credit entry
      • Fetch a single store credit entry
      • Update store credit entry
      • Delete store credit entry
    • Customers
      • Get dashboard statistics data
      • Query list of customers with store credits balance
      • Get single customer statistics and sources
Powered by GitBook
On this page
  • GET: /wp-json/loyalty-program/v1/settings/sections
  • GET: /wp-json/loyalty-program/v1/settings/sections/{section_id}
  • GET: /wp-json/loyalty-program/v1/settings/{lpfw_option_name}
  • PUT: /wp-json/loyalty-program/v1/settings/{lpfw_option_name}
  • DELETE: /wp-json/loyalty-program/v1/settings/{lpfw_option_name}

Was this helpful?

  1. loyalty-program/v1

Settings

/loyalty-program/v1/settings

The admin settings API allows you to do the following:

  • fetch setting sections

  • fetch a section's list of fields

  • read, update and delete setting options for LPFW.

GET: /wp-json/loyalty-program/v1/settings/sections

Fetch all sections of LPFW settings.

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

GET

/wp-json/loyalty-program/v1/settings/sections

Request Headers

Required

Type

Description

​section

​false

​string

Slug of the current section.

When filled, it will preload the section's fields.

Get all sections

GET: http://example.com/wp-json/loyalty-program/v1/settings/sections

Searching for customers

GET: http://example.com/wp-json/loyalty-program/v1/settings/sections

Custom Headers JSON
{
    "section": "points_earning"
}

Status: 200 OK

Get all setting sections.

[
    {
        "id": "general",
        "title": "General",
        "fields": []
    },
    {
        "id": "points_earning",
        "title": "Points Earning",
        "fields": []
    },
    {
        "id": "redemption_expiry",
        "title": "Redemption Expiry",
        "fields": []
    },
    {
        "id": "role_restrictions",
        "title": "Role Restrictions",
        "fields": []
    },
    {
        "id": "help",
        "title": "Help",
        "fields": []
    }
]

Get all setting sections and load fields for current section

[
    {
        "id": "general",
        "title": "General",
        "fields": []
    },
    {
        "id": "points_earning",
        "title": "Points Earning",
        "fields": [
            {
                "title": "Points Calculation",
                "type": "subtitle"
            },
            ...fields
        ]
    },
    {
        "id": "redemption_expiry",
        "title": "Redemption Expiry",
        "fields": []
    },
    {
        "id": "role_restrictions",
        "title": "Role Restrictions",
        "fields": []
    },
    {
        "id": "help",
        "title": "Help",
        "fields": []
    }
]

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

GET: /wp-json/loyalty-program/v1/settings/sections/{section_id}

Get fields for a given setting section

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

GET

/wp-json/loyalty-program/v1/settings/sections/{section_id}

Get fields for general section

GET: http://example.com/wp-json/loyalty-program/v1/settings/sections/general

Status: 200 OK

Get fields for general section

{
    "id": "general",
    "fields": [
        {
            "title": "Price to points earned ratio",
            "type": "price",
            "desc_tip": "Define the ratio of points earned for each ₱ spent. Example: Setting a ratio of 1 means 1 point is earned for every ₱1,00 spent. Setting a ratio 5 means 5 points are earned for every ₱1,00 spent.",
            "default": 1,
            "id": "acfw_loyalprog_cost_points_ratio",
            "value": 10
        },
        {
            "title": "Points to price redeemed ratio",
            "type": "number",
            "desc_tip": "Define the worth of each point. Example: Setting a points to price redeemed ratio of 1 means 1 point is worth ₱1,00. Setting a ratio of 10 means 10 points is worth ₱1,00.",
            "default": 10,
            "id": "acfw_loyalprog_redeem_points_ratio",
            "min": 1,
            "value": 1
        },
        {
            "title": "Points name",
            "type": "text",
            "desc_tip": "By default, points are called “Points” throughout the store. You can override the name of your points here.",
            "placeholder": "Points",
            "id": "acfw_loyalprog_points_name",
            "value": "Points"
        }
    ]
}

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

GET: /wp-json/loyalty-program/v1/settings/{lpfw_option_name}

Get value for a LPFW setting option.

Method

Endpoint

GET

/wp-json/loyalty-program/v1/settings/{lpfw_option_name}

Get value for Price to points earned ratio setting option.

GET: http://example.com/wp-json/loyalty-program/v1/settings/acfw_loyalprog_cost_points_ratio

Status: 200 OK

Get value for Price to points earned ratio setting option.

{
    "id": "acfw_loyalprog_cost_points_ratio",
    "value": "10"
}

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

PUT: /wp-json/loyalty-program/v1/settings/{lpfw_option_name}

Update value of a LPFW setting option.

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

PUT

/wp-json/loyalty-program/v1/settings/{lpfw_option_name}

Query Parameters

Required

Type

Description

value

true

mixed

Value to update

​type

​false

​string

​Format type of value.

Default as string

Get value for Price to points earned ratio setting option.

PUT: http://example.com/wp-json/loyalty-program/v1/settings/acfw_loyalprog_cost_points_ratio

JSON Body:
{
    "value": 15,
    "type": number
}

Update Points calculation options setting

PUT: http://example.com/wp-json/loyalty-program/v1/settings/acfw_loyalprog_points_calculation_options

JSON Body:
{
    "value": {
        "tax": "yes", 
        "shipping": "", 
        "discounts": "yes", 
        "fees": "yes"
    }, 
    "type": "points_calculation"
}

Update Spending over a threshold (breakpoints) setting

PUT:http://example.com/wp-json/loyalty-program/v1/settings/acfw_loyalprog_earn_points_amount_breakpoints

JSON Body:
{
    "value": [
        {
            "amount": "10",
            "points": 10
        },
        {
            "amount": "20.50",
            "points": 20
        },
        {
            "amount": "40.60",
            "points": 40
        }
    ],
    "type": "breakpoints"
}

Update Extra points to earn during period setting

PUT: http://example.com/wp-json/loyalty-program/v1/settings/acfw_loyalprog_earn_points_order_period

JSON Body:
{
    value: [
        {
            "sdate":"04/04/2021",
            "stime":"01:38 pm",
            "edate":"04/08/2021",
            "etime":"01:38 pm",
            "points":"25"
        },{
            "sdate":"04/05/2021",
            "stime":"01:38 pm",
            "edate":"04/08/2021",
            "etime":"01:38 pm",
            "points":10
        }
    ]
    type: "order_period",
}

Status: 200 OK

Update value of Price to points earned ratio setting option to 15.

{
    "id": "acfw_loyalprog_cost_points_ratio",
    "value": "10"
}

Update Points calculation options setting

{
    "id": "acfw_loyalprog_points_calculation_options",
    "value": {
        "tax": "yes",
        "shipping": "",
        "discounts": "yes",
        "fees": "yes"
    }
}

Update Spending over a threshold (breakpoints) setting

{
    "id": "acfw_loyalprog_earn_points_amount_breakpoints",
    "value": [
        {
            "amount": "10",
            "points": 10,
            "sanitized": 10
        },
        {
            "amount": "20.5",
            "points": 20,
            "sanitized": 20.5
        },
        {
            "amount": "40.6",
            "points": 40,
            "sanitized": 40.6
        }
    ]
}

Update Extra points to earn during period setting

{
    "id": "acfw_loyalprog_earn_points_order_period",
    "value": [
        {
            "sdate": "04/04/2021",
            "stime": "01:38 pm",
            "edate": "04/08/2021",
            "etime": "01:38 pm",
            "points": 25
        },
        {
            "sdate": "04/05/2021",
            "stime": "01:38 pm",
            "edate": "04/08/2021",
            "etime": "01:38 pm",
            "points": 10
        }
    ]
}

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

DELETE: /wp-json/loyalty-program/v1/settings/{lpfw_option_name}

Update value of a LPFW setting option.

Requirements:

  • Logged-in user

  • user role with manage_woocommerce user capability

Method

Endpoint

DELETE

/wp-json/loyalty-program/v1/settings/{lpfw_option_name}

Get value for Price to points earned ratio setting option.

DELETE: http://example.com/wp-json/loyalty-program/v1/settings/acfw_loyalprog_cost_points_ratio

Status: 200 OK

Delete Price to points earned ratio setting option.

{
    "updated": true,
    "previous": {
        "id": "acfw_loyalprog_cost_points_ratio",
        "value": "10"
    }
}

Status: 403 Forbidden

{
    "code": "rest_forbidden_context",
    "message": "Sorry, you are not allowed access to this endpoint.",
    "data": {
        "status": 401
    }
}

PreviousCustomersNextMy Points

Last updated 3 years ago

Was this helpful?