Panelr

Validate Coupon

GET ?action=validate_coupon

Would this coupon work right now — and for how much? For a storefront to check a code before checkout. A code that doesn't work still answers 200 with valid: false and the reason, so the storefront can show it to the customer. To actually spend the coupon, pass coupon_code to create_work_order or complete_order — those fail loudly on a bad code, because at that point it changes what the customer pays.

Request Parameters

FieldTypeRequiredDescription
codestringRequiredThe coupon code — matched case-insensitively
totaldecimalOptionalThe order's money total — send it to get the exact discount back
customer_emailstringOptionalThe customer — enforces a once-per-customer limit

Response Fields

FieldTypeDescription
codestringThe code, normalized to uppercase
validbooleanWhether it currently works for this customer
reasonstringOnly when valid is false — why not, in customer-facing words
labelstringHow the discount reads, e.g. "10% off"
mode / valuestring / decimalpercent or fixed, and the number behind it
discountdecimal|nullThe exact discount for the total you sent — null when no total was sent
expires_atstring|nullWhen it stops working, if it does