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

# 查询订单

> 商户通过该接口查询订单，支付网关会返回订单最新的数据。



## OpenAPI

````yaml docs/api/cn/openapi.json post /api/pay/query
openapi: 3.0.1
info:
  title: 支付Api接口文档
  contact:
    name: epay123
  license:
    name: Apache 2.0
    url: https://docs.epay123.net
  version: 1.0.1
servers:
  - url: https://sandbox-pay.epay123.net
    description: Generated server url
security: []
paths:
  /api/pay/query:
    post:
      tags:
        - 支付订单接口
      summary: 查询订单
      description: 商户通过该接口查询订单，支付网关会返回订单最新的数据。
      operationId: queryOrder
      requestBody:
        description: 查询订单请求参数
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryPayOrderRQ'
        required: true
      responses:
        '200':
          description: 成功返回结果
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ApiResQueryPayOrderRS'
components:
  schemas:
    QueryPayOrderRQ:
      required:
        - appId
        - mchNo
        - mchOrderNo
        - payOrderId
        - reqTime
        - sign
        - signType
        - version
      type: object
      properties:
        version:
          type: string
          description: 版本号
          example: 1.0.1
        signType:
          type: string
          description: 签名类型，目前只支持MD5方式
          example: MD5
        sign:
          type: string
          description: 签名值，详见签名算法
          example: xxxxxx
        reqTime:
          type: string
          description: 时间戳,13位时间戳
          example: '1622016572190'
        mchNo:
          type: string
          description: 商户号
          example: M1234567890
        appId:
          type: string
          description: 商户应用ID
          example: 88808634c46ff1a7807888888
        mchOrderNo:
          type: string
          description: 商户订单号
          example: '20160427210604000490'
        payOrderId:
          type: string
          description: 支付系统订单号, 支付中心生成的订单号，与mchOrderNo二者传一即可
          example: P202106181104177050002
    ApiResQueryPayOrderRS:
      type: object
      properties:
        code:
          title: code
          type: integer
          description: 业务响应码
          format: int32
          example: 200
        msg:
          title: msg
          type: string
          description: 业务响应信息
          example: 成功
        data:
          $ref: '#/components/schemas/QueryPayOrderRS'
        sign:
          title: sign
          type: string
          description: 签名值
    QueryPayOrderRS:
      title: data
      required:
        - amount
        - appId
        - body
        - createdAt
        - currency
        - ifCode
        - mchNo
        - mchOrderNo
        - payOrderId
        - state
        - subject
        - wayCode
      type: object
      properties:
        payOrderId:
          type: string
          description: 支付订单号
          example: P202106181104177050002
        mchNo:
          type: string
          description: 商户号
          example: M1623984572
        appId:
          type: string
          description: 商户应用ID
          example: 60cc09bce4b0f1c0b83761c9
        mchOrderNo:
          type: string
          description: 返回商户传入的订单号
          example: mho1623985457320
        ifCode:
          type: string
          description: 支付接口代码
          example: cbcoinpay
        wayCode:
          type: string
          description: 支付方式代码
          example: CB_COIN_ADDR
        amount:
          type: integer
          description: 支付金额,单位分
          format: int64
          example: 2058
        currency:
          type: string
          description: 三位货币代码,美元:USD
          example: USD
        state:
          type: integer
          description: '支付状态: 0-订单生成, 1-支付中, 2-支付成功, 3-支付失败, 4-已撤销, 5-已退款, 6-订单关闭'
          format: int32
          example: 2
        clientIp:
          type: string
          description: 客户端IP
          example: 192.166.1.132
        subject:
          type: string
          description: 商品标题
          example: 商品标题
        body:
          type: string
          description: 商品描述信息
          example: 商品描述
        channelOrderNo:
          type: string
          description: 渠道订单号
          example: '2021061822001423031419593035'
        errCode:
          type: string
          description: 渠道支付错误码
        errMsg:
          type: string
          description: 渠道支付错误描述
        extParam:
          type: string
          description: 商户扩展参数
          example: '{}'
        successTime:
          type: integer
          description: 订单支付成功时间,13位时间戳
          format: int64
          example: 1623985459000
        createdAt:
          type: integer
          description: 创建时间,13位时间戳
          format: int64
          example: 1623985457705
        orderTransactionList:
          type: array
          description: 订单交易流水
          items:
            $ref: '#/components/schemas/CoinOrderTransaction'
      description: 数据对象
    CoinOrderTransaction:
      type: object
      properties:
        txId:
          type: string
          description: 支付交易流水号
          example: 1975dc00-006c-4090-838e-2aa135cbcac0
        payOrderId:
          type: string
          description: 支付订单号
          example: P1234567890
        txHash:
          type: string
          description: 交易HASH
        amount:
          type: number
          description: 支付金额,含小数点
          example: 1000.25
        tokenId:
          type: string
          description: 币种ID
          example: TRON_USDT
        fromAddress:
          type: string
          description: 来源地址
          example: TX1234567890
        toAddress:
          type: string
          description: 目标地址
          example: TD1234567890
        status:
          type: string
          description: >-
            交易状态: Submitted, PendingScreening, PendingAuthorization,
            PendingSignature, Broadcasting, Confirming, Completed, Failed,
            Rejected, Pending
          example: Confirming
        createdAt:
          type: string
          description: 创建时间
          format: date-time
        updatedAt:
          type: string
          description: 更新时间
          format: date-time
      description: 订单交易流水

````