> ## Documentation Index
> Fetch the complete documentation index at: https://opendocs.xft.xin/llms.txt
> Use this file to discover all available pages before exploring further.

# 查询交易接口

## 功能说明

根据商户订单号、商户号信息查询支付交易的详细信息，包括交易状态、支付渠道、金额等。

## 请求地址

`POST /v1/aggregate/payment/charge/get`

## 请求参数

| 字段 | 类型 | 必填 | 说明 |
| - | - | - | - |
| `out_trade_no` | string | 是 | 商户订单号 |
| `merchant_code` | string | 是 | 商户编码 |

## 请求示例

```json theme={"system"}
{
  "out_trade_no": "ea51203e1a0146d7954b39ac88aecaf7",
  "merchant_code": "226801000000865319122"
}
```

## 响应参数

| 字段 | 类型 | 说明 |
| - | - | - |
| `out_trade_no` | string | 商户订单号 |
| `business_trade_no` | string | 业务订单号 |
| `trade_no` | string | 微信、支付宝等三方支付流水号 |
| `platform_trade_no` | string | 平台流水号 |
| `trade_state` | string | 交易状态，详见 [TradeState 枚举](#tradestate) |
| `trade_state_desc` | string | 交易状态描述 |
| `product_code` | string | 产品代码 |
| `product_name` | string | 产品名称 |
| `subject` | string | 订单标题 |
| `body` | string | 商品描述 |
| `attach` | string | 附加数据 |
| `channel_code` | string | 渠道编码 |
| `channel_name` | string | 渠道名称 |
| `institution_code` | string | 机构编码 |
| `institution_name` | string | 机构名称 |
| `payed_at` | string | 支付时间 |
| `expired_at` | string | 交易有效期 |
| `merchant_code` | string | 商户编码 |
| `merchant_name` | string | 商户名称 |
| `failure_code` | string | 失败码 |
| `failure_msg` | string | 失败信息 |
| `notify_url` | string | 通知地址 |
| `open_id` | string | 用户 openid |
| `scene_info` | object | 场景信息，详见下方 SceneInfo 说明 |
| `amount` | object | 订单金额，单位：分，详见下方 Amount 说明 |
| `bank_code` | string | 银行编码 |
| `bank_name` | string | 银行名称 |

**Amount 对象**

| 字段 | 类型 | 说明 |
| - | - | - |
| `total` | int | 订单总金额，单位：分 |
| `payer_total` | int | 用户支付金额，单位：分（使用优惠券的情况下，等于总金额减优惠券金额） |
| `currency` | string | 订单金额货币类型；`CNY`：人民币，境内商户号仅支持人民币 |
| `payer_currency` | string | 用户支付货币类型 |

**SceneInfo 对象**

| 字段 | 类型 | 说明 |
| - | - | - |
| `device_id` | string | 商户端设备号（门店号或收银设备 ID） |
| `device_ip` | string | 商户端设备 IP |
| `store_info` | object | 商户门店信息，详见下方 StoreInfo 说明 |

**StoreInfo 对象**

| 字段 | 类型 | 说明 |
| - | - | - |
| `id` | string | 门店编号（微信支付线下场所 ID，格式为纯数字）；与 `out_id` 二选一必填 |
| `out_id` | string | 商家自定义编码（商户系统的门店编码）；与 `id` 二选一必填 |

**TradeState 枚举**

| 值 | 描述 |
| - | - |
| `00` | 支付成功（退款成功） |
| `01` | 支付失败（退款失败） |
| `03` | 部分退款（仅支付订单有此状态） |
| `04` | 全部退款（仅支付订单有此状态） |
| `09` | 待支付（退款中） |
| `98` | 订单关闭（仅支付订单有此状态） |

## 响应示例

```json theme={"system"}
{
  "out_trade_no": "ea51203e1a0146d7954b39ac88aecaf7",
  "business_trade_no": "B20231025152300001",
  "trade_no": "4200001234202310251234567890",
  "platform_trade_no": "20231025152300000001",
  "trade_state": "00",
  "trade_state_desc": "成功",
  "product_code": "MICRO_PAY",
  "product_name": "付款码支付",
  "subject": "示例商品",
  "body": "线下订单服务费",
  "attach": "",
  "channel_code": "WECHAT",
  "channel_name": "微信支付",
  "institution_code": "WECHAT",
  "institution_name": "财付通",
  "payed_at": "20220912111230",
  "expired_at": "20220912111230",
  "merchant_code": "226801000000865319122",
  "merchant_name": "示例商户",
  "failure_code": "",
  "failure_msg": "",
  "notify_url": "https://example.com/notify",
  "open_id": "oUpF8uMuAJO_M2pxb1Q9zNjWeS6o",
  "scene_info": {
    "device_id": "POS001",
    "device_ip": "192.168.1.100"
  },
  "amount": {
    "total": 100,
    "payer_total": 100,
    "currency": "CNY",
    "payer_currency": "CNY"
  },
  "bank_code": "",
  "bank_name": ""
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.