TheDocumentation Index
Fetch the complete documentation index at: https://docs.tybritelabs.com/llms.txt
Use this file to discover all available pages before exploring further.
GiftCardsService class (accessed via client.giftCards) manages the checking and redemption of store-issued gift cards.
Methods
listGiftCards
Retrieve all gift cards owned by a specific customer. This is used for displaying a user’s digital wallet in their account dashboard.
customerId is strictly required for this endpoint to identify which wallet to retrieve. In addition, an xAuthToken (the customer’s session JWT) must be supplied so the gateway can verify the requester owns that wallet.When listing gift cards for a customer, the resolved
xAuthToken JWT must match the customerId parameter. Otherwise the gateway returns 403. This means a leaked publishable key alone cannot enumerate another customer’s gift cards — the customer’s session token is required.checkGiftCard
Retrieve the current balance and status of a gift card using its code. Because gift cards operate as bearer instruments (like cash), this endpoint deliberately does not require a customer ID.
This allows both registered users and guest checkout users to check balances.
No customer auth required — the gift card code itself is the credential.
🛡️ Secure Redemption Architecture
Tybrite does not expose a standalone redemption endpoint for gift cards. This architectural decision prevents financial race conditions (double-spending) and ensures that all gift card deductions are natively tied to a unified accounting ledger and order generated during checkout. To redeem a gift card, pass the code and amount during the order creation process:Card Lifecycle
Gift cards in Tybrite move through three states:- Active: Valid for use and has a non-zero balance.
- Redeemed: The balance has been fully utilized.
- Expired: The card has passed its
expires_atdate and can no longer be used, regardless of balance.
Authentication Flow
listGiftCards requires the customer’s session JWT in addition to your API key. Obtain it via the AuthenticationService and pass it as xAuthToken:
customerId before returning any wallet contents.
Response Codes
| Code | Meaning |
|---|---|
200 | Success. |
400 | Missing required customer_id (on listGiftCards). |
401 | Missing or invalid xAuthToken or API key. |
403 | Customer token does not match the customer_id. |
404 | Gift card not found (on checkGiftCard). |

