> ## 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.

# Pre Cert Checklist Pay at Table

# Pre-Certification Self-Check: Pay-at-Table Integration

Complete ALL items before contacting [developer.support@thanx.com](mailto:developer.support@thanx.com) for certification.

***

## API Headers & General

*This integration uses two separate APIs with different header requirements.*

### Consumer API Headers (Create User, Acquire Auth Code, Acquire Access Token, Get Account, Get Locations)

* [ ] `Authorization: Bearer {access_token}`
* [ ] `X-ClientId: {client_id}`
* [ ] `Accept-Version: v4.0`
* [ ] `Content-Type: application/json`
* [ ] `Accept: application/json`

### Loyalty API Headers (Create/Update Basket)

* [ ] `Authorization: Bearer {user_access_token}`
* [ ] `Merchant-Key: {merchant_key}`
* [ ] `Accept: application/vnd.thanx-v1+json`
* [ ] `Content-Type: application/json`
* [ ] `User-Agent: {partner}/1.0.0`

### General

* [ ] No unnecessary duplicate API requests
* [ ] Error messages handled gracefully
* [ ] API requests issued at a reasonable frequency (no rapid polling)

## Sign Up Flow (New Users)

* [ ] Create User endpoint called when guest creates an account
* [ ] If user is new: token returned and stored for subsequent calls
* [ ] If user already exists (400 error): flow falls back to Acquire Authorization Code -> Acquire Access Token
* [ ] Get Account endpoint called after authentication
* [ ] Create or Update Basket endpoint called for purchase and reward accrual

## Sign In Flow (Existing Users)

* [ ] Acquire Authorization Code endpoint called when guest signs in with email
* [ ] User receives email with authentication link
* [ ] Redirect URI correctly configured to receive authorization code as query parameter
* [ ] Acquire Access Token endpoint exchanges authorization code for access token
* [ ] Get Account endpoint called after authentication
* [ ] Create or Update Basket endpoint called for purchase and reward accrual

## Reward Redemption (Required)

* [ ] User can view available rewards (via Get Account endpoint)
* [ ] User can redeem rewards (via Create or Update Basket endpoint)
* [ ] Amount-off rewards supported
* [ ] Item-based rewards supported

## Points Product Exchange (Required)

* [ ] User can view eligible points products based on points balance (via Get Account)
* [ ] User can submit points products as part of basket (via Create or Update Basket)
* [ ] Amount-off points products supported
* [ ] Item-based points products supported

## Basket Submission

* [ ] Basket submitted to Create or Update Basket endpoint with correct state transitions:
  * [ ] `checkout` — basket created/updated during browsing
  * [ ] `placed` — order submitted, reward locked
  * [ ] `billed` — payment charged, loyalty accrued
  * [ ] `completed` — order handed to customer (recommended)
* [ ] `location_uid` included (mapped via Get Locations endpoint from Consumer API)
* [ ] `items` array populated with `price` per item in every basket state
* [ ] `payments` array populated with `amount` per entry
* [ ] `order_timestamp` in ISO 8601 format (UTC)

## Automated Location Mapping

* [ ] Location IDs mapped from your system to Thanx Location IDs via Get Locations endpoint
* [ ] Correct `location_uid` sent with every basket submission

## Refunds & Cancellations

* [ ] Voided orders handled (`voided` state for pre-billing cancellations)
* [ ] Refunded orders handled (`refunded` state for post-billing cancellations)
* [ ] Redeemed rewards restored on void/refund

## Error Handling

* [ ] Authentication failures handled gracefully (both sign-up and sign-in flows)
* [ ] Reward redemption errors handled (expired, already used, insufficient points)
* [ ] Basket submission errors handled
* [ ] Meaningful error messages displayed to guests

## Submission Format

* [ ] Integration tested against Thanx Sandbox environment
* [ ] All sandbox API calls visible in DataDog logs
* [ ] Ready to demo on a video call: authentication (sign-up + sign-in), loyalty lookup, order submission with/without redemption, all supported loyalty types, error handling

***

**After completing all items above, email [developer.support@thanx.com](mailto:developer.support@thanx.com) to schedule your certification call.**
