The fundamental function of a loyalty rewards program is to drive additional purchases. Therefore purchase  tracking is a very important part of the API.

The Purchase Tracking API passes the data for each purchase to Zinrelo. This enables Zinrelo to award points for purchases. This API is typically called from the server side after the checkout process is complete. The API call can be triggered when the order is created, shipped or completed depending on the business requirements.

Purchase API

The API call is a HTTP POST request to this end point URL. 


Click here for detailed documentation. 

API Authentication

All API calls have to be authenticated with your API key and partner ID. The API key and partner ID are automatically generated for you when your Zinrelo account is created. These can be found in your Zinrelo admin console under the General >> Settings section.

For authenticating an API call, you have to send your Partner ID, and an API Key in the HTTP header of each API request.

Send the keys in the HTTP header of each API request as given below :

'api-key': '<your-api-key'
'partner-id' : '<your-partner-id>'

Calling the Purchase API

Here is a sample Python script to call Zinrelo's Purchase API when the user checkout process is complete and the order has been registered. Note that if there are multiple products, then they need to be populated in the products[ ] object. 

import requests
import json

headers = {'partner-id': 'cad458dc4e',
           'api-key': 'c921e097e6679d21c0cad26a45bfec20'}
products = [{"category": "Medicines",
            "img_url": "",
            "price": "26.95",
            "product_id": "1234df",
            "quantity": "1",
            "tags": "medicines,capsules",
            "title": "Stress Free Emotions",
            "url": ""}]

payload = {"user_email": "",

response = = "",
                        headers = headers, data = payload)

Here is a description of the various product parameters used to create the  products[ ] object in the code snippet above. There will be one entry for each product item in this order.

And here is a description of the query parameters used in the payload of API call in the code snippet above.

JSON Response

Here is the sample sample JSON structured response that you will receive from Zinrelo. 

  "data": {
          "user_email": "",
          "last_name": "Baker",
          "first_name": "Bob",
          "activity_id": "made_a_purchase",
          "activity_name": "Made a Purchase",
          "points": 270,
          "points_status": "auto_approved",
          "created_time": "30-Mar-16 19:20:22"

Expected Result

Zinrelo will respond with standard HTTP success or failure codes. In case of a success response, the points will reflect in the user's account in the Zinrelo Admin Console.

Error Handling

For failures, Zinrelo will also include extra information about what went wrong, encoded in the response as JSON. The various HTTP and API status codes Zinrelo might return are listed below.

Standard HTTP status codes:

Zinrelo API Status Codes:

Your error handling code should log the error response. If you need to look into why points were not awarded to a particular customer or for a particular order, the logs will provide that information easily.

Did this answer your question?