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

# Query Payment Order

> In order to synchronize order information with merchants, GatePay provides a query interface enabling the merchants to query prepaid orders and refund orders.

## Overview

This page documents the `POST /payment/open/institution/v1/pay/order/query` endpoint. The full schema, parameters, and examples are rendered from the linked OpenAPI definition above.

Order status query interface

## Notes

* Authentication uses the standard GatePay signed headers.
* This page documents the standard merchant endpoint.
* For shared signing rules, see [/api-reference/version/100/en/common/securityAndSignature](/api-reference/version/100/en/common/securityAndSignature).


## OpenAPI

````yaml /api-reference/version/100/en/openapi/institution/call-payment-openapi.json POST /payment/open/institution/v1/pay/order/query
openapi: 3.1.0
info:
  title: GatePay API
  description: >-
    It is most suitable when the Gate Pay payment function is enabled in the
    merchants’ mobile APP.


    After the merchant’s APP requests the SDK provided by Gate Pay to enable the
    Gate Pay payment function, the merchant APP’s page will jump to the Gate APP
    to complete the payment, and then jump back to the merchant’s APP interface
    once the payment is done, with the payment result displayed.


    The function is currently available for IOS (Apple) and Android (Android)
    operating systems.


    The interaction process is as follows:


    Step 1: On the merchant’s APP, the users place an order, and confirm the
    purchase. After the payment process is started, a payment order will be
    created on the merchant’s service background. After being signed, the
    payment order will be transmitted to the APP.


    Step 2: The users click to enter Gate’s payment interface, where they can
    request the Gate Pay payment. After the request is made, they will be
    directed to the page where confirmation of the payment is required.


    Step 3: The users need to verify the payee and the payment amount, click
    “Pay”, and enter the password.


    Step 4: The payment is completed once the correct password is provided. The
    payment result will be displayed on the page.


    Step 5: Then the users will jump back to the merchant APP’s interface where
    the payment result will also be displayed in a manner set by the merchant.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://openplatform.gateapi.io
security: []
paths:
  /payment/open/institution/v1/pay/order/query:
    post:
      summary: Order status query interface
      description: >-
        In order to synchronize order information with merchants, GatePay
        provides a query interface enabling the merchants to query prepaid
        orders and refund orders.
      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/OrderQueryRequest'
            example:
              prepayId: '56416503889661952'
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ApiResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/QueryOrderReturnType'
                      description: Payment order information
              example:
                status: SUCCESS
                code: '000000'
                errorMessage: ''
                data:
                  prepayId: '56335302571069440'
                  merchantId: 10002
                  merchantTradeNo: '118223456798'
                  transactionId: ''
                  goodsName: NF2T
                  currency: USDT
                  orderAmount: '1.9'
                  surchargeAmount: '0'
                  fiatCurrency: ''
                  fiatAmount: ''
                  fiatRate: ''
                  status: EXPIRED
                  createTime: 1675392982792
                  expireTime: 1675396480000
                  transactTime: 0
                  order_name: MiniApp-Payment#118223456798
                  pay_currency: ''
                  pay_amount: '0'
                  expectCurrency: BTC
                  channelId: ''
                  rate: '0'
                  totalFeeAmount: '0'
                  totalSettleAmount: ''
                  payDetails: []
components:
  parameters:
    X-GatePay-Certificate-ClientId:
      name: X-GatePay-Certificate-ClientId
      in: header
      required: true
      description: Merchant client ID, obtained from GatePay platform
      schema:
        type: string
        example: 4186d0c6-6a35-55a9-8dc6-5312769dbff8
    X-GatePay-Signature:
      name: X-GatePay-Signature
      in: header
      required: true
      description: HMAC-SHA256 signature for request validation
      schema:
        type: string
        example: >-
          672d5650dcc9bb22ebf25fa16c28d03c0e159d742a9176d4340a5da326d75dc8a2ec24c97fa6fc5d1533dd6e968863747e1d86a45e562cbe899f9ed7e9ca7f77
    X-GatePay-Timestamp:
      name: X-GatePay-Timestamp
      in: header
      required: true
      description: >-
        Timestamp in milliseconds, must not differ from server time by more than
        5 minutes
      schema:
        type: string
        example: '1672905655498'
    X-GatePay-Nonce:
      name: X-GatePay-Nonce
      in: header
      required: true
      description: Random nonce for replay attack prevention
      schema:
        type: string
        example: '9578'
    X-GatePay-On-Behalf-Of:
      name: X-GatePay-On-Behalf-Of
      in: header
      required: true
      schema:
        type: string
      description: >-
        Required delegated-subject header. Provide the initiating account ID for
        this request. For institution merchant APIs, this is typically the
        target sub-account ID; for institution charge and transfer APIs, it can
        be either an institution account ID or a sub-account ID.
  schemas:
    OrderQueryRequest:
      type: object
      properties:
        prepayId:
          type: string
          description: Prepayment ID. Either prepayId or merchantTradeNo must be provided.
        merchantTradeNo:
          type: string
          description: >-
            Merchant order ID. Either prepayId or merchantTradeNo must be
            provided.
    ApiResponse:
      type: object
      properties:
        status:
          type: string
          description: Payment status
        code:
          type: string
          description: ' Error code'
        errorMessage:
          type: string
          description: Error message
    QueryOrderReturnType:
      type: object
      required:
        - prepayId
        - merchantId
        - merchantTradeNo
        - transactionId
        - goodsName
        - currency
        - orderAmount
        - status
        - createTime
        - expireTime
        - transactTime
        - order_name
        - pay_currency
        - pay_amount
        - rate
      properties:
        prepayId:
          type: string
          description: The prepay ID.
        merchantId:
          type: integer
          format: int64
          description: Gate UID used to apply for a merchant account.
        merchantTradeNo:
          type: string
          description: The merchant order number.
        transactionId:
          type: string
          description: The transaction ID.
        goodsName:
          type: string
          description: The name of the goods.
        currency:
          type: string
          description: The currency of the order.
        orderAmount:
          type: string
          description: The amount of the order.
        surchargeAmount:
          type: string
          description: Surcharge, a fee borne by the consumer.
        fiatCurrency:
          type: string
          description: Fiat order currency.
        fiatAmount:
          type: string
          description: Fiat order amount.
        fiatRate:
          type: string
          description: Fiat rate.
        status:
          type: string
          description: >-
            The status of the order. `PENDING` - Order pending payment,
            `PROCESS` - Payment processing, `PAID` - Payment succeeded,
            `EXPIRED` - Order expired, `CANCELLED` - Order cancelled by
            merchant, `ERROR` - Payment failed due to error.
          enum:
            - PENDING
            - PROCESS
            - PAID
            - EXPIRED
            - CANCELLED
            - ERROR
        createTime:
          type: integer
          format: int64
          description: The timestamp when the prepay was created (in milliseconds).
        expireTime:
          type: integer
          format: int64
          description: The timestamp when the prepay will expire (in milliseconds).
        transactTime:
          type: integer
          format: int64
          description: The timestamp when the payment was completed (in milliseconds).
        order_name:
          type: string
          description: The name of the order.
        pay_currency:
          type: string
          description: The currency used for payment.
        pay_amount:
          type: string
          description: The amount paid by the user.
        expectCurrency:
          type: string
          description: >-
            The revenue currency specified by the merchant when creating the
            order. Only returned in details of orders with a specified
            settlement currency.
        actualCurrency:
          type: string
          description: >-
            The currency actually settled to the merchant's account by the Gate
            backend after the order is paid; returned in the order details only
            once the order has been settled.
        actualAmount:
          type: string
          description: >-
            The amount of currency actually settled to the merchant's account by
            the Gate backend after the order is paid; returned in the order
            details only once the order has been settled.
        rate:
          type: string
          description: The exchange rate used for flash payment.
        channelId:
          type: string
          description: Client name.
        totalFeeAmount:
          type: string
          description: >-
            Cumulative fees charged. May be empty or `0` when payment flows are
            not settled, unpaid, or in centralized-payment-only scenarios, etc.
        institutionFeeAmount:
          type: string
          description: >-
            Cumulative revenue-sharing amount charged. May be empty or `0` when
            payment flows are not settled, unpaid, or in
            centralized-payment-only scenarios.
        totalSettleAmount:
          type: string
          description: >-
            Cumulative settled amount. May be empty when payment flows are not
            settled, etc.
        payDetails:
          type: array
          description: Payment information
          items:
            $ref: '#/components/schemas/OrderQueryPayDetail'
    OrderQueryPayDetail:
      type: object
      description: >-
        Fee and settlement information for a single payment in the flow
        (payDetail).
      properties:
        transactionId:
          type: string
          description: Payment flow / transaction ID.
        payType:
          type: string
          description: 'Payment type: `GatePay` for Gate Pay, `Web3Pay` for Web3 payment.'
        payTime:
          type: string
          description: Payment time.
        payAmount:
          type: string
          description: Payment amount.
        payCurrency:
          type: string
          description: Payment currency
        feeAmount:
          type: string
          description: Fee amount.
        institutionFeeAmount:
          type: string
          description: Revenue-sharing amount.
        settleAmount:
          type: string
          description: Settled amount.
        settlementStatus:
          type: string
          description: 'Settlement status: `pending` not settled, `done` settled.'

````