Operator widget
You want a rewards shop in your player account, but you don’t want to build one. Embed the Luxorr widget. Luxorr shows the gifts, takes the address, and creates the order. You open a session for each player, and you debit the coins when the player orders.
Requires: a key with the REWARD_STORES scope, a webhook URL or a reader of the event feed, and a server that can receive Luxorr’s debit call over HTTPS.
Set up the key
Section titled “Set up the key”Ask your Administrator or your Luxorr contact to do the following:
- Set up a rewards store for your brand, with its bonus currency and rate, and select Rewards Stores on your key.
- Set the key’s Widget debit URL, such as
https://wallet.operator.example/luxorr/debit. - Choose where the widget opens: add your sites to the key, such as
https://www.operator.example, or let each session name its site. For more information, see Choose where the widget opens. - Choose the brand’s look in Workspace > Branding, with Widget Style on the brand.
To find the store’s ID, call GET /reward-stores?brandId=…, and then store the ID with the brand ID.
Open a session when the player visits
Section titled “Open a session when the player visits”Your rewards page asks your server for a session. Your server knows the signed-in player, and the player’s country, language, and balance:
POST /v1/widget-sessionsAuthorization: Bearer lxr_live_…{ "storeId": "4b3a2918-0716-4f5e-8d4c-3b2a19080716", "brandId": "0a6f2e1c-3b5d-4e7f-8a9b-0c1d2e3f4a5b", "playerId": "player-77", "country": "DE", "locale": "de-DE", "balance": "1200", "prefill": { "name": "Wendy Player", "phone": "+4915112345678" }}Pass the token from the response to the page. Open a new session on every visit. Each session lasts 60 minutes.
Embed the shop
Section titled “Embed the shop”Mount the widget with the token:
<div id="rewards"></div><script src="https://gifts.luxorr.io/widget/v1/embed.js"></script><script> const widget = LuxorrWidget.mount({ target: '#rewards', mode: 'inline', session: token, onSessionExpired: () => fetch('/rewards/session', { method: 'POST' }).then((answer) => answer.json()).then((session) => session.token), onBalanceChanged: (balance) => showBalance(balance), })</script>To show a floating Rewards button on every page of the player account, use mode: 'launcher' instead.
Debit when the player orders
Section titled “Debit when the player orders”Luxorr calls your widget debit URL before it creates the order. The following table shows what your debit endpoint does:
| Your debit endpoint receives | Your endpoint |
|---|---|
| An invalid or stale signature | Returns 400. No coins move. |
A debitId that it already answered |
Returns the same answer as before. No coins move. |
| A debit for a player whose balance is too low | Returns { "approved": false, "reason": "insufficient_balance", "balance": "300" }. |
| A debit for a blocked player | Returns { "approved": false, "reason": "player_blocked" }. |
| Any other debit | Deducts coinPrice, and then returns { "approved": true, "balance": "750", "reference": "tx-981" }. |
Answer within 5 seconds. Store each debitId with the player, the coinPrice, and whether you deducted it.
Refund
Section titled “Refund”The following table shows what your server does with each event:
| Event | Your server |
|---|---|
widget.debit.voided |
If you deducted for data.debitId, refund data.coinPrice once. Either way, record the debitId, and decline a widget.debit that arrives for it later. |
order.cancelled |
If you deducted for the order’s id, refund its coinPrice once. |
order.approved, order.sent, order.completed |
Nothing. Coins don’t move. |
If the player’s page is open, show the refunded balance in the widget too: call widget.setBalance(balance) from your page, with the balance as a decimal string.
A widget order’s id is the debitId that paid for it, so keep one “refunded” mark for each debitId. Reconcile from the event feed every few minutes, in case a webhook is missed. Your key receives the events of the widget sessions that it opened, and no others.
See the orders in Luxorr
Section titled “See the orders in Luxorr”Widget orders appear in the Luxorr workspace with the store orders, labeled “via widget” with the key’s name and the player ID. Your team approves and cancels them there. Players follow them in the widget’s My orders list.
For every field and error, see Widget.

