Entrar

Buscar cupón por código — código promocional / voucher de descuento

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

Returns the best coupon batch for the current cart based on the active redemption policy. The service:

  1. Lists all coupon batches available for the store's policy.
  2. Computes the discount each batch would generate (fixed value or percent over total_item).
  3. Picks the highest-pass match (the lowest discount that still covers redeemableTotal). If no batch covers it, falls back to the closest low-pass match (the highest discount under redeemableTotal).

Use the returned couponBatchId with Coupon reserve to lock a code for the transaction. Monetary fields (total_item, redeemableTotal) are sent as integer cents — see Monetary values.

Try-it values populated from environment ACME (Demo)


Autenticación

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.

Encabezados

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.

Cuerpo de la petición

Content-Type: application/json

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

Respuestas

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