---
id: setordernumber
title: Set order number
hide_title: true
description: "Set a new order number on an invoice"
---

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="Set Order Number">

Provides the possibility to set a new Order number for a specific invoice. The order number can be used to search for a specific order in the Walley Merchant Hub.

</Ingress>

The invoice number is the number returned in the AddInvoice response.

:::info Please Note
It is only possible to set a new order number on an invoice in state Pending. Activated invoices cannot be updated with a new order number.
:::

### Request Parameters

| Field          | Occurs | nullable | Max | Type   | Description                                                                                                     |
| -------------- | ------ | -------- | --- | ------ | --------------------------------------------------------------------------------------------------------------- |
| Password       | 1      | false    | 50  | string | The password used to authorize the request.                                                                     |
| Username       | 1      | false    | 50  | string | The username 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 country.                                                              |
| InvoiceNo      | 1      | false    | 10  | string | The invoice number returned from AddInvoice                                                                     |
| NewOrderNumber | 1      | false    | 20  | string | The order's new identification that can be used to search for a<br />specific order in the Walley Merchant Hub. |
| StoreId        | 1      | true     | -   | int    | The StoreId used for identification of store.                                                                   |

### Response Parameters

| Field         | Occurs | nullable | 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:    | SetOrderNumber                                                             |
| Description: | The operation sets a new or updates an existing order number of an invoice |
| Notes:       | N/A                                                                        |

<Tabs defaultValue="reqB2C" values={[
{ label: 'B2C Request', value: 'reqB2C', },
{ label: 'B2C 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:SetOrderNumberRequest>
         <!--Optional:-->
         <pay:CorrelationId>dff41cfc-5c36-4c10-9573-3a2c4c695d31</pay:CorrelationId>
         <!--Optional:-->
         <pay:CountryCode>SE</pay:CountryCode>
         <!--Optional:-->
         <pay:InvoiceNo>68223728</pay:InvoiceNo>
         <!--Optional:-->
         <pay:NewOrderNumber>Order123456</pay:NewOrderNumber>
         <!--Optional:-->
         <pay:StoreId>1234</pay:StoreId>
      </pay:SetOrderNumberRequest>
   </soapenv:Body>
</soapenv:Envelope>


```

</TabItem>
<TabItem value="resB2C">

```xml

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Body>
      <SetOrderNumberResponse xmlns="http://schemas.ecommerce.collector.se/v30/PaymentService">
         <CorrelationId>dff41cfc-5c36-4c10-9573-3a2c4c695d31</CorrelationId>
      </SetOrderNumberResponse>
   </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 |
| INVOICE_NOT_FOUND                  | The specified invoice number cannot be found                                                       |
| VALIDATION_COUNTRY_CODE_REQUIRED   | Country code is not provided in the request                                                        |
| VALIDATION_INVOICE_NUMBER_REQUIRED | Invoice number is ont provided in the request                                                      |
