Entrar

Promoção por pedido

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

Calcula os descontos promocionais que se aplicam a um pedido. Cada organização pode ter uma ou mais campanhas ativas avaliadas em ordem de prioridade — a resposta lista todos os descontos que dispararam para o carrinho.

Este endpoint aceita o mesmo corpo do rewardByOrder (veja Acúmulo por pedido) e opera em dois modos: Público (omita o x-guper-authorization) e Privado. Campos monetários (price, listPrice, tax) 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": "sip",
    "storeId": "1",
    "client": "<client>",                                       // optional
    "items": [
        {
            "id": "2",
            "productId": "1",                                   // optional
            "name": "Smartphone Guper MK1",                     // optional
            "categoryId": "20",                                 // optional
            "brandId": "20",                                    // optional
            "sellerId": "1",                                    // optional
            "collection": [                                     // optional
                347,
                336
            ],
            "tax": 1232,                                        // optional, cents
            "quantity": 2,
            "price": 96390,                                     // cents
            "listPrice": 100000                                 // optional, cents
        }
    ],
    "shipping": "<shipping>"                                    // optional
}

Respostas

{
    "discount": [
        {
            "campaign": "NEWPROGRESSIVE2025",
            "description": "Desconto por quantidade de itens",
            "total": 38556,
            "item": [
                { "id": "2", "position": 0, "value": 19278, "quantity": 2 },
                { "id": "3", "position": 1, "value": 19278, "quantity": 1 }
            ]
        }
    ]
}
Copied to clipboard