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

# Finalize processing Order

POST https://restapi.ordergroove.com/orders/{order_id}/finalize_placement/
Content-Type: application/json

Finalizes an order whose placement response was `PROCESSING` rather than a final result. Once processing is complete on your side, send the final order placement response here. The order must have status `10` (processing), `13` (connection error), or `9` (pending batch response).

A `400` response carries an `error_code`:

- `1`: a required field is missing.
- `2`: `response_xml` isn't valid XML.
- `3`: the order's status doesn't allow finalizing. If the order is still pending placement (status `11`), `retry` is `true` and you can send the request again later.
- `4`: `response_xml` is valid XML but doesn't follow the order placement response format.

Reference: https://developer.ordergroove.com/reference/rest-rpc-api/orders/finalize-processing-order

## Authentication

- `x-api-key` header (required) — Application API Scope — server-to-server, sent in the `x-api-key` header. See [Authentication](/api-reference/authentication).

## Request

### Path parameters

- `order_id` (string, required) — Unique order ID

### Body (application/json)

This endpoint expects an object.

- `processing_response_id` (string, required) — The order ID your system returned with the `PROCESSING` response
- `response_xml` (string, required) — The final order placement response, in the XML format described in [Recurring Order Placement](/lifecycle/order/recurring-placement#order-placement-response)
- `idempotency_key` (string, required) — A unique key for this response

## Response

### 200

200

- `order` (string, optional) — Public ID of the order
- `merchant` (string, optional) — Public ID of the merchant
- `status` (integer, optional) — Order status code after the response is processed. See [Order Status Codes](/api-reference/order-status-codes).
- `display_status` (string, optional) — Name of the order status
- `error_code` (integer, optional, nullable) — `null` on success. See the endpoint description for the `400` codes.
- `error_message` (string, optional, nullable) — `null` on success, otherwise what went wrong
- `retry` (boolean, optional) — Whether you can send this request again later
- `currency_units_per_merchant_currency_unit` (double, optional)

## Errors

### 400 Bad Request Error

The request couldn't be processed. See the endpoint description for each `error_code`.

- `order` (string, optional) — Public ID of the order
- `merchant` (string, optional) — Public ID of the merchant
- `status` (integer, optional) — Order status code after the response is processed. See [Order Status Codes](/api-reference/order-status-codes).
- `display_status` (string, optional) — Name of the order status
- `error_code` (integer, optional, nullable) — `null` on success. See the endpoint description for the `400` codes.
- `error_message` (string, optional, nullable) — `null` on success, otherwise what went wrong
- `retry` (boolean, optional) — Whether you can send this request again later
- `currency_units_per_merchant_currency_unit` (double, optional)

### 404 Not Found Error

No order with this ID for your merchant

## Examples

**Request**

```json
{
  "processing_response_id": "string",
  "response_xml": "string",
  "idempotency_key": "string"
}
```

**Response**

```json
{
  "order": "c4e05d04ccc411e8ada3bc764e101db1",
  "merchant": "ac4f7938383a11e89ecbbc764e1107f2",
  "status": 5,
  "display_status": "SUCCESS",
  "error_code": null,
  "error_message": null,
  "retry": false,
  "currency_units_per_merchant_currency_unit": 1
}
```

**SDK Code**

```python Result
import requests

url = "https://restapi.ordergroove.com/orders/order_id/finalize_placement/"

payload = {
    "processing_response_id": "string",
    "response_xml": "string",
    "idempotency_key": "string"
}
headers = {
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Result
const url = 'https://restapi.ordergroove.com/orders/order_id/finalize_placement/';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"processing_response_id":"string","response_xml":"string","idempotency_key":"string"}'
};

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

```go Result
package main

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

func main() {

	url := "https://restapi.ordergroove.com/orders/order_id/finalize_placement/"

	payload := strings.NewReader("{\n  \"processing_response_id\": \"string\",\n  \"response_xml\": \"string\",\n  \"idempotency_key\": \"string\"\n}")

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

	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://restapi.ordergroove.com/orders/order_id/finalize_placement/")

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

request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"processing_response_id\": \"string\",\n  \"response_xml\": \"string\",\n  \"idempotency_key\": \"string\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://restapi.ordergroove.com/orders/order_id/finalize_placement/")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"processing_response_id\": \"string\",\n  \"response_xml\": \"string\",\n  \"idempotency_key\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://restapi.ordergroove.com/orders/order_id/finalize_placement/', [
  'body' => '{
  "processing_response_id": "string",
  "response_xml": "string",
  "idempotency_key": "string"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
  ],
]);

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

```csharp Result
using RestSharp;

var client = new RestClient("https://restapi.ordergroove.com/orders/order_id/finalize_placement/");
var request = new RestRequest(Method.POST);
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"processing_response_id\": \"string\",\n  \"response_xml\": \"string\",\n  \"idempotency_key\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Result
import Foundation

let headers = [
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "processing_response_id": "string",
  "response_xml": "string",
  "idempotency_key": "string"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://restapi.ordergroove.com/orders/order_id/finalize_placement/")! 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()
```