Documentation
IntegrationsPOS Integration

POS Integration

Connect your point-of-sale system to Xtarly Rewards to automatically award points or stamps when customers make a purchase.

The POS integration lets your point-of-sale system register transactions directly via a REST API. Every time a customer pays, your POS calls the Xtarly endpoint and the customer instantly receives their points or stamps — no manual scanning required.

Getting your API key

  1. Open your organization dashboard and go to Settings → General.
  2. Scroll down to the POS Integration section.
  3. Click Generate API key. The key is shown once — copy it immediately and store it securely (e.g. in your POS system's environment configuration).
  4. If the key is ever compromised, click Rotate to invalidate the old key and generate a new one.

The API key is shown only once after generation. If you lose it, you will need to rotate and update all integrations using the old key.

Base URL

All POS endpoints are served from your Xtarly domain:

https://www.xtarly.com/api/integrations/pos

Authentication

Include your API key in every request via the X-API-Key header:

X-API-Key: xtarly_pos_<your_key>

Requests without a valid key return 401 Unauthorized.


Endpoints

Register a transaction

POST /api/integrations/pos/transaction

Call this endpoint when a customer completes a purchase. Xtarly calculates the points or stamps earned based on your active reward program and credits them to the customer.

Request body

FieldTypeRequiredDescription
amountnumberPurchase total in the smallest currency unit (e.g. cents for MXN/USD).
customerIdstring✓ (or customerEmail)Xtarly customer ID.
customerEmailstring✓ (or customerId)Customer's registered email.
metadataobjectOptional free-form object attached to the transaction (e.g. { "ticket": "1234" }).

Provide either customerId or customerEmail — at least one is required.

Example request

curl -X POST https://www.xtarly.com/api/integrations/pos/transaction \
  -H "Content-Type: application/json" \
  -H "X-API-Key: xtarly_pos_<your_key>" \
  -d '{
    "amount": 35000,
    "customerEmail": "cliente@ejemplo.com",
    "metadata": { "ticket": "T-00412" }
  }'

Successful response 200 OK

{
  "success": true,
  "data": {
    "transactionId": "txn_abc123",
    "earnedPoints": 35,
    "earnedStamps": 0,
    "customerPoints": 210,
    "customerStamps": 0
  }
}
FieldDescription
transactionIdUnique ID of the recorded transaction.
earnedPointsPoints credited in this transaction.
earnedStampsStamps credited in this transaction (stamp programs).
customerPointsCustomer's total points after this transaction.
customerStampsCustomer's total stamps after this transaction.

Look up a customer

GET /api/integrations/pos/customer/:id

Returns the current balance and tier of a customer. Useful to display loyalty status at the point of sale before or after a transaction.

Example request

curl https://www.xtarly.com/api/integrations/pos/customer/cus_abc123 \
  -H "X-API-Key: xtarly_pos_<your_key>"

Successful response 200 OK

{
  "success": true,
  "data": {
    "id": "cus_abc123",
    "name": "María García",
    "email": "cliente@ejemplo.com",
    "points": 210,
    "stamps": 0,
    "tier": null
  }
}

Points calculation

The points or stamps credited per transaction depend on your active program type:

Program typeCalculation
Pointsfloor(amount / currencyUnit × pointsPerCurrency)
TiersSame as Points, then multiplied by the customer's tier multiplier.
Stamps1 stamp per transaction, regardless of amount.

You configure currencyUnit and pointsPerCurrency in Settings → Program.

Error codes

CodeHTTPDescription
UNAUTHORIZED401Missing or invalid API key.
VALIDATION_ERROR400amount or customer identifier not provided.
NOT_FOUND404No customer found with the given ID or email in your organization.
BAD_REQUEST400Your organization has no active reward program.
POS Integration | Documentation | Xtarly Rewards