Skip to content

How to work with the voucher service (discover.swiss Vouchers)

The voucher service lets partners create and manage their own vouchers directly on the discover.swiss platform — without an external voucher system. A voucher definition (template) describes value and usage rules; codes (voucher instances) are generated from it, individually or in bulk.

Guests redeem the codes in the discover.swiss marketplace checkout, or partners redeem them directly through this API (e.g. in a POS or web shop integration).

Business overview: discover.swiss Vouchers

Onboarding

Voucher functionality must be granted on your subscription (consumed service). Contact discover.swiss support to get access, then create a voucher definition via the partner portal or this API. Partner management functions are marked partner in the OpenAPI description.

Environments and authentication

The API is exposed at https://api.discover.swiss/{env}/voucher (dev, test, prod).

Calls need your APIM subscription key plus the caller identity headers:

Header Description
Ocp-Apim-Subscription-Key Your APIM subscription key

The subscription identifies the channel: each check/redeem/refund call is evaluated against the voucher definition's channels list.

Concepts

Definition and instance

  • voucherdefinitions hold the template: value (valueInChf or discountPercent), channels, restrictions (products, services), limits, validity, customerIdentification (email/profile) and customerLimit.
  • voucherinstances are the generated codes: code, initialBalance, currentBalance, status (Issued/PartiallyRedeemed/Redeemed/Invalidated), redemptionInfo (redeemedQuantity, redeemedValue, lastRedemptionDate).

Check – redeem – refund

The runtime endpoints are POST vouchers/check, POST vouchers/redeem, POST vouchers/refund.

Check validates a code for the current channel and computes coverage per requested item without changing state. It never reveals whether the code exists — a check on an unknown code succeeds with redeemable: false, so it cannot be used to guess codes. Response messages[] always contains a code (stable identifier like VoucherNotFound, CodeExpired, UsageLimitReached, NoVoucherDefinedCoverage) and a localized text. Items carry coveredQuantity/uncoveredQuantity; the skeleton is normalized to one entry per unit and capped at 100 items. The item source must be the order item's main source — multiple sources per order item are not supported.

Redeem commits the same skeleton: amounts are converted to the voucher currency (currency conversion is applied — pass prices in the item currency), balance is reserved, an append-only redemption record is written and remaining balances are persisted atomically. Voucher instances can cover fewer units than the skeleton allows — redeemFullAmount on the request decides whether the redemption fails or just covers less. redeemKey is caller-defined and idempotent: retrying with the same key replays the stored response instead of redeeming twice.

Refund reverses a redemption (full or partial by items/quantity): the reservation is released, balances are restored and the status recomputes (there is no Refunded status — a fully refunded voucher becomes Issued again). refundKey is likewise idempotent.

Rate limits and concurrency

Check and redeem are rate-limited because codes are dictionary-guessable. Concurrent requests against the same code may return ConcurrencyConflict (409) — the message text tells the caller to retry.

Percentage vouchers

If the definition has a discountPercent, the covered amount per unit is unit price × percent (half-up rounded at currency precision), not the balance. currentBalance still decreases by the covered value.

Multilanguage messages

messages[].text in check/redeem/refund responses is localized from the Accept-Language request header. Supported: de, en, fr, it (regional variants like de-CH and q-values are honored); fallback is en. The code field is language-neutral — use it, never the text, for logic. Texts may contain placeholders such as the channel name or a validity date.

Hiding amounts and per-item display

Definitions can set hideAmount (don't expose value/balance to the guest) and showAmountOnItem (the marketplace response then exposes per-item covered amounts in orderItemPaymentDetails on the voucher payment detail — see vouchers in the B2C marketplace).

Endpoint overview

Area Routes
Definitions GET/POST voucherdefinitions, GET/DELETE voucherdefinitions/{definitionKey}, GET {definitionKey}/codes, GET {definitionKey}/trail
Instances GET voucherinstances, GET voucherinstances/{code}, POST {code}/distribute, POST {code}/redeem, POST {code}/refund, POST {code}/invalidate, POST voucherinstances/bulk/invalidate, GET voucherinstances/{code}/trail
Runtime POST vouchers/check, POST vouchers/redeem, POST vouchers/refund
Info GET voucherredemptions, GET vouchers/search, POST vouchers/search, GET status, GET status/about

All partner endpoints use the caller's partner scope; a caller only sees and operates its own definitions and instances. voucherinstances/{code}/redeem|refund manage individual redemptions; distribute marks a code as handed out; invalidate permanently disables a code (or a whole definition's codes in bulk).

Error handling

  • 400 – validation (missing headers, malformed body); response detail lists the problems
  • 401/403 – no subscription key, or subscription not entitled (ds-24-vouchers grant missing, or channel not in the definition's channels)
  • 404 – definition/instance not found or not owned by the caller
  • 409 – concurrency conflict or voucher locked (another check/redeem running or expired checkLock); retry
  • 502 – the service could not process the request (e.g. channel not resolvable)