Entrar

Buscar cupom por código — código promocional / voucher de desconto

POST https://{organization}.myguper.com/api/loyalty/coupon/search

Retorna o melhor lote de cupom para o carrinho atual com base na política de resgate ativa. O serviço:

  1. Lista os lotes disponíveis para a política da loja.
  2. Calcula o desconto que cada lote geraria (valor fixed ou percentual sobre total_item).
  3. Escolhe o "high-pass" (menor desconto que ainda cobre redeemableTotal). Se nenhum lote cobrir, cai para o "low-pass" (maior desconto abaixo de redeemableTotal).

Use o couponBatchId retornado em Reservar cupom para travar um código para a transação. Campos monetários (total_item, redeemableTotal) são enviados como inteiros em centavos — veja Valores monetários.

Try-it values populated from environment ACME (Demo)


Autenticação

Token

Send your user token in the x-guper-authorization header. Endpoints that support a Public mode (e.g. acúmulo and resgate previews) accept the same request without the header — Private mode adds customer data and a confirmation token to the response.

Cabeçalhos

Name Type Description
x-guper-authorization * string User token issued by Guper. Omit only on endpoints that explicitly support a Public mode.
Content-Type * string Always `application/json` for endpoints that accept a JSON body.

Corpo da requisição

Content-Type: application/json

{
    "interface": "generic",
    "storeId": "2",
    "total_item": 25000,                                        // cents
    "redeemableTotal": 25000                                    // cents
}

Respostas

{
    "couponBatchId": 2,
    "policy": 14,
    "description": "Test",
    "type": "fixed",
    "value": 30000,
    "discount": 30000
}
Copied to clipboard