> For the complete documentation index, see [llms.txt](https://docs.unimarket.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unimarket.com/documentation/master-data/validate-account-codes-budget-check.md).

# Validate Account Codes (Budget Check)

The **Validate Account Code** integration allows Unimarket to request real-time verification of accounting information (such as FOPAL or ledger data), from an external ERP or Finance system during the checkout process. This ensures that the buyer is authorized to use specific accounts, the account combinations are correct, and there is sufficient budget available.

{% hint style="info" %}
For a breakdown of the different ways this integration can be implemented (stored procedure vs. budget table lookup), see [Integration Options for Validate Account Code (Budget Check) Integration](/documentation/transactions-orders-receipts-invoices-and-more/validate-account-code-budget-check-options.md).
{% endhint %}

## How it Works

This is a **synchronous** integration point, meaning the external system must respond while the user is actively waiting in the checkout process. A rapid response time is essential to prevent system timeouts and ensure a smooth user experience.

## Request Data

For every line item on a requisition, Unimarket sends the following key data to the ERP for validation:

* **Line Details**: Line number, quantity, and product code (SKU).
* **Pricing**: Unit price and the total amount (excluding tax).
* **Accounting**: The specific account code (individual parts) and any account code splits if applicable.

## Response and Results

The external system evaluates the data and responds with one of three statuses for each line item:

| Result      | Outcome                                                                                                                                                          |
| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Valid**   | The line passes validation. If all lines are valid, the requisition proceeds to checkout normally.                                                               |
| **Invalid** | The requisition is stopped. The buyer cannot proceed until the accounting information is corrected.                                                              |
| **Warning** | The requisition remains on the checkout page and displays a message to the user. The user can choose to click checkout again to bypass the warning and continue. |

## Key Response Requirements

The response from the ERP back to Unimarket must include:

* **Line Number**: To identify which item the result applies to.
* **Result Status**: Valid, Invalid, or Warning.
* **Account Code**: The accounting string being validated.
* **Message**: A description (maximum 255 characters) that the buyer will see, such as "Available funds confirmed" or a specific error message.

## Technical Documentation

Detailed XML message examples and technical specifications for this integration can be found in [Integration Technical Documentation Examples](https://help.unimarket.com/hc/en-us/articles/45852222234393-Webservice-Integration-Technical-Documentation-Examples).

#### Sample Request

```xml
<user-ref identity="user" domain="UNIMARKET_USERNAME_DOMAIN"/>
<validate-account-code-request>
  <validate-account-code-line line-number="1" quantity="1" sku="productcode">
    <unit-price iso-currency-code="NZD">10.00</unit-price>
    <total iso-currency-code="NZD">10.00</total>
    <account-code distribution-percentage="60.0" format-ref="format" value="a-b">
      <part description="a description" part="a format">a</part>
      <part description="b description" part="b format">b</part>
    </account-code>
    <account-code distribution-percentage="40.0" format-ref="format" value="c-d">
      <part description="c description" part="c format">c</part>
      <part description="d description" part="d format">d</part>
    </account-code>
    <organisation-unit-ref code="orgunit" organisation-code="org" parent-code="org"/>
  </validate-account-code-line>
</validate-account-code-request>
```

#### Sample Response

```xml
<?xml version="1.0" encoding="UTF-8"?>
<u1.1:validate-account-code-response xmlns:u1.1="http://www.unimarket.com/schema/unimarket-ws-1.1">
  <u1.1:response code="OK"/>
  <u1.1:account-code-validation line-number="1" result="VALID">
    <u1.1:account-code value="partA1-partA2-partA3-partA4" format-ref="formatcodea"/>
    <u1.1:message>partA1-partA2-partA3-partA4 is valid</u1.1:message>
  </u1.1:account-code-validation>
  <u1.1:account-code-validation line-number="1" result="VALID">
    <u1.1:account-code value="partB1-partB2-partB3-partB4" format-ref="formatcodea"/>
    <u1.1:message>partB1-partB2-partB3-partB4 is valid</u1.1:message>
  </u1.1:account-code-validation>
  <u1.1:account-code-validation line-number="2" result="INVALID">
    <u1.1:account-code value="partB1-partB2-partB3-partB4" format-ref="formatcodea"/>
    <u1.1:message>partB1-partB2-partB3-partB4 is invalid</u1.1:message>
  </u1.1:account-code-validation>
  <u1.1:account-code-validation line-number="3" result="INVALID">
    <u1.1:account-code value="partC1-partC2-partC3-partC4" format-ref="formatcodea"/>
    <u1.1:message>partC1-partC2-partC3-partC4 is invalid</u1.1:message>
  </u1.1:account-code-validation>
</u1.1:validate-account-code-response>
```


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.unimarket.com/documentation/master-data/validate-account-codes-budget-check.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
