# Preview Order

> Preview is a **dry-run of [Create Order](https://developer.ghn.vn/en/docs/order/create.md)**: same request body, same validation, same fee/lead-time calculation — but **no order is created**. Use it to show the shipping fee and expected delivery time before the customer confirms.

Shares the request contract with [order/create](https://developer.ghn.vn/en/docs/order/create.md)

## Endpoint

| Environment | URL |
| --- | --- |
| Production | `https://online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/preview` |
| Staging | `https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/preview` |

**Method**: `POST`

## Headers

| Header | Required | Description |
| --- | --- | --- |
| `Content-Type` | Yes | `application/json` |
| `Token` | Yes | Shop token (issued by GHN) — [get a token](https://developer.ghn.vn/en/docs/token/get-token.md) |
| `ShopId` | Yes | Shop ID (int) |

## Parameters

**Identical to [Create Order](https://developer.ghn.vn/en/docs/order/create.md#parameters)** — same fields, same required rules, same defaults. See that page for the full list.

## Request Example

```bash
curl -X POST https://dev-online-gateway.ghn.vn/shiip/public-api/v2/shipping-order/preview \
  -H "Token: 5c1d8a9e-2f4b-11ed-..." \
  -H "ShopId: 92837" \
  -H "Content-Type: application/json" \
  -d '{
    "payment_type_id": 2,
    "required_note": "CHOXEMHANGKHONGTHU",
    "to_name": "Tran Minh Anh",
    "to_phone": "0987654321",
    "to_address": "72 Lê Thánh Tôn, P. Bến Nghé, Quận 1, TP. Hồ Chí Minh",
    "to_ward_name": "Phường Bến Nghé",
    "to_district_name": "Quận 1",
    "to_province_name": "TP. Hồ Chí Minh",
    "weight": 600,
    "length": 25,
    "width": 20,
    "height": 8,
    "service_type_id": 2,
    "content": "GHN unisex t-shirt - 2 pcs"
  }'
```

## Response

Same shape as Create Order, with two differences: `order_code` is **empty** (nothing is created), and there is **no `message_display`** field.

### Success (HTTP 200)

_Captured from a real Staging-environment call._

```json
{
  "code": 200,
  "message": "Success",
  "data": {
    "order_code": "",
    "fee": {
      "main_service": 20900,
      "insurance": 0,
      "cod_fee": 0,
      "station_do": 0,
      "station_pu": 0,
      "return": 0,
      "r2s": 0,
      "return_again": 0,
      "coupon": 0,
      "document_return": 0,
      "double_check": 0,
      "double_check_deliver": 0,
      "pick_remote_areas_fee": 0,
      "deliver_remote_areas_fee": 0,
      "pick_remote_areas_fee_return": 0,
      "deliver_remote_areas_fee_return": 0,
      "cod_failed_fee": 0,
      "change_to_address_fee": 0,
      "change_return_address_fee": 0
    },
    "total_fee": 20900,
    "expected_delivery_time": "2026-07-16T16:59:59Z"
  }
}
```

### Response Fields

| Field | Type | Description |
| --- | --- | --- |
| `code` | Int | HTTP code (`200` on success) |
| `message` | String | Result message (`Success`) |
| `data.order_code` | String | Always empty for preview — no order is created |
| `data.fee` | Object | Fee breakdown (VND) — same components as Create Order |
| `data.total_fee` | Int | Total fee (VND) |
| `data.expected_delivery_time` | String | Expected delivery time (ISO 8601) |

## Error Codes

Same as [Create Order](https://developer.ghn.vn/en/docs/order/create.md#error-codes) — validation, phone, ownership, and routing errors behave identically.
