Loyalty and gift cards on your site
What you can do
Section titled “What you can do”- A signed-in customer sees their points, stamps, store credit and the gift cards they bought.
- A visitor buys a gift card, pays by bank card and gets the code.
- The card pays for an order, and later works at the till too: it is the same card.
All requests come from your server, with the shop channel key. The key never reaches the browser.
Customer balance
Section titled “Customer balance”GET /api/site/v1/shop/me/loyalty, with the customer session in X-Shop-Session.
{ "points": { "balance": 149, "value": 74.5, "currency": "RON", "next_expiry": { "on": "2027-11-28", "points": 149 }, "entries": [] }, "stamps": [{ "program": "Shop club", "reward": "10% off", "stamps": 3, "required": 5, "rewards_waiting": 0 }], "gift_cards": [{ "last4": "A2F0", "balance": 100, "initial_value": 100, "currency": "RON", "expires_on": "2027-11-28", "recipient_name": null }], "credit": { "total": 59, "money": 59, "free": 0, "currency": "RON" }}credit.money is the customer’s own money (from returns), credit.free is credit given by the shop.
points.tier and points.next_tier give the tier and what is left to the next one; points.challenges shows challenge progress. On each stamp card, card_url opens the page with the QR code.
The balance is returned only to accounts with a confirmed email; otherwise the response has verify_required: true.
On a client portal (without a shop), the same data comes from GET /api/site/v1/account/me/loyalty, with the portal key.
Selling a gift card
Section titled “Selling a gift card”GET /api/site/v1/shop/gift-cardssays whether it can be bought (enabled), the values (values) and the buyer text.POST /api/site/v1/shop/gift-cardswithamount,emailand optionallyname,recipient_name,recipient_email,message,success_url,cancel_url. The response haspayment_urlandtoken.- Send the buyer to
payment_url. On return, your address receives agiftparameter with the same token. GET /api/site/v1/shop/gift-cards/{token}returnsstatus(pending,paid,failed,cancelled) and, after payment,code. The code is shown here only on the first day.
Online gift cards are turned on per channel in the ERP: Shop, Channels, Gift cards section.
Paying an order with a gift card
Section titled “Paying an order with a gift card”The simplest way: send gift_card_code at checkout (POST /api/site/v1/shop/carts/{token}/checkout). The card is applied before payment, so the processor, courier or pro forma ask only for the rest. If the code fails, the order is still created and the response has gift_card_error.
For an existing order: POST /api/site/v1/shop/checkout/credit with order_id and gift_card_code. The response says how much was applied and what is left. With cash on delivery, the courier collects only the rest.
If the order is cancelled, the amount goes back to the card.