GreenFlow docs

Coupons

Discount coupons plug into /fleet/show (price preview) and /bookings (apply to sale). Validation logic is shared; error reasons are stable.

POST /coupons/validate

Pre-flight check before showing a discount in the UI. Idempotent — it audits each attempt but does not consume a usage slot.

bash
curl -X POST https://greenflow.live/api/v1/coupons/validate \
  -H "Authorization: Bearer gfc_7s2wprmy_DWTZRBGBEV6La4dTOoFdMkEhWmWCsXdwc3zVMnqP" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "SUMMER25",
    "brand": 11,
    "rate": "011880",
    "country_id": 31,
    "days": 3
  }'
json
{
  "data": {
    "code": "SUMMER25",
    "discount_type": "percentage",
    "discount_value": 25.0,
    "currency": null,
    "discount_code": "S25BR",
    "stackable": false
  }
}

Three-step flow

Call POST /coupons/validate from the UI, then pass coupon_code on POST /fleet/show to see the discounted price, and again on POST /bookings to lock it in. The last step is the one that consumes a usage slot.

Errors

HTTPBodyCause
404{"error": "coupon_not_found"}Code doesn't exist.
422{"error": "coupon_not_valid"}Expired, outside window, no uses left.
422{"error": "coupon_brand_or_rate_mismatch"}Brand or rate does not apply.
422{"error": "coupon_country_mismatch"}Country does not apply.
422{"error": "coupon_days_out_of_range"}Days outside min/max.