API ReferenceapipaymentsPOST /v1/promos/validate

POST /v1/promos/validate

Service: payments · operationId: (none)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "minLength": 1
    },
    "cart_total_cents": {
      "type": "integer",
      "exclusiveMinimum": 0
    },
    "plan_id": {
      "type": "string"
    }
  },
  "required": [
    "code"
  ]
}

Responses

200 Promo validation result

{
  "type": "object",
  "properties": {
    "valid": {
      "type": "boolean"
    },
    "discount": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "percent_off": {
          "type": "number"
        },
        "amount_off": {
          "type": "number"
        },
        "label": {
          "type": "string"
        }
      },
      "required": [
        "label"
      ]
    },
    "expires_at": {
      "type": "string"
    },
    "reason": {
      "type": "string"
    }
  },
  "required": [
    "valid",
    "discount"
  ]
}

400 Validation error

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

429 Too many promo validations

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

502 Stripe error

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

Example

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