Loyalty
Storefront REST API endpoints related to Okendo Loyalty. Both unauthenticated and after customer authentication.
Pre-Requisites
Okendo Partner ID
If you're integrating with Okendo Loyalty using these APIs, send an email to [email protected] to retrieve the value of your okendo-partner-id header.
Terminology
Earning Rule: a way for a customer to earn points.
Redemption Rule: a way for a customer to redeem points for a reward.
Transaction: an instance of points being awarded or removed from a customer.
Recommended Usage
For anonymous customers, use the Unauthenticated endpoints to display general details about the loyalty program. Once a customer has logged into their Shopify account and you have their user token, you should call POST /stores/{subscriberId}/loyalty/login to exchange this for an Okendo Loyalty customer token (JWT).
Once you have an Okendo Loyalty customer token, you can call the customer-authenticated endpoints which will tailor the response content for that specific customer. For example some earning or redemption rules may only be available to certain customers or they will earn more points if they're on a certain VIP tier. To call these Customer Authenticated endpoints, provide your Okendo Loyalty customer token as Bearer authentication in the request header. Note: A customer that hasn’t enrolled in the loyalty program can still be logged in and shown details like their points balance and earning history. However to redeem points for rewards, be placed in a tier, and more they will need to enrol in the program.
Program Enrolment
Okendo requires each customer to explicitly enrol in the loyalty program. By using these APIs you agree to follow the following steps in compliance with our enrolment flow:
After the POST /stores/{subscriberId}/loyalty/login call, if the customer's
statusispending, continue to step 2. If the customer'sstatusisblocked, they should not have access to participate in the program. If the customer'sstatusisenrolled, the following steps can be skipped as the customer has already agreed to the terms during previous enrolment.Call the GET /stores/{subscriberId}/loyalty/legal_policies endpoint to retrieve the policies and legal texts of the loyalty program (both by Okendo and by the merchant).
These terms must be shown to the customer before they agree to enrol in the loyalty program. The
acceptTermsAndJoinProgramButtonTextis to be used as the button text and thepolicySentence.html(or equivalent usingpolicySentence.template,privacyPolicyUrlandtermsAndConditionsUrl) is to be displayed below or above the opt-in button. Theversionof the terms is also provided and will be required in the next step. The following is an example of how the enrol button and terms are to be displayed.
When the enrol button is clicked, call the POST /loyalty/customer_activation endpoint with the following body:
{ enrollmentChannel: <your_okendo_partner_id>, legalPoliciesVersionAccepted: <'version' field value from step 3> }. Note: theokendo-partner-idheader will need to be set to the same value as theenrollmentChannel.The customer is now enrolled in the loyalty program. Their sign-up points will be awarded and their initial VIP tier will be set.
Unauthenticated
The unique identifier for the store. Available on the Okendo integration settings page.
API version header
A list of earning rules
A list of earning rules
The unique identifier for the store. Available on the Okendo integration settings page.
Country code for localisation
Language code for localisation
Currency code for localisation
API version header
A list of redemption rules
A list of redemption rules
The unique identifier for the store. Available on the Okendo integration settings page.
API version header
The VIP program details
The VIP program details
The unique identifier for the store. Available on the Okendo integration settings page.
API version header
A list of FAQ items
A list of FAQ items
Retrieve legal policies information including terms and conditions, privacy policy URLs, and policy text templates for the loyalty program
The unique identifier for the store. Available on the Okendo integration settings page.
API version header
Legal policies information
Legal policies information
The unique identifier for the store. Available on the Okendo integration settings page.
API version header
Login successful
Login successful
Customer Authenticated
Retrieve detailed information about the authenticated loyalty customer
JWT token for authenticated customer
API version header
Customer details retrieved successfully
Unauthorized - Invalid or missing authentication token
Customer not found
Conflict - Unable to load customer data
Enrol a customer into the loyalty program
JWT token for authenticated customer
API version header
The channel through which the customer is enrolling into the loyalty program
Version of legal policies accepted by the customer. To fetch the legal policies to display and their version, call the GET /stores/{subscriberId}/loyalty/legal_policies endpoint.
Customer activated successfully
Bad Request - Invalid customer identifier or subscriber ID
Unauthorized - Invalid or missing authentication token
Forbidden - Customer blocked, loyalty feature missing, or access denied
Not Found - Loyalty customer not found
Internal Server Error - Failed to activate customer
Retrieve earning rules for the authenticated customer, including completion status
JWT token for authenticated customer
API version header
Earning rules retrieved successfully
Unauthorized - Invalid or missing authentication token
Customer or subscriber not found
Trigger a social earning rule to earn points for the authenticated customer
JWT token for authenticated customer
The unique identifier for the earning rule to trigger
API version header
Earning rule triggered successfully
Bad request - Invalid earning rule or customer
Unauthorized - Invalid or missing authentication token
Forbidden - Customer not enrolled or invalid earning rule type
Earning rule not found or inactive
Updates the birthday for the given customer.
JWT token for authenticated customer
API version header
The day of the month, from 1 to 31.
The month of the year, from 1 to 12.
Successfully updated customer birthday.
Bad Request - Invalid birthday provided.
Not Found - Customer or subscriber not found.
No content
Retrieve redemption rules for the authenticated customer with localization support
JWT token for authenticated customer
Language code for localization
enCountry code for localization
usCurrency code for localization
USDAPI version header
Redemption rules retrieved successfully
Unauthorized - Invalid or missing authentication token
Customer or subscriber not found
Redeem loyalty points for rewards using a redemption rule
JWT token for authenticated customer
API version header
The unique identifier of the redemption rule to use
Points redeemed successfully
Bad request - Invalid redemption rule or request
Unauthorized - Invalid or missing authentication token
Forbidden - Customer not enrolled, insufficient points, or ineligible for rule
Customer not found
Unprocessable entity - Currency exchange mismatch
Retrieve paginated list of loyalty transactions for the authenticated customer
JWT token for authenticated customer
Maximum number of transactions to return
25Token for pagination to get the next page of results
Field and direction to order results by
date descPossible values: API version header
Loyalty transactions retrieved successfully
Unauthorized - Invalid or missing authentication token
Retrieve the customer's spending amount within the current VIP tier eligibility period
JWT token for authenticated customer
API version header
Customer spend retrieved successfully
Unauthorized - Invalid or missing authentication token
Forbidden - Loyalty program not launched or customer not enrolled
Customer not found
Loyalty x Referrals
Sends a referral request to the specified email address
JWT token for authenticated customer
API version header
The email of the person being referred to the loyalty program
The Referral Sender ID of the loyalty member. This can be found in the response from the Get Customer Details authenticated endpoint.
Successfully sent referral request.
Bad Request - Unable to create referral.
No content
Retrieves the referral history for the authenticated customer
JWT token for authenticated customer
Token for pagination to get the next page of results
API version header
Referral history retrieved successfully
Referral history retrieved successfully
Retrieves the number of referrals by an authenticated customer
JWT token for authenticated customer
API version header
Referral count retrieved successfully
Referral count retrieved successfully
Last updated