> For the complete documentation index, see [llms.txt](https://docs.digitalriver.com/commerce-api-references/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.digitalriver.com/commerce-api-references/warnings-and-error-codes/error-codes/error-codes-for-shopper-apis/412-precondition-failed.md).

# 412 Precondition Failed

When you use a web API or service, you might get different status codes that tell you whether your request was successful. One of these status codes is `412 Precondition Failed`. This code means the server couldn't process your request because one or more of the conditions you specified in the request headers were false. These conditions ensure that the data is consistent and correct.

If you see a `412` error, you should look closer at the conditions specified in the request. These conditions include version checks, modifications made since a certain date, or other requirements the request must meet before the operation succeeds. It's important to understand the cause of the `412` error so you can fix it and use the web service or API.

## `invalid-discount`

The value of the discount is invalid. The possible error descriptions are as follows:

* `The discount value is invalid. Provide a valid discount value and try again.`The discount value is invalid for one of the following reasons:
  * The value of `discount` is less than 0
  * The value of `discount` is over the maximum value of DOUBLE when `discountType` is `amountOff`.
  * The value of `discount` is greater than 100 when `discountType` is `percentOff`.

## `invalid-discount-type`

The value of the discount type is invalid. The possible error descriptions are as follows:

* `The offer discount type is invalid. Provide a valid offer discount type and try again.`The value of `discountType` shall be `amountOff` or `percentOff`.

## `invalid-product-id`

The product ID is invalid. The possible error descriptions are as follows:

* `The product ID or product external reference ID is invalid. Provide the correct product ID or product external reference ID and try again.`The product ID or product for external reference ID is invalid.

## `no-discount-or-type`

The validation failed for `discount` or `discountType`. The possible error descriptions are as follows:

* `Either the discount or discount type or both are missing. Include both the discount and discount type in the payload and try again.`Need to provide `discount` and `discountType`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.digitalriver.com/commerce-api-references/warnings-and-error-codes/error-codes/error-codes-for-shopper-apis/412-precondition-failed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
