Skip to content

Validate a promo code

POST
/api/website/promo/validate
curl --request POST \
--url https://api.petanqueai.com/api/website/promo/validate \
--header 'Content-Type: application/json' \
--header 'x-storefront-token: <x-storefront-token>' \
--data '{ "code": "example", "lines": [ { "productId": "example", "quantity": 1 } ], "email": "example" }'

Prices a basket with a promo code so your cart can show the discount before the order is placed. Always answers 200: either valid: true with every line, the discount, shipping and total, or valid: false with a reason (NOT_FOUND, EXPIRED, USED_UP, MIN_BASKET, …) and a message you can show.

Nothing is reserved: placing the order checks the code again. Send email to apply a once-per-shopper limit.

object
code
required
string
>= 1 characters <= 40 characters
lines
required
Array<object>
>= 1 items <= 50 items
object
productId
required
string
>= 1 characters
quantity
required
integer
>= 1
email
string

Example generated

{
"code": "example",
"lines": [
{
"productId": "example",
"quantity": 1
}
],
"email": "example"
}