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/mypointsStatus: 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/couponsGet next page of redeemed coupon entries
GET: http://example.com/wp-json/loyalty-program/v1/mypoints/coupons?page=2Status: 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
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 next page of history entries
Status: 200 OK
Status: 403 Forbidden
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
Status: 200 OK
Redeem 50 points
Status: 403 Forbidden
Last updated
Was this helpful?