> ## Documentation Index
> Fetch the complete documentation index at: https://docs.thanx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

This API is designed to provide **POS, online ordering, and kiosk providers** the
ability to integrate Thanx Loyalty into their ordering systems - reward
redemption & loyalty points accrual.

This API provides a way to retrieve a user's rewards and apply discounts to
their basket. An online ordering platform with a shared restaurant customer can
integrate with these APIs to allow Thanx users to both use their discounts
while placing digital orders and accrue points progress while doing so.

* The `GET /account` endpoint provides a user's available rewards.
* The `POST /baskets` endpoint computes a discount and marks rewards or points
  product as used in the Thanx system.
  * Ordering partners are expected to apply the discounts returned by this
    endpoint if a reward or points product was specified.
  * Finalized baskets automatically accrue points for the authenticated user.

## Environments

The Loyalty API is served from a dedicated subdomain in each environment:

| Environment | Base URL                                |
| ----------- | --------------------------------------- |
| Sandbox     | `https://loyalty.thanxsandbox.com/api/` |
| Production  | `https://loyalty.thanx.com/api/`        |

All examples in this reference use the sandbox base URL. Swap in the production URL once your integration has been certified and production credentials have been issued.

## Certification

Once your integration has been built and developed against the sandbox
environment, please reach out to
<a href="mailto:developer.support@thanx.com">[developer.support@thanx.com](mailto:developer.support@thanx.com)</a>
go through a lightweight but mandatory certification process. For basic
integration use-cases, certification is quick and normally takes no more than
a few days depending on the scope of integration. This process is mainly
designed to ensure the integration is working as intended without risking any
negative impact on live customers (merchant or consumer).

Each net new integration use-case should be re-certified as new use-cases will
very likely require different scoping.

Launching new merchants on certified integration use-cases does not require
re-certification.

The certification process will start with a video call with members of our developer
support team. On the call, your team will demo the integration and all the
supported use-cases. After the demo of all support use-cases, our team will
validate the following:

### 1 - **Interactions**

1. authentication
2. loyalty lookup, such as reward or points product
3. order submission with or without loyalty redemption
4. walk through examples of all supported loyalty types:
   * reward redemption workflow:
     * amount off rewards
     * item-based rewards
   * points redemption workflow:
     * amount off points products
     * item-based points products
5. error message handling

### 2 - **API**

1. requests must include all [required headers](/loyalty/headers)
2. requests must not be unnecessarily duplicated
3. error messages should be displayed to the user
4. requests should only be issued on a reasonable frequency and in response
   to end-user interactions (e.g. Don't rapidly poll the API for changes)

### 3 - **Product Capabilities**

The following product capabilities are **non-negotiable** within our platform and must be supported in your POS–Kiosk integration. These features are crucial to the Thanx user experience.

1. **Reward Redemption**

Users must be able to look up their available rewards (via the [Get Account](/loyalty/get-account) endpoint).

They must also be able to redeem these rewards (via the [Create or Update Basket](/loyalty/create-update-basket) endpoint).

2. **Points Product Exchange**

Users must be able to view the products they are eligible to exchange based on their points balance (via the [Get Account](/loyalty/get-account) endpoint).

They must also be able to submit those products as part of their basket to complete the exchange (via the [Create or Update Basket](/loyalty/create-update-basket) endpoint).

3. **Refunds**

Users must be able to request refunds for their transactions if needed. (via the [Create or Update Basket](/loyalty/create-update-basket) endpoint).

Refunds should be handled at the POS, ensuring that:

* Any redeemed rewards are restored.
* Any exchanged point products are reverted, and the corresponding points are credited back to the user.

4. **Automated Location Mapping**

To ensure accurate tracking of purchases per location and proper filtering of location-specific rewards, baskets must be submitted with the correct **Thanx Location ID** in the `location_uid` attribute as specified [here](/loyalty/create-update-basket#param-location-uid).

To simplify this process, you can automate the mapping of your own location IDs to Thanx Location IDs by using the [Get Locations](/partner/metadata/get-locations) endpoint from the Partner API. This allows your system to asynchronously communicate with the Thanx API, keeping location data up to date and ensuring seamless internal mapping between your locations and Thanx locations.

### Product Guide

<Snippet file="certification/product-guide.mdx" />

## Postman API Collection

Here you will find the **Loyalty API Postman Collection** to import directly within your API testing tool.
This collection is already completed and includes sample values for the credentials.

Please replace them with the ones provided by your Thanx representative in order to achieve successful API calls.

<a href="/assets/Loyalty_API_Postman_Collection.json" download>
  Download Postman Collection
</a>
