API ReferenceapicommercePOST /v1/promo-codes/validate

POST /v1/promo-codes/validate

Service: commerce · operationId: (none)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "minLength": 1
    },
    "cart_subtotal_cents": {
      "type": "integer",
      "minimum": 0
    }
  },
  "required": [
    "code"
  ]
}

Responses

200 Promo code is valid

{
  "type": "object",
  "properties": {
    "valid": {
      "type": "boolean",
      "enum": [
        true
      ]
    },
    "code": {
      "type": "string"
    },
    "discount": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "amount_off_cents": {
          "type": "integer",
          "minimum": 0
        },
        "percent_off": {
          "type": "integer",
          "minimum": 1,
          "maximum": 100
        }
      },
      "required": [
        "label"
      ]
    }
  },
  "required": [
    "valid",
    "code",
    "discount"
  ]
}

400 Validation error

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

404 Promo code is not valid

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

412 Promo code preconditions not met (e.g., minimum subtotal)

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://commerce.platform.loop.health/v1/promo-codes/validate \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'