> This page is for API Reference.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://fiftytwo-demo.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://fiftytwo-demo.ferndocs.com/_mcp/server.

# Save order to database

POST https://api.fiftytwo.com/order/orders/v1
Content-Type: text/xml

Order ID will be generated if not found in the order request

Reference: https://fiftytwo-demo.ferndocs.com/api/order/reference/orders/save-order-to-database

## Request

### Body (text/xml)

This endpoint expects an order.

- `header` (orderHeader, optional)
- `additional` (orderAdditional, optional)
- `customer` (orderCustomer, optional)
- `collect` (orderCollect, optional)
- `customerregistered` (orderCustomerregistered, optional)
- `coupons` (list of orderCoupon, optional, nullable)
- `details` (list of orderItem, optional, nullable)

## Response

### 200

Success

## Types

### orderHeader

- `chain` (string, optional, nullable)
- `store` (string, optional, nullable)
- `orderid` (string, optional, nullable)
- `clientid` (string, optional, nullable)
- `fixedorder` (boolean, optional)
- `fixedorderSpecified` (boolean, optional)

### orderAdditional

- `remark` (string, optional, nullable)
- `channel` (string, optional, nullable)
- `reference` (string, optional, nullable)
- `externalcustomerid` (string, optional, nullable)

### orderCustomer

- `name` (string, optional, nullable)
- `attention` (string, optional, nullable)
- `address1` (string, optional, nullable)
- `address2` (string, optional, nullable)
- `zipcode` (string, optional, nullable)
- `countrycode` (string, optional, nullable)
- `phone` (string, optional, nullable)
- `mail` (string, optional, nullable)

### orderCollect

- `chain` (string, optional, nullable)
- `store` (string, optional, nullable)
- `date` (datetime, optional)
- `from` (datetime, optional)
- `to` (datetime, optional)
- `location` (string, optional, nullable)

### orderCustomerregistered

- `id` (string, optional, nullable)
- `type` (string, optional, nullable)
- `subtype` (string, optional, nullable)
- `clublist` (string, optional, nullable)

### orderCoupon

- `id` (string, optional, nullable)
- `isunique` (string, optional, nullable)
- `value` (double, optional)
- `valueSpecified` (boolean, optional)
- `barcode` (string, optional, nullable)
- `discountamount` (double, optional)

### orderItem

- `vat` (vatType, optional)
- `linkeditem` (list of itemType, optional, nullable)
- `discount` (list of discountType, optional, nullable)
- `potentialdiscountgroups` (list of string, optional, nullable)
- `additionalItemInformation` (list of orderItemAdditionalItemInformation, optional, nullable)
- `number` (string, optional, nullable)
- `quantity` (double, optional)
- `totalprice` (double, optional)
- `description` (string, optional, nullable)
- `unitprice` (double, optional)
- `agerestricted` (string, optional, nullable)

### vatType

- `percent` (double, optional)
- `amount` (double, optional)

### itemType

- `vat` (vatType, optional)
- `discount` (list of discountType, optional, nullable)
- `potentialdiscountgroups` (list of string, optional, nullable)
- `linkeditem` (list of itemType, optional, nullable)
- `additionalItemInformation` (list of itemTypeAdditionalItemInformation, optional, nullable)
- `number` (string, optional, nullable)
- `quantity` (double, optional)
- `totalprice` (double, optional)
- `description` (string, optional, nullable)
- `unitprice` (double, optional)
- `agerestricted` (string, optional, nullable)

### discountType

- `discountgroup` (string, optional, nullable)
- `family` (string, optional, nullable)
- `discounttype` (string, optional, nullable)
- `amount` (double, optional)
- `couponid` (string, optional, nullable)

### orderItemAdditionalItemInformation

- `type` (string, optional, nullable)
- `information` (string, optional, nullable)

### itemTypeAdditionalItemInformation

- `type` (string, optional, nullable)
- `information` (string, optional, nullable)

## Examples

**Request**

```json
{}
```

**Response**

```json
{}
```

**SDK Code**

```python
import requests

url = "https://api.fiftytwo.com/order/orders/v1"

payload = "{}"
headers = {"Content-Type": "text/xml"}

response = requests.post(url, data=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.fiftytwo.com/order/orders/v1';
const options = {method: 'POST', headers: {'Content-Type': 'text/xml'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.fiftytwo.com/order/orders/v1"

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "text/xml")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.fiftytwo.com/order/orders/v1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'text/xml'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.fiftytwo.com/order/orders/v1")
  .header("Content-Type", "text/xml")
  .body("{}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fiftytwo.com/order/orders/v1', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'text/xml',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.fiftytwo.com/order/orders/v1");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "text/xml");
request.AddParameter("text/xml", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "text/xml"]

let postData = NSData(data: "{}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fiftytwo.com/order/orders/v1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```