# 提交批发订单（提交后不能再改明细）

`POST /api/v1/orders/{order_id}/submit` — 需要 token · order:submit · 写操作 · 2 点

批发订单

提交批发订单（提交后不能再改明细）。payment_method 默认 invoice（按发票付款）

## 路径参数

| 名称 | 类型 | 说明 |
| --- | --- | --- |
| `order_id` **必填** | string | 批发订单号，从订单列表拿到。只能查本渠道自己的单。 (最长 64) |

## 请求体（JSON）

| 字段 | 类型 | 说明 |
| --- | --- | --- |
| `payment_method` | string | 付款方式：balance 余额 / invoice 按发票付款 / wechat 微信 / alipay 支付宝。不传默认 invoice（按发票付款，也就是月结）。 |
| `use_reservation` | boolean | 是否动用你的锁单（预留库存）来配这批货。不传 = 不动用。 |

## 响应

响应信封只看 HTTP 状态码：成功是 2xx，正文 `{ data: … }`（列表另带 `page / page_size / has_more` 或 `total_count`）；失败是 4xx / 5xx，正文 `{ error: { code, message, hint, request_id, doc_url } }`。

```json
{
  "data": { … }
}
```

成功响应里没有任何给人看的文字——没有 `code / result / msg`。`error.code` 是唯一该用程序判断的字段，`message` 跟随 `Accept-Language`。

> 写操作请带 `Idempotency-Key` 头（任意唯一串，如 UUID）：网络重试不会重复下单。下单默认只建草稿，由人在 ERP 确认后生效。

## 示例

### curl

```bash
curl -X POST "https://connect.everugg.net.au/api/v1/orders/{order_id}/submit" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <uuid>" \
  -d '{ "payment_method": "<payment_method>", "use_reservation": false }'
```

### Python

```python
import requests

r = requests.post(
    "https://connect.everugg.net.au/api/v1/orders/{order_id}/submit",
    headers={"Authorization": "Bearer " + TOKEN, "Idempotency-Key": str(uuid.uuid4())},
    json={
      "payment_method": "<payment_method>",
      "use_reservation": False
    },
)
data = r.json()
r.raise_for_status()  # 4xx/5xx: data["error"]["code"] / ["hint"]
```

### Node

```js
const res = await fetch("https://connect.everugg.net.au/api/v1/orders/{order_id}/submit", {
  method: "POST",
  headers: { Authorization: `Bearer ${TOKEN}`, "Content-Type": "application/json", "Idempotency-Key": crypto.randomUUID() },
  body: JSON.stringify({
    "payment_method": "<payment_method>",
    "use_reservation": false
  }),
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.error?.code}: ${data.error?.message}`)
```

### Java

```java
HttpRequest req = HttpRequest.newBuilder()
    .uri(URI.create("https://connect.everugg.net.au/api/v1/orders/{order_id}/submit"))
    .header("Authorization", "Bearer " + token)
    .header("Content-Type", "application/json")
    .header("Idempotency-Key", UUID.randomUUID().toString())
    .POST(HttpRequest.BodyPublishers.ofString("{ \"payment_method\": \"<payment_method>\", \"use_reservation\": false }"))
    .build();
HttpResponse<String> res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
```

---
Markdown 源: https://connect.everugg.net.au/reference/post-api-v1-orders-order-id-submit.md?lang=zh · 网页版: https://connect.everugg.net.au/reference?op=post-api-v1-orders-order-id-submit&lang=zh
