> ## 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.

# 查询 Web 支付退款单

> 根据商户侧生成的退款单 ID 查询退款状态。

## 概述

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

## 说明

* 认证方式使用 GatePay 标准签名请求头。
* 本页展示普通商户接口。
* 通用签名规则请参见 [/api-reference/version/100/cn/common/securityAndSignature](/api-reference/version/100/cn/common/securityAndSignature)。


## OpenAPI

````yaml api-reference/version/100/cn/openapi/web-payment-openapi.json POST /v1/pay/order/refund/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:
  /v1/pay/order/refund/query:
    post:
      tags:
        - web-payment
      summary: 查询退款单
      description: 根据商户侧生成的退款单 ID 查询退款状态。
      operationId: queryRefund
      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'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QueryRefundRequest'
            examples:
              default:
                summary: 默认示例
                value:
                  refundRequestId: '156123911'
      responses:
        '200':
          description: 退款单详情
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QueryRefundResponse'
              examples:
                success:
                  summary: 成功响应示例
                  value:
                    status: SUCCESS
                    code: '000000'
                    data:
                      refundRequestId: '156123911'
                      prepayId: '1647557960944'
                      orderAmount: '1.91'
                      refundAmount: '0.8'
                      refundStatus: SUCCESS
                    errorMessage: ''
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'
  schemas:
    QueryRefundRequest:
      type: object
      description: 查询退款单请求参数。
      properties:
        refundRequestId:
          type: string
          description: 商户侧生成的退款单 ID。
      required:
        - refundRequestId
    QueryRefundResponse:
      type: object
      description: 查询退款单响应。
      properties:
        status:
          type: string
          description: SUCCESS 或者 FAIL
        code:
          type: string
          description: 出错代码
        data:
          type: object
          description: 退款单信息
          properties:
            refundRequestId:
              type: string
              description: 商户退款单ID，有商户后端生成保证唯一。
            prepayId:
              type: string
              description: 订单ID，GatePay后端生成。
            orderAmount:
              type: string
              description: 订单金额
            refundAmount:
              type: string
              description: 退款金额
            refundStatus:
              type: string
              description: 退款单状态，SUCCESS 表示退款成功，FAIL 表示退款失败。
            channelId:
              type: string
              description: 支付渠道ID。
        errorMessage:
          type: string
          description: 错误信息
      required:
        - status
        - code

````