Voucher Activation
This page documents digital pre-activation, and it belongs to both integration models. Before the transaction, the customer opens the app or the website, sees the vouchers assigned to them, and activates the ones they intend to use. That activation is a state change in Loyal Guru β and it is the state the checkout reads a few minutes later, whether that checkout is a till or an e-commerce cart.
It is a separate page because it runs in a different system to the checkout. The checkout never activates a voucher on the customer's behalf; the customer-facing front does, through the Visualization API or the WL App SDK. If your project has no digital front, you can skip this page β When the customer has not pre-activated covers codes presented one at a time instead.
The flowβ
Activation happens entirely before the transaction, between the customer and the app or website. The sequence below shows what it produces β a selection held in Loyal Guru β which is the state the checkout reads later:
The customer's selection persists in Loyal Guru until it is redeemed, deselected, or expires. Nothing else has to be carried to the checkout: the till identifies the customer and asks Loyal Guru what is selected.
Endpointsβ
On the current engine, reads go through GET /discounts and writes keep their dedicated voucher endpoints.
Reading vouchers with GET /discountsβ
GET /discounts is the single read endpoint for rules, coupons and vouchers. The use case is expressed in the query parameters, not in the path:
| Use case | Call |
|---|---|
| Every campaign and voucher available to the customer | GET /discounts?customer_id={id} β mass and loyalty campaigns for the customer's country, plus their targeted vouchers |
| Only the customer's vouchers | Add campaign_audience=targeted |
| Only what the customer activated, valid in this store | GET /discounts?customer_id={id}&location_id={loc}&selected=true |
| Only what the customer has not activated | Same call with selected=false |
| One presented code | GET /discounts?customer_id={id}&location_id={loc}, then match the code against coupon_info.static_code or coupon_info.voucher_info.voucher_code in the response |
customer_code and location_code work in place of customer_id and location_id. selected is only honoured when both a customer and a location are present. Paginate with starting_after, using the next_token_starts_after value from the previous response.
Each returned campaign carries its coupon and voucher state inline, which is what makes a dedicated single-voucher call unnecessary:
coupon_infoβcoupon_id,static_code,coupon_name,external_id,keycoupon_info.voucher_infoβvoucher_id,voucher_code,status,selected,available_redemptions,max_redemptions,available_from/available_to,print_from/print_to,priority,printable
GET /discounts has no code filter. To check a single presented code you retrieve the customer's campaigns for the store and locate the code in the response β there is no code query parameter. Confirm the expected pattern with the Loyal Guru project team before building a per-code validation step.
Writing β activation, holds and printingβ
These keep their own endpoints on the current engine:
| Endpoint | Purpose |
|---|---|
POST /vouchers/{code}/select | Activate one voucher. |
PUT /vouchers/select | Activate a list of vouchers in one call. |
POST /vouchers/{code}/deselect | Deactivate one voucher. |
PUT /vouchers/deselect | Deactivate a list of vouchers in one call. |
POST /vouchers/{code}/freeze / POST /vouchers/{code}/unfreeze | Put a voucher on hold. A frozen voucher is neither printed nor redeemable until it is unfrozen. This is an operational hold, not a customer action β use it for fraud review or a campaign paused mid-flight. |
POST /vouchers/print | Get the batch of vouchers to print on the receipt. |
GET /customers/{id}/vouchers, GET /customers/{id}/vouchers/selected and GET /vouchers/{code} are deprecated. Do not use them in a new integration.
Full schemas: Discount endpoints and Voucher endpoints.
Why activation matters at checkoutβ
Activation is not cosmetic. It is what gives the checkout a cheap, unambiguous answer to "which vouchers does this customer want to use right now?" β and each model consumes that answer differently.
| Model | How the checkout consumes the selection |
|---|---|
| Promo Engine | Send coupons_desired: "selected" on the cart. Loyal Guru resolves the selected vouchers itself; the POS never lists or names them. |
| Coupon Server | Call GET /discounts?customer_id={id}&location_id={loc}&selected=true, then apply those vouchers in your own pricing logic. |
The difference is only who reads the list. In both cases the selection was made in a digital front, by the customer, before the transaction started β and in both cases the transaction itself can be a physical store, as long as the customer identifies.
If your app shows vouchers but has no activation step, the customer has nothing selected and coupons_desired: "selected" returns no vouchers. Either add the activation call, or use coupons_desired: "all" so Loyal Guru considers every voucher assigned to the customer. Decide this before you build the app screen β it is the same decision on both ends.
When the customer has not pre-activatedβ
Some customers never activate anything in advance. They arrive with a voucher printed on a previous receipt, with a code on a paper mailing, or with a code on their phone screen. That is individual activation, and it does not use this flow at all: the checkout reads the code that was presented and sends it explicitly, one at a time.
- Promo Engine: send the codes in
coupons_desiredas an array β["34433", "465443"]. - Coupon Server: read the customer's campaigns for the store with
GET /discountsand locate the presented code in the response before applying it.
Note that neither path is tied to a channel: pre-activation resolves perfectly well at a physical till, and an individually presented code is not necessarily on paper. Both models document the two paths side by side: see Promo Engine β Two activation paths and Coupon Server β Two activation paths.
Vouchers printed on the receipt are produced by POST /vouchers/print, which returns the batch to print sorted by campaign priority, then voucher priority, then soonest expiry β and marks them as printed so the next call returns a different batch.
Where this runsβ
The activation calls belong to your customer-facing front, not to your checkout middleware:
- Visualization β the API and SDK surface for app and web frontends
- WL App SDK β if you use the Loyal Guru white-label app components
Implementation notesβ
- Always send the store when reading a selection.
selected=trueis only honoured together withlocation_idorlocation_code, and voucher validity is location-scoped β the same selection can be valid in one store and not in another. - Re-read the selection at the till, do not cache it from the app session. The customer may have activated a voucher after the app screen was rendered, or on another device.
GET /discountsis paginated. An app screen that only reads the first page silently hides vouchers from customers with many assignments β follownext_token_starts_afterwithstarting_after.- Selecting a voucher does not reserve it against campaign budget. A campaign whose budget runs out between activation and checkout will reject the voucher at the till β handle that response rather than assuming activation guarantees the discount.
- Deselection is the customer's action; freeze is yours. Do not use freeze to model "the customer turned it off" β a frozen voucher also stops being printed.
Troubleshootingβ
| Symptom | What to check |
|---|---|
Voucher shows in the app but not in GET /discounts with selected=true | It was never activated, or the location_id sent at checkout is outside the voucher's location scope. |
coupons_desired: "selected" applies nothing | Confirm the app actually calls select, and that it does so against the same customer identifier the cart sends. |
| A voucher disappeared from the app | Check status β it may be redeemed, expired, cancelled, or frozen by an operator. |
| Activation succeeds but the discount is rejected at the till | Campaign budget, total usage, or the customer's redemption limit was reached between activation and checkout. |