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/mypoints
  • GET: /wp-json/loyalty-program/v1/mypoints/coupons
  • GET: /wp-json/loyalty-program/v1/mypoints/history
  • POST: /wp-json/loyalty-program/v1/mypoints/redeem

Was this helpful?

  1. loyalty-program/v1

My Points

loyalty-program/v1/mypoints

the my points API is intended solely for frontend use on a customer's session. This allows you to process the following data:

  • fetch user's points balance and worth

  • fetch user's redeemed coupons

  • fetch user's points history

  • redeem coupons using user's earned points

GET: /wp-json/loyalty-program/v1/mypoints

Fetch all sections of LPFW settings.

Requirements:

  • Logged-in user

  • role is allowed to earn points

Method

Endpoint

GET

/wp-json/loyalty-program/v1/mypoints

Get current logged in user's points balance

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

Status: 200 OK

Get current logged in user's points balance

{
    "points": 361,
    "worth": "$36.10",
    "expiry": "April 7, 2022 11:59 am"
}

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/mypoints/coupons

Fetch all sections of LPFW settings.

Requirements:

  • Logged-in user

  • role is allowed to earn points

Method

Endpoint

GET

/wp-json/loyalty-program/v1/mypoints/coupons

Query Parameters

Required

Type

Description

​page

​false

​number

​Page number

Custom Response Headers

Type

Description

X-TOTAL

number

Total number of history entries

Get customer's most recent redeemed coupons (10 entries)

GET: http://example.com/wp-json/loyalty-program/v1/mypoints/coupons

Get next page of redeemed coupon entries

GET: http://example.com/wp-json/loyalty-program/v1/mypoints/coupons?page=2

Status: 200 OK

Get customer's most recent redeemed coupons (10 entries) / Get next page of redeemed coupon entries

Headers:
{
...
X-TOTAL: 15
}


JSON Body:
[
    ...
    {
        "id": 314,
        "code": "1mpwzrp",
        "amount": "$10.00",
        "date_created": "April 7, 2021 11:59 am",
        "date_expire": "April 2, 2022 12:00 am",
        "points": 100
    }
    ...
]

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/mypoints/history

Get customer's points history data.

Requirements:

  • Logged-in user

  • role is allowed to earn points

Method

Endpoint

GET

/wp-json/loyalty-program/v1/mypoints/history

Query Parameters

Required

Type

Description

​page

​false

​number

​Page number

Custom Response Headers

Type

Description

X-TOTAL

number

Total number of history entries

Get logged in user's most recent points history (10 entries)

GET: http://example.com/wp-json/loyalty-program/v1/mypoints/history

Get next page of history entries

GET: http://example.com/wp-json/loyalty-program/v1/mypoints/history?page=2

Status: 200 OK

Headers:
{
...
X-TOTAL: 25
}


JSON Body:
[
    ...
    {
        "id": 116,
        "action": "coupon",
        "date": "04/07/2021 11:59:22",
        "activity": "Redeem Coupon",
        "points": 100,
        "rel_link": "http://acfw.test/coupon/1mpwzrp/",
        "rel_label": "Coupon: 1mpwzrp"
    }
    ...
]

Status: 403 Forbidden

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

POST: /wp-json/loyalty-program/v1/mypoints/redeem

Redeem points and create a coupon.

Requirements:

  • Logged-in user

  • role is allowed to earn points

Method

Endpoint

POST

/wp-json/loyalty-program/v1/mypoints/redeem

Query Parameters

Required

Type

Description

points

true

integer

Number of points to redeem

Redeem 50 points

POST: http://example.com/wp-json/loyalty-program/v1/mypoints/redeem

JSON Body:
{
    "points": 50
}

Status: 200 OK

Redeem 50 points

{
    "user_coupon": {
        "id": 315,
        "code": "1l6ywrm",
        "amount": "$5.00",
        "date_created": "April 7, 2021 1:57 pm",
        "date_expire": "April 7, 2022 1:57 pm",
        "link": "http://acfw.test/coupon/1l6ywrm/",
        "points": 50
    },
    "balance": {
        "points": 311,
        "worth": "$31.10",
        "expiry": "April 7, 2022 1:57 pm"
    },
    "message": "Points redeemed successfully!"
}

Status: 403 Forbidden

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

PreviousSettingsNextwc-loyalty-program/v1

Last updated 3 years ago

Was this helpful?