▫️Discount Discover

/discount/calc-disc

This endpoint calculates the discount percentage based on the original price and the discounted price provided in the query parameters. It returns the original price, discounted price, and the calculated discount percentage. If any of the parameters are missing, not numbers, or the discounted price is greater than or equal to the original price, it returns a 400 error with a corresponding message.

Query Parameters

ParameterTypeDescription

originalPrice

number

The original price of the product or service.

discountedPrice

number

The discounted price of the product or service.

Response

{
  "originalPrice": "number",
  "discountedPrice": "number",
  "discountPercentage": "string"
}

Last updated