01.software Docs

validateDiscount

Use the SDK for application integration. This read-only reference covers Commerce, Customer Auth, Membership and Events.

All HTTP operations
POST
/api/discounts/validate

HTTP 200 valid=false is an invalid quote, not an HTTP error. Customer identity comes only from JWT. The response is a quote with eligibility and stacking diagnostics; it does not reserve a discount or grant checkout admission.

Authorization

headerX-Publishable-Key<token>

Tenant publishable key for authentication (sent via X-Publishable-Key header)

Request Body

application/json
  1. body
code*string
Length1 <= length
orderAmount*number
Range0 < value
currency?string
Length3 <= length <= 3
market?string
Length1 <= length
items?array<>

Response Body

Actual shaped success body

application/json
  1. response

HTTP 200 includes valid=false quotes. Legacy producer also emits internal stacking/digest/customer-source evidence; those fields are not a browser-safe DTO promise. See the recorded owning privacy contradiction before strict public projection changes.

valid*boolean
code*string
appliedDiscountId?string
type?string
Value in"percentage""fixed_amount""free_shipping""tiered"
discountAmount*number
freeShipping?boolean
reason?string
reasonCode?string
Value in"discount_code_not_found""discount_not_started""discount_expired""discount_usage_limit""discount_per_customer_limit""discount_customer_required""discount_first_order_only""discount_customer_not_eligible""discount_customer_excluded""discount_items_required""discount_product_not_eligible""discount_product_excluded""discount_min_order_amount""discount_currency_scope_required""discount_allocation_method_unsupported""market_not_found"
[key: string]?any

Examples may be generated from schemas; they are illustrative, not recorded successful API calls. Example snippets may omit required authentication headers.

Example Request
curl -X POST 'https://api.01.software/api/discounts/validate' \  -H 'Content-Type: application/json' \  -d '{  "code": "string",  "orderAmount": 1}'
Example Response
{  "valid": true,  "code": "string",  "appliedDiscountId": "string",  "type": "percentage",  "discountAmount": 0,  "freeShipping": true,  "reason": "string",  "reasonCode": "discount_code_not_found"}