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

# 订单状态查询

> 查询订单状态以及详细信息。

## 概述

本页说明 `POST /payment/open/institution/v1/pay/order/query` 接口。完整的请求参数、响应结构与示例由上方关联的 OpenAPI 定义渲染。

## 说明

* 认证方式使用 GatePay 标准签名请求头。
* 本页展示同一接口的机构路径版本。
* 除创建子账户、查询子账户详情、分页查询子账户外，机构侧请求需携带 `X-GatePay-On-Behalf-Of`。
* 本接口返回订单查询结果本体，不使用通知回调中的 `bizType` / `bizStatus` 外层结构。
* 对中心化支付订单，请结合 `orderAmount` 与 `pay_amount` 理解支付金额字段含义。
* 通用签名规则请参见 [/api-reference/version/100/cn/common/securityAndSignature](/api-reference/version/100/cn/common/securityAndSignature)。


## OpenAPI

````yaml api-reference/version/100/cn/openapi/institution/web-payment-openapi.json POST /payment/open/institution/v1/pay/order/query
openapi: 3.1.0
info:
  title: GatePay Web 支付 API
  version: 1.0.0
  description: 基于原 Web Payment 文档整理的 OpenAPI 3.1 规范。涵盖 Web 预付单创建、关闭、查询以及退款相关接口。
servers:
  - url: https://openplatform.gateapi.io
    description: 生产环境
security: []
tags:
  - name: web-payment
    description: Web 支付相关接口，包括预付单创建、关闭、查询以及退款等。
paths:
  /payment/open/institution/v1/pay/order/query:
    post:
      tags:
        - web-payment
      summary: 订单状态查询
      description: 查询订单状态以及详细信息。
      operationId: queryOrder
      parameters:
        - $ref: '#/components/parameters/X-GatePay-Certificate-ClientId'
        - $ref: '#/components/parameters/X-GatePay-Signature'
        - $ref: '#/components/parameters/X-GatePay-Timestamp'
        - $ref: '#/components/parameters/X-GatePay-Nonce'
        - $ref: '#/components/parameters/X-GatePay-On-Behalf-Of'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryOrderRequest'
            examples:
              default:
                summary: 默认示例
                value:
                  merchantTradeNo: '56236'
      responses:
        '200':
          description: 订单详情
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryOrderResponse'
              examples:
                success:
                  summary: 成功响应示例
                  description: 查询指定营收币种订单详情，已结算，响应示例
                  value:
                    status: SUCCESS
                    code: '000000'
                    errorMessage: ''
                    data:
                      prepayId: '50620368071692288'
                      merchantId: 10002
                      merchantTradeNo: '4379824792349592345'
                      transactionId: ''
                      goodsName: NFT
                      currency: GT
                      orderAmount: '0.1'
                      status: EXPIRED
                      createTime: 1674030436229
                      expireTime: 1663054706000
                      transactTime: 0
                      order_name: MiniApp-Payment#4379824792349592345
                      pay_currency: ''
                      pay_amount: '0'
                      rate: '0'
                      channel_type: ''
                      inUsdt: ''
                      appLogo: >-
                        https://gimg2.gateimg.com/image/432c2715a0eaa6217af7a3db1e85ffc8dc866233.webp
                      appName: Latiago
                      channelId: '123456'
                      totalFeeAmount: '0'
                      totalSettleAmount: ''
                      payDetails: []
components:
  parameters:
    X-GatePay-Certificate-ClientId:
      name: X-GatePay-Certificate-ClientId
      in: header
      required: true
      description: 商户客户端ID，在 GatePay 平台申请获得
      schema:
        type: string
        example: 4186d0c6-6a35-55a9-8dc6-5312769dbff8
    X-GatePay-Signature:
      name: X-GatePay-Signature
      in: header
      required: true
      description: HMAC-SHA256签名，用于验证请求合法性
      schema:
        type: string
        example: >-
          672d5650dcc9bb22ebf25fa16c28d03c0e159d742a9176d4340a5da326d75dc8a2ec24c97fa6fc5d1533dd6e968863747e1d86a45e562cbe899f9ed7e9ca7f77
    X-GatePay-Timestamp:
      name: X-GatePay-Timestamp
      in: header
      required: true
      description: 时间戳（毫秒），与服务器时间差不能超过5分钟
      schema:
        type: string
        example: '1672905655498'
    X-GatePay-Nonce:
      name: X-GatePay-Nonce
      in: header
      required: true
      description: 随机数，用于防止重放攻击
      schema:
        type: string
        example: '3525756760'
    X-GatePay-On-Behalf-Of:
      name: X-GatePay-On-Behalf-Of
      in: header
      required: true
      schema:
        type: string
      description: >-
        必填代理归属请求头。请填写本次请求的发起方账户 ID；在机构代理商户 API 中通常填写目标子账户 ID，在机构代扣与划转接口中可填写机构账户
        ID 或子账户 ID。
  schemas:
    QueryOrderRequest:
      type: object
      description: 订单查询请求，`prepayId` 与 `merchantTradeNo` 至少传一个。
      properties:
        prepayId:
          type: string
          description: 预付单 ID。
        merchantTradeNo:
          type: string
          description: 商户订单号。
    QueryOrderResponse:
      type: object
      description: 订单查询响应。
      properties:
        status:
          type: string
          description: SUCCESS 或者 FAIL
        code:
          type: string
          description: 出错代码
        data:
          type: object
          description: 支付订单信息
          properties:
            prepayId:
              type: string
              description: 预付单id
            merchantId:
              type: integer
              format: int64
              description: 用于申请商户账号的Gate UID
            merchantTradeNo:
              type: string
              description: 商户订单号
            transactionId:
              type: string
              description: 交易id
            goodsName:
              type: string
              description: 商品名称
            currency:
              type: string
              description: 订单币种
            orderAmount:
              type: string
              description: 订单金额
            surchargeAmount:
              type: string
              description: 附加费，指由消费者承担的费用
            toleranceAmount:
              type: string
              description: 容差金额：当订单剩余未付金额 ≤ 设置的容差金额时，系统将自动视为支付成功，无需用户额外补款。
            underpaidAmount:
              type: string
              description: 支付完成后，未支付金额
            fiatCurrency:
              type: string
              description: 法币订单币种
            fiatAmount:
              type: string
              description: 法币订单金额
            fiatRate:
              type: string
              description: 法币-加密货币汇率
            status:
              type: string
              description: 订单状态
            createTime:
              type: integer
              format: int64
              description: 预付单创建时间，单位毫秒
            expireTime:
              type: integer
              format: int64
              description: 预付单过期时间，单位毫秒
            transactTime:
              type: integer
              format: int64
              description: 支付完成时间，单位毫秒
            order_name:
              type: string
              description: 订单名称
            pay_currency:
              type: string
              description: 用户实际支付币种
            pay_amount:
              type: string
              description: 支付金额；对中心化支付订单，该字段表示应支付金额，请结合 orderAmount 理解
            expectCurrency:
              type: string
              description: 商家创建订单时，指定营收币种，注：仅在商户指定结算币种的订单详情中返回。
            actualCurrency:
              type: string
              description: 订单支付完成后，Gate后台实际结算到商户账户的币种，注：仅在订单Gate结算给商户后才在订单详情中返回。
            actualAmount:
              type: string
              description: 订单支付完成后，对应Gate后台实际结算到商户账户的币种的金额，注：仅在订单Gate结算给商户后才在订单详情中返回。
            rate:
              type: string
              description: 闪兑支付时的汇率
            channelId:
              type: string
              description: 客户名称
            appName:
              type: string
              description: 应用名称
            appLogo:
              type: string
              description: 应用Logo
            inUsdt:
              type: string
              description: 对应USDT金额
            channel_type:
              type: string
              description: 渠道类型
            totalFeeAmount:
              type: string
              description: 累计已收取的手续费。若支付流水未结算、未支付或仅为中心化支付等场景，可能为空或为 0
            institutionFeeAmount:
              type: string
              description: 累计已收取的收益分成。若支付流水未结算、未支付或仅为中心化支付等场景，可能为空或为 0。
            totalSettleAmount:
              type: string
              description: 累计已结算金额。若支付流水未结算等场景，可能为空
            txHash:
              type: string
              description: 区块链交易哈希
            address:
              type: string
              description: 区块链地址
            chain:
              type: string
              description: 链名称
            fullCurrType:
              type: string
              description: 完整币种类型
            showChainNameEn:
              type: string
              description: 显示链名称（英文）
            fromAddress:
              type: string
              description: 来源地址
            merchantName:
              type: string
              description: 商户名称
            location:
              type: string
              description: 位置信息
            scheme:
              type: string
              description: URL scheme
            returnUrl:
              type: string
              description: 返回URL
            totalFee:
              type: string
              description: 总手续费
            payDetails:
              type: array
              description: 支付信息
              items:
                $ref: '#/components/schemas/OrderQueryPayDetail'
        errorMessage:
          type: string
          description: 错误信息
      required:
        - status
        - code
        - prepayId
        - merchantId
        - merchantTradeNo
        - transactionId
        - goodsName
        - currency
        - orderAmount
        - createTime
        - expireTime
        - transactTime
        - order_name
        - pay_currency
        - pay_amount
        - rate
    OrderQueryPayDetail:
      type: object
      description: 支付流水中单笔支付的手续费与结算信息（payDetail）。
      properties:
        transactionId:
          type: string
          description: 支付流水号
        payType:
          type: string
          description: 支付类型：`GatePay` Gate 支付，`Web3Pay` Web3 支付
        payTime:
          type: string
          description: 支付时间
        payAmount:
          type: string
          description: 支付金额
        payCurrency:
          type: string
          description: 支付币种
        feeAmount:
          type: string
          description: 手续费
        institutionFeeAmount:
          type: string
          description: 收益分成。
        settleAmount:
          type: string
          description: 结算金额
        settlementStatus:
          type: string
          description: 结算状态：`pending` 未结算，`done` 已结算

````