Skip to content

Validate a coupon against a basket, per line (public)​

POST
/public/coupons/validate

Storefront cart entry. Every line is RE-PRICED server-side with the same rule as checkout — the client never sends a price — then the coupon is evaluated: scope (all / vendor / category incl. sub-categories / brand), minimum on the in-scope subtotal, percent with optional cap or fixed amount, global and per-shopper uses, channel pin, phone reservation. The discount is split per line in millimes. Nothing is reserved: POST /checkout with couponCode re-evaluates and consumes the use atomically.

Errors are HTTP 422 with a readable error.code: not_found (unknown, disabled, or reserved to another phone — no existence leak), expired, min_not_reached, not_applicable (out of scope, not yet active, other channel), already_used (global or per-shopper cap), phone_required (a once-per-shopper code with neither a customer token nor a phone), line_unavailable. The channel is resolved server-side like checkout (wildkard on the default marketplace), never from the body.

The marketplace is resolved from the host, never the body. A customer token (optional) counts the per-customer cap on that customer.

Auth: Public (customer Bearer JWT optional).

Authorizations​

or
bearerAuth

Jeton client obtenu par POST /auth/login (ou /auth/register), renouvelé par POST /auth/refresh.

Type
HTTP (bearer)

Request Body​

application/json
JSON
{
  
"code": "string",
  
"lines": [
  
  
{
  
  
  
"productId": "string",
  
  
  
"variantId": "string",
  
  
  
"vendorId": "string",
  
  
  
"quantity": 0,
  
  
  
"bundleId": "string"
  
  
}
  
],
  
"phone": "string"
}

Responses​

The code applies — per-line quote

application/json
JSON
{
  
"ok": true,
  
"data": {
  
  
"valid": true,
  
  
"code": "string",
  
  
"type": "percent",
  
  
"fundedBy": "platform",
  
  
"freeShipping": true,
  
  
"subtotal": 0,
  
  
"eligibleSubtotal": 0,
  
  
"discountAmount": 0,
  
  
"lines": [
  
  
  
{
  
  
  
  
"productId": "string",
  
  
  
  
"variantId": "string",
  
  
  
  
"vendorId": "string",
  
  
  
  
"quantity": 0,
  
  
  
  
"unitPrice": 0,
  
  
  
  
"lineTotal": 0,
  
  
  
  
"eligible": true,
  
  
  
  
"discountAmount": 0
  
  
  
}
  
  
]
  
}
}

Playground​

Body

Samples​

Powered by VitePress OpenAPI

Tarifs : contactez-nous — contact@marketkit.ai