Link Search Menu Expand Document

Receipts

You can use the Spaaza API to get individual receipt objects or all receipts for a customer. This can be used to provide a customer with access to their full purchase history as well as their individual purchases. Spaaza also makes a PDF of the receipt available for the customer.

Get All Receipts For a User

curl "https://services-[API_ENVIRONMENT].spaaza.com/receipts/?shopper_id=1234567"

The above command returns JSON structured like this:

[
  {
    "id": 123456,
    "timestamp": "2017-07-03T11:56:04Z",
    "type": "in_store",
    "download_url": "https://s3-eu-west-1.amazonaws.com/test01-receipts-bucket/receipts/123456.pdf",
    "quantity": 1,
    "subtotal": 1000,
    "total_value": 1000,
    "payment_method": "unknown",
    "line_items": [
      {
        "product_id": 0,
        "barcode": "2000046371025",
        "sku": "2000046371025",
        "name": "ACME shorts",
        "description": "the best pair you can buy",
        "type": "shorts",
        "original_price": 1000,
        "quantity": 1.055,
        "quantity_unit": "kg",
        "sale_price": 1000,
        "vouchers": 0,
        "metadata": {
          "color": "blue",
          "size": "L",
          "image": ""
        },
        "sale_discount": ""
      }
    ],
    "tax_lines": [],
    "chain": {
      "id": 1740,
      "name": "ACME",
      "email": "support@acme.co.za",
      "logo_url": "https://s3-eu-west-1.amazonaws.com/receipts-chain-logo/1000.png",
      "website_url": "",
      "currency": "South African Rand",
      "currency_symbol": "R",
      "business": {
        "id": 0,
        "name": "ACME Cape Town",
        "address": {
          "address_1": "1 Table Mountain Drive",
          "address_2": "",
          "address_3": "",
          "towncity": "Cape Town",
          "postal_code": "",
          "country_code": "ZA",
          "location": {
            "lat": -33.962822,
            "lon": 18.4098410
          }
        },
        "phone_number": "+272189777777",
        "email": "table-mountain@acme.co.za",
        "website_url": ""
      },
      "receipts_service_active": true
    },
    "shopper": {
      "id": 897654,
      "user_name": "",
      "entity_code": "",
      "first_name": "John",
      "last_name": "Smith",
      "country_code": "",
      "gender": "M",
      "birthday": "1982-05-30",
      "total_points_balance": 0,
      "email": "john.smith@email.com",
      "registered": false,
      "shipping_address": {
        "address_1": "",
        "address_2": "",
        "address_3": "",
        "towncity": "",
        "postal_code": "",
        "country_code": "",
        "location": {
          "lat": 0,
          "lon": 0
        }
      },
      "billing_address": {
        "address_1": "",
        "address_2": "",
        "address_3": "",
        "towncity": "",
        "postal_code": "",
        "country_code": "",
        "location": {
          "lat": 0,
          "lon": 0
        }
      }
    },
    "monetary_wallet": {
      "contributions": [
        {
          "amount": 100,
          "campaign_title": "Earn big on every purchase"
        }
      ],
      "total": 1640,
      "title": "ACME Bucks"
    },
    "points_wallet": {
      "contributions": [],
      "total": 0,
      "title": ""
    },
    "basket_vouchers": [
      {
        "campaign_title": "Boardriders Bucks",
        "voucher_text": "",
        "amount": 500,
        "type": "wallet"
      }
    ]
  },
  {
    "id": 678910,
    "timestamp": "2017-07-03T11:35:52Z",
    "type": "in_store",
    "download_url": "https://s3-eu-west-1.amazonaws.com/test01-receipts-bucket/receipts/77888.pdf",
    "quantity": 1,
    "subtotal": 2000,
    "total_value": 2000,
    "payment_method": "unknown",
    "line_items": [
      {
        "product_id": 0,
        "barcode": "2000046371025",
        "sku": "2000046371025",
        "name": "Best tee",
        "description": "The best t-shirt money can buy",
        "type": "T-shirt",
        "original_price": 2000,
        "quantity": 1,
        "sale_price": 2000,
        "vouchers": 0,
        "metadata": {
          "color": "grey",
          "size": "S",
          "image": ""
        },
        "sale_discount": ""
      }
    ],
    "tax_lines": [],
    "chain": {
      "id": 1740,
      "name": "ACME",
      "email": "support@acme.co.za",
      "logo_url": "https://s3-eu-west-1.amazonaws.com/receipts-chain-logo/1740.png",
      "website_url": "",
      "currency": "South African Rand",
      "currency_symbol": "R",
      "business": {
        "id": 1,
        "name": "ACME Waterfront",
        "address": {
          "address_1": "2 Waterfront bay",
          "address_2": "",
          "address_3": "",
          "towncity": "Cape Town",
          "postal_code": "",
          "country_code": "ZA",
          "location": {
            "lat": -33.901988,
            "lon": 18.420828
          }
        },
        "phone_number": "+27218998765",
        "email": "waterfront@acme.co.za",
        "website_url": ""
      },
      "receipts_service_active": true
    },
    "shopper": {
      "id": 897654,
      "user_name": "",
      "entity_code": "",
      "first_name": "John",
      "last_name": "Smith",
      "country_code": "",
      "gender": "M",
      "birthday": "1982-05-30",
      "total_points_balance": 0,
      "email": "john.smith@email.com",
      "registered": false,
      "shipping_address": {
        "address_1": "",
        "address_2": "",
        "address_3": "",
        "towncity": "",
        "postal_code": "",
        "country_code": "",
        "location": {
          "lat": 0,
          "lon": 0
        }
      },
      "billing_address": {
        "address_1": "",
        "address_2": "",
        "address_3": "",
        "towncity": "",
        "postal_code": "",
        "country_code": "",
        "location": {
          "lat": 0,
          "lon": 0
        }
      }
    },
    "monetary_wallet": {
      "contributions": [
        {
          "amount": 200,
          "campaign_title": "Earn big on every purchase"
        }
      ],
      "total": 1540,
      "title": "ACME Bucks"
    },
    "points_wallet": {
      "contributions": [],
      "total": 0,
      "title": ""
    },
    "basket_vouchers": [],
    "template_content": {
      "subject": "",
      "background_color": ""
    }
  }
]

This endpoint returns all receipts objects for a specific user.

HTTP Request

Use the following GET request to request all receipts for a shopper:

GET https://services-[API_ENVIRONMENT].spaaza.com/receipts?shopper_id=<ID>

The API_ENVIRONMENT value varies according to whether the request is being made to Spaaza’s production or staging API:

Environment API_ENVIRONMENT value
Production prod
Staging test01

Headers

For admin or user authentication the following headers are required:

Header Description
X-Spaaza-Session-User-Id ID of the user obtained from the login endpoint
X-Spaaza-Session-Key key of the session obtained from the login endpoint
X-Spaaza-Session-Chain-Id the ID of the Spaaza chain or retailer

For privileged authentication the following headers are required:

Header Description
X-Spaaza-Session-Chain-Id the ID of the Spaaza chain or retailer
Authorization Bearer access token see: privileged

The following authentication methods are permitted:

Method Description
user A session generated by an end-user login.
or  
admin A session generated by administrative user login.
or  
privileged A token generated to privileged users.

Query Parameters

This API accepts the following parameters:

Parameter Description
shopper_id required The Spaaza User ID of the shopper/customer

Get a Specific Receipt

curl "https://services-[API_ENVIRONMENT].spaaza.com/receipts/12345678"

The above command returns JSON structured like this:

{
  "id": 123456,
  "timestamp": "2017-07-03T11:56:04Z",
  "type": "in_store",
  "download_url": "https://s3-eu-west-1.amazonaws.com/test01-receipts-bucket/receipts/123456.pdf",
  "quantity": 1,
  "subtotal": 1000,
  "total_value": 1000,
  "payment_method": "unknown",
  "line_items": [
    {
      "product_id": 0,
      "barcode": "2000046371025",
      "sku": "2000046371025",
      "name": "ACME shorts",
      "description": "the best pair you can buy",
      "type": "shorts",
      "original_price": 1000,
      "quantity": 1,
      "sale_price": 1000,
      "vouchers": 0,
      "metadata": {
        "color": "blue",
        "size": "L",
        "image": ""
      },
      "sale_discount": ""
    }
  ],
  "tax_lines": [],
  "chain": {
    "id": 1740,
    "name": "ACME",
    "email": "support@acme.co.za",
    "logo_url": "https://s3-eu-west-1.amazonaws.com/receipts-chain-logo/1000.png",
    "website_url": "",
    "currency": "South African Rand",
    "currency_symbol": "R",
    "business": {
      "id": 0,
      "name": "ACME Cape Town",
      "address": {
        "address_1": "1 Table Mountain Drive",
        "address_2": "",
        "address_3": "",
        "towncity": "Cape Town",
        "postal_code": "",
        "country_code": "ZA",
        "location": {
          "lat": -33.962822,
          "lon": 18.4098410
        }
      },
      "phone_number": "+272189777777",
      "email": "table-mountain@acme.co.za",
      "website_url": ""
    },
    "receipts_service_active": true
  },
  "shopper": {
    "id": 897654,
    "user_name": "",
    "entity_code": "",
    "first_name": "John",
    "last_name": "Smith",
    "country_code": "",
    "gender": "M",
    "birthday": "1982-05-30",
    "total_points_balance": 0,
    "email": "john.smith@email.com",
    "registered": false,
    "shipping_address": {
      "address_1": "",
      "address_2": "",
      "address_3": "",
      "towncity": "",
      "postal_code": "",
      "country_code": "",
      "location": {
        "lat": 0,
        "lon": 0
      }
    },
    "billing_address": {
      "address_1": "",
      "address_2": "",
      "address_3": "",
      "towncity": "",
      "postal_code": "",
      "country_code": "",
      "location": {
        "lat": 0,
        "lon": 0
      }
    }
  },
  "monetary_wallet": {
    "contributions": [
      {
        "amount": 100,
        "campaign_title": "Earn big on every purchase"
      }
    ],
    "total": 1640,
    "title": "ACME Bucks"
  },
  "points_wallet": {
    "contributions": [],
    "total": 0,
    "title": ""
  },
  "basket_vouchers": [
    {
      "campaign_title": "Boardriders Bucks",
      "voucher_text": "",
      "amount": 500,
      "type": "wallet"
    }
  ],
          "loyalty_status": {
              "campaign_id": 2095,
              "name": "Level 1",
              "description": "Level 1 in the Programme",
              "loyalty_level_id": 2,
              "points_to_proceed_next_level": 500,
              "points_to_remain_current_level": 220,
              "maintenance_points_level": 200,
              "last_review_date": "2019-04-04T00:05:22+00:00",
              "next_review_date": "2020-04-04T00:05:22+00:00",
              "date_reached": "2019-06-06T08:06:14+00:00"
          }
}

Give a specific id, this endpoint returns the corresponding receipt object.

HTTP Request

Use the following GET request to get an individual receipt:

GET https://services-[API_ENVIRONMENT].spaaza.com/receipts/<id>

The API_ENVIRONMENT value varies according to whether the request is being made to Spaaza’s production or staging API:

Environment API_ENVIRONMENT value
Production prod
Staging test01

Headers

For admin or user authentication the following headers are required:

Header Description
X-Spaaza-Session-User-Id ID of the user obtained from the login endpoint
X-Spaaza-Session-Key key of the session obtained from the login endpoint
X-Spaaza-Session-Chain-Id the ID of the Spaaza chain or retailer

For privileged authentication the following headers are required:

Header Description
X-Spaaza-Session-Chain-Id the ID of the Spaaza chain or retailer
Authorization Bearer access token see: privileged

The following authentication methods are permitted:

Method Description
user A session generated by an end-user login.
or  
admin A session generated by administrative user login.
or  
privileged A token generated to privileged users.

URL Parameters

This API accepts the following parameters:

Parameter Description
id required Id of the receipt