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.

Don't want to write code? There are 15 automatic connectors — Loyverse, Poster, Square, Clover, Toast, Bsale, Lightspeed, Odoo, Shopify, Alegra, CleanCloud, Epos Now, Mercado Pago, Clip and SumUp — that you connect in minutes from the POS integrations panel, no code required.

The POS REST API is a Premium plan feature: integrating your own system with Xtarly through code. It is not the same as connecting a POS from the catalog, which is available from the Shared plan and requires no programming — see the POS integrations dashboard. At the register you can always record sales from the cashier app, on any plan.

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. If you already have a live key, you can rotate it even if your plan changes: you never lose the way to replace a leaked credential.

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

Credit a sale

POST /api/integrations/pos/accrue

Call this endpoint when a customer pays. Xtarly finds the customer by phone number, calculates the points, stamps or cashback earned based on your active reward program and credits them to the customer.

Request body

FieldTypeRequiredDescription
saleIdstring✓The sale's id in your POS. It's the idempotency key: the same sale never credits twice.
customerPhonestring✓The customer's phone number.
amountCentavosnumber✓Sale total in cents, a non-negative integer: $350.00 = 35000.
occurredAtstring✓Date and time of the sale (ISO 8601).
branchNamestring—Name of the branch where the sale was charged.
currencystring—ISO code (3 letters) of amountCentavos. See Sale currency.
itemsarray—Ticket line items; stored verbatim on the transaction.

Example request

curl -X POST https://www.xtarly.com/api/integrations/pos/accrue \
  -H "Content-Type: application/json" \
  -H "X-API-Key: xtarly_pos_<your_key>" \
  -d '{
    "saleId": "T-00412",
    "customerPhone": "5512345678",
    "amountCentavos": 35000,
    "occurredAt": "2026-11-14T18:30:00-06:00",
    "branchName": "Centro"
  }'

Successful response 200 OK (program with 1 point per $10)

{
  "success": true,
  "data": {
    "status": "ACCRUED",
    "externalId": "cus_abc123",
    "pointsAccrued": 35,
    "stampsAccrued": 0,
    "cashbackAccruedCentavos": 0
  }
}
FieldDescription
statusACCRUED when credited, SKIPPED if that sale was already processed or there's no active program, and CUSTOMER_NOT_FOUND if no customer has that phone number.
externalIdThe customer's Xtarly ID. Absent with CUSTOMER_NOT_FOUND and when there's no active program.
pointsAccruedPoints credited for this sale.
stampsAccruedStamps credited for this sale (stamp programs).
cashbackAccruedCentavosCashback credited for this sale, in cents of the program currency (cashback programs).

If the customer doesn't take part in the program, it responds 403 with status: "CUSTOMER_BLOCKED" (see Customers who don't take part).

Retrying is safe: if the network fails, send the same saleId again. If the sale was already credited, it responds SKIPPED and doesn't credit it again.

branchName is resolved against your active Xtarly branch names (case-insensitive), so the stamp or points land in the right branch instead of showing up with no branch in the activity feed. If it doesn't match exactly one branch, the transaction is saved without a branch.


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
  }
}

Point-of-sale endpoints

The same API key gives you access to the endpoints a connected point of sale uses: identifying the customer at the register, seeing what they can apply today, and redeeming coupons or rewards at checkout.

EndpointWhat it's for
GET /pingChecks that the API key is valid and returns the program name.
GET /programActive program type (POINTS, STAMPS or TIERS), what the unit is called ("puntos" or "sellos"), the program currency and its moneyFormat (see Sale currency), the organizationId of the business that owns the API key, and accessFee, the access fee price if the business charges one (see Access fee).
POST /accrueCredits a POS sale. Idempotent by saleId. See Credit a sale.
GET /customer/by-phone?phone=Looks up the customer by phone number.
GET /customer/by-qr?payload=Looks up the customer from their card QR scanned at the register.
GET /customer/by-email?email=Looks up the customer by email (case-insensitive).
GET /customer/benefits?customerId=Everything that customer can apply today: available coupons and rewards with a verdict.
GET /coupon/by-qr?payload=Resolves a scanned coupon and says whether it can be redeemed.
GET /coupon/by-code?code=Same, with the code typed by hand.
POST /coupon/redeemApplies a coupon to the sale. Idempotent by saleId.
POST /reward/redeemRedeems a reward and deducts the points or stamps. Idempotent by saleId.
POST /customer/:id/access-feeRecords the access fee the POS charged. Idempotent by clientMutationId (see Access fee).

All four customer lookup endpoints return the same shape: id, name, email, phone, points, stamps and tier (the tier name, or null), plus blocked and blockReason (see Customers who don't take part).

What the customer can apply today

GET /api/integrations/pos/customer/benefits?customerId=cus_abc123

Returns, in a single call, the program type, the customer, their available coupons and every reward with the verdict already computed: attainable says whether they can redeem it right now, and if not, blockedReason and blockedMessage explain why (not enough points, tier not reached, already used this cycle…).

Each reward also includes a benefit object with the executable semantics of the discount — its type, its value and the menu products it applies to — so the POS can apply it on its own instead of leaving the math to the cashier.

Redeeming a coupon or a reward

POST /api/integrations/pos/coupon/redeem
POST /api/integrations/pos/reward/redeem

For a coupon, send couponId, saleId, amountCentavos and, optionally, customerId and branchName. A coupon flagged as walk-in can be redeemed without a customerId.

For a reward, send rewardId, customerId, saleId and, optionally, amountCentavos and branchName.

Both accept an optional currency (ISO, 3 letters) for amountCentavos; the minimum purchase is checked after converting to the program's main currency (see Sale currency).

Both answer status: "REDEEMED" with the redemptionId, and DUPLICATE if that same sale had already redeemed. The reward redemption also returns pointsSpent, stampsSpent and the customer's balance after the redemption.

Every condition is validated on the server: minimum purchase, required tier, expiry, per-customer redemption cap and balance. The POS doesn't decide whether a coupon applies — it asks and obeys the answer.

Sale currency

The program has a main currency, where every balance, reward, coupon and cap lives, and it can accept a secondary currency with an exchange rate the business sets by hand (for example, a program in córdobas that also accepts US dollars at 36.62).

POST /accrue, POST /coupon/redeem, POST /reward/redeem and POST /cashback/redeem accept an optional currency field: the ISO 4217 code (3 letters) of the currency the customer paid in.

  • Without currency, the sale is taken in the program's main currency. That's how every integration that doesn't send it keeps working.
  • With the secondary currency, the amount is converted to the main currency with the business's exchange rate before points, cashback, caps and the coupon's minimum purchase are calculated. The transaction keeps what was paid, its currency and the rate applied.
  • In POST /cashback/redeem, currency only applies to saleTotalCentavos. The discount (amountCentavos) is balance, and balance is always in the main currency.
  • Any other currency is rejected with 422 and nothing is credited:
{
  "success": false,
  "error": {
    "code": "CURRENCY_NOT_ACCEPTED",
    "message": "…",
    "currency": "EUR",
    "accepted": ["NIO", "USD"]
  }
}

GET /program now also returns the program currency (ISO) and moneyFormat, so the register can show amounts the way Xtarly does:

{
  "organizationId": "org_abc123",
  "currency": "NIO",
  "moneyFormat": {
    "currency": "NIO",
    "symbol": "C$",
    "decimals": 2,
    "secondary": { "currency": "USD", "symbol": "US$", "decimals": 2, "exchangeRate": 36.62 }
  },
  "exchangeRateUpdatedAt": "2026-11-04T12:00:00.000Z"
}

secondary is null when the program doesn't accept another currency. decimals is the number of decimals to display (0 for CLP, PYG and COP); amounts are still sent in cents (major unit × 100) in every currency.

exchangeRateUpdatedAt (ISO 8601, or null if it was never set) is when the business last changed the secondary currency or its exchange rate: a sale made offline before that moment may have used the previous rate.

organizationId is the id of the Xtarly business that owns the API key. It isn't sensitive (the key already belongs to that business): a register connected by pasting the key uses it as ?organizationId= when the owner changes the program currency from the point of sale.

Customers who don't take part

If the business added the customer to Customers who don't take part (its team members or a card suspended for misuse), the API doesn't credit or redeem anything for them:

  • POST /accrue, POST /coupon/redeem, POST /reward/redeem and POST /cashback/redeem respond 403 with error.code: "CUSTOMER_BLOCKED", data.status: "CUSTOMER_BLOCKED", blockReason (STAFF = team member, ABUSE = suspended card) and message with the text for the register ("Colaborador del negocio: no acumula ni canjea." or "Tarjeta suspendida por el negocio: no acumula ni canjea.", in Spanish). No transaction is created and no balance moves.
  • The lookups (/customer/by-phone, /customer/by-qr, /customer/by-email and /customer/:id) and /customer/benefits don't fail: they also carry blocked: true and blockReason, so the register can show the profile as blocked. In /customer/benefits every reward comes with attainable: false and blockedReason: "CUSTOMER_BLOCKED".
  • The business's internal note never travels through the API.

Access fee

If the business charges a program access fee, the customer can sign up but doesn't earn or redeem until their payment is recorded. Xtarly doesn't charge anything: the point of sale charges the fee as one more line on the ticket and records it here.

  • GET /program carries accessFee: { enabled, amount, currency, validityDays, label } with the current price (amount in major units of the primary currency; validityDays: null = it doesn't expire), or null if the business doesn't charge a fee.
  • The customer lookups carry accessFee with its status (state: PAID, PENDING or EXPIRED), amount, currency, label, paidAt and expiresAt, or null if the fee doesn't apply to that customer.
  • With the fee pending or expired, POST /accrue (and the other endpoints that move balance) respond 403 with error.code: "ACCESS_FEE_PENDING", data.status: "ACCESS_FEE_PENDING", data.accessFee and message with the text for the register. The sale isn't credited, and retrying it makes no sense until the payment is recorded.

To record the payment:

POST /api/integrations/pos/customer/:id/access-fee

:id is the customer id returned by the lookups.

{
  "amount": 150,
  "currency": "MXN",
  "method": "CASH",
  "receiptRef": "A-0017",
  "clientMutationId": "pos:sale_0017"
}
  • amount and currency: the price from GET /program → accessFee, in major units (150 = $150.00).
  • method: CASH, CARD, TRANSFER or OTHER.
  • receiptRef (optional, up to 200 characters): the ticket number.
  • clientMutationId (8 to 120 characters): idempotency key per business. Use one per sale.
HTTPResponse
200data: { payment: { id, paidAt, startsAt, expiresAt }, accessFee, idempotent }. accessFee is the new status (PAID). With a clientMutationId already used it returns the original payment with idempotent: true and doesn't record another one.
400ACCESS_FEE_DISABLED (the business doesn't charge a fee) or VALIDATION_ERROR.
403CUSTOMER_BLOCKED, with the same body as /accrue: the customer doesn't take part in the program and nothing is recorded.
404CUSTOMER_NOT_FOUND.
409ACCESS_FEE_AMOUNT_CHANGED: the business changed the price. data.accessFee carries the current amount, currency and label. Nothing was recorded: fix the ticket and send it again.

Recording the payment has the same effects as in the cashier app: the customer gets a notice, their card updates and, if their welcome stamp was on hold, it's credited. Then credit the sale with POST /accrue without the fee amount. Voiding or refunding the sale in the POS doesn't undo the payment in Xtarly.


Points calculation

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

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

amountCentavos / 100 is the total in major units: with currencyUnit 10 and pointsPerCurrency 1, a $350.00 sale (35000) earns 35 points. You configure currencyUnit and pointsPerCurrency in Settings → Program.

Error codes

CodeHTTPDescription
UNAUTHORIZED401Missing or invalid API key.
VALIDATION_ERROR400A required field is missing or has an invalid format (for example, a negative or fractional amountCentavos).
NOT_FOUND404GET /customer/:id and GET /customer/by-phone: there's no customer with that ID or phone number in your organization. GET /program: your organization has no reward program.
CUSTOMER_BLOCKED403The customer doesn't take part in your program (team member or suspended card). Includes blockReason: STAFF or ABUSE.
ACCESS_FEE_PENDING403The customer's access fee is pending or expired: they don't earn or redeem. Includes data.accessFee.
ACCESS_FEE_DISABLED400POST /customer/:id/access-fee: the business doesn't charge an access fee.
ACCESS_FEE_AMOUNT_CHANGED409POST /customer/:id/access-fee: the price changed. Includes the current one in data.accessFee.
CUSTOMER_NOT_FOUND404POST /customer/:id/access-fee: there's no active customer with that id in your organization.
CURRENCY_NOT_ACCEPTED422The sale's currency is neither the program's main currency nor its secondary one. Includes currency and accepted.