---
id: adjustinvoice
title: Adjust Invoice
hide_title: true
description: "Adjusting invoices"
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Flag from '../../../../src/components/flag/flag';
import Ingress from '../../../../src/components/ingress/ingress.react';

<Ingress title="Adjust Invoice">
The operation AdjustInvoice is used for adjusting the total invoice amount. The adjusted amount can be both negative and positive.
</Ingress>

A negative adjustment amount <i>cannot</i> be greater than the amount of the invoice.
To make several adjustments at the same time, several articles can be added.

:::info Please Note
That positive adjustments may lead to additional credit checks of the customer.
:::

## Parameters

| Field                  | min Occurs | nillable | Max | Type                        | Description                                                                                                 |
| ---------------------- | ---------- | -------- | --- | --------------------------- | ----------------------------------------------------------------------------------------------------------- |
| Username               | 1          | false    | 50  | string                      | The username used to authorize the request.                                                                 |
| Password               | 1          | false    | 50  | string                      | The password used to authorize the request.                                                                 |
| CorrelationId          | 1          | true     | 50  | string                      | CorrelationID is sent back in the response.                                                                 |
| CountryCode            | 1          | false    | 2   | string                      | The country code (ISO 3166-1 alpha-2) for the country.                                                      |
| InvoiceNo              | 1          | false    | 50  | string                      | The invoice number previously returned in AddInvoice.                                                       |
| InvoiceRows            | 1          | false    | -   | [InvoiceRow[]](#invoicerow) | The articles that should be listed on the invoice and <br />contains the quantity and price of the article. |
| PurchaseClassification | 1          | true     | 50  | string                      | This field is used for an alternative credit evaluation. Contact Walley for more details.                   |
| SettlementReference    | 1          | true     | 50  | string                      | Settlement reference added to the return.                                                                   |
| StoreId                | 1          | true     | -   | int                         | The StoreId used for identification of store.                                                               |

#### InvoiceRow

| Parameter    | Required | Type    | Max | Description                                                        |
| :----------- | :------- | :------ | :-- | :----------------------------------------------------------------- |
| ArticleId    | x        | string  | 50  | The ArticleId of the product.                                      |
| Description  | x        | string  | 50  | The description of the product.                                    |
| Quantity     | x        | int     | 8   | The quantity of the product. 1-99999999 (0 not allowed)            |
| QuantityUnit | -        | string  | 50  | The quantity unit of the product, e.g. pcs, meter, number, kg etc. |
| UnitPrice    | x        | decimal | 6,2 | Price per unit incl. VAT.                                          |
| VAT          | x        | decimal | 6,2 | VAT in per cent                                                    |

## Response

| Field         | min Occurs | nillable | Max | Type   | Description                            |
| ------------- | ---------- | -------- | --- | ------ | -------------------------------------- |
| CorrelationId | 1          | true     | 50  | string | CorrelationID from the request if any. |

### Example Requests

| &nbsp;       | Value                                                              |
| ------------ | :----------------------------------------------------------------- |
| Environment: | UAT                                                                |
| Service:     | PaymentService                                                     |
| URL:         | https://ecommercetest.collector.se/v3.0/PaymentServiceV10.svc?wsdl |
| Function:    | AdjustInvoice                                                      |
| Description: | AdjustInvoice is used to update an invoice                         |
| Notes:       | N/A                                                                |

<Tabs defaultValue="reqB2C" values={[
{ label: 'Request', value: 'reqB2C', },
{ label: 'Response', value: 'resB2C', }]}>
<TabItem value="reqB2C">

```xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                	xmlns:pay="http://schemas.ecommerce.collector.se/v30/PaymentService">
	<soapenv:Header>
		<pay:Username>USERNAME</pay:Username>
		<pay:Password>PASSWORD</pay:Password>
	</soapenv:Header>
	<soapenv:Body>
		<pay:AdjustInvoiceRequest>
			<pay:CorrelationId>AdjustInvoiceV10</pay:CorrelationId>
			<pay:CountryCode>SE</pay:CountryCode>
			<pay:InvoiceNo>62366754</pay:InvoiceNo>
			<pay:InvoiceRows>
				<!--Zero or more repetitions:-->
				<pay:InvoiceRow>
					<pay:ArticleId>123456</pay:ArticleId>
					<pay:Description>Article 123456</pay:Description>
					<pay:Quantity>10</pay:Quantity>
					<pay:QuantityUnit>pcs</pay:QuantityUnit>
					<pay:UnitPrice>100</pay:UnitPrice>
					<pay:VAT>25</pay:VAT>
				</pay:InvoiceRow>
				<pay:InvoiceRow>
					<pay:ArticleId>123</pay:ArticleId>
					<pay:Description>Discount on article 123456</pay:Description>
					<pay:Quantity>1</pay:Quantity>
					<pay:UnitPrice>-100</pay:UnitPrice>
					<pay:VAT>25</pay:VAT>
				</pay:InvoiceRow>
			</pay:InvoiceRows>
			<pay:PurchaseClassification xsi:nil="true"
                          				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
			<pay:SettlementReference xsi:nil="true"
                       				xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/>
			<pay:StoreId>1234</pay:StoreId>
		</pay:AdjustInvoiceRequest>
	</soapenv:Body>
</soapenv:Envelope>

```

</TabItem>
<TabItem value="resB2C">

```xml
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <AdjustInvoiceResponse xmlns="http://schemas.ecommerce.collector.se/v30/PaymentService">
         <CorrelationId>AdjustInvoiceV10</CorrelationId>
      </AdjustInvoiceResponse>
   </s:Body>
</s:Envelope>
```

</TabItem>
</Tabs>

### Error Codes

| Fault Code                             | Description                                                                                         |
| :------------------------------------- | :-------------------------------------------------------------------------------------------------- |
| AUTHORIZATION_FAILED                   | Could not authorize the request, check your login credentials. Please contact Walley for more help. |
| VALIDATION_COUNTRY_CODE_REQUIRED       | The CountryCode field was not present in the request.                                               |
| VALIDATION_ARTICLE_ID_REQUIRED         | An article is missing its ArticleId.                                                                |
| VALIDATION_QUANTITY_RANGE              | The Quantity field was not within its allowed range.                                                |
| VALIDATION_SETTLEMENT_REFERENCE_LENGTH | The Settlement Reference field was not within its allowed range.                                    |
| INVOICE_NOT_FOUND                      | The invoice number does not exist.                                                                  |

If the error code you are looking for is not in the list above Please see separate page [Error Codes](/docs/paymentsApi/integration/error-codes)
