目录

Querying Orders Related to Specific Purchase Records

Function

Queries payment and refund orders within a specified time range.

Scenario

For example, if you want to check the payment and refund orders of the previous day, you can set the start time to 00:00 of the previous day and the end time to 00:00 of the current day, and then call this API to query related order records.

  • As daily order information may still be subject to change, it is not recommended to use this API to query real-time order data for the current day. It is recommended to query with a one-day delay.

  • Currently, only order data within 180 days can be queried.

  • Currently, sandbox orders and zero-amount orders cannot be queried.

Prototype

Request Parameters

[h2]Request Header

Parameter Mandatory Type Description
Content-Type Yes String Content type. The value is application/json;charset=UTF-8.
Authorization Yes String Authentication information. JWT is used for authentication. For details, please refer to Authorization Description.

[h2]Request Body

Parameter Mandatory Type Description
startTime Yes Long

Start time of the query range. The value is a UTC timestamp, in milliseconds.

startTime cannot be later than the current time.

endTime Yes Long

End time of the query range. The value is a UTC timestamp, in milliseconds.

- The difference between startTime and endTime must be less than or equal to 48 hours.

- endTime must be later than startTime.

continuationToken No String

Data location flag for a query in pagination mode.

- This parameter is not required for the initial request. If a response includes a continuationToken, use the continuationToken in the next query to retrieve the next page of data.

Request Example

POST /order/harmony/v1/application/trade/orders/query
Content-Type: application/json; charset=UTF-8
Authorization: Bearer ***.***.***
Accept: application/json
{
  "startTime": 1739548800000,
  "endTime": 1739721600000
}

Response Parameters

[h2]Response Header

Parameter Mandatory Type Description
Content-Type Yes String Content type. The value is application/json;charset=UTF-8.

[h2]Response Body

Parameter Mandatory Type Description
responseCode Yes String

Response code.

0: success

Other values: Failure. For details, please refer to error codes.

responseMessage No String Response description.
orderInfoList No List<Object> Order information list. Each JSON object in the list indicates an order. For details about the order information format, see OrderInfo.
continuationToken No String Data location flag for a query in pagination mode. If a continuationToken is returned, pass it in the next query to retrieve the next page of data.

Response Example

HTTP/1.2 200 OK
Content-Type: application/json; charset=UTF-8
{
  "responseCode": "0",
  "orderInfoList": [
    {
      "requestId": "***",
      "country": "CN",
      "merchantId": "***",
      "applicationId": "***",
      "orderTime": 1739602800000,
      "tradeTime": 1739602800000,
      "productId": "***",
      "productName": "test",
      "payMoney": "10.00",
      "couponAmt": "0.10",
      "currency": "CNY",
      "tradeState": 0,
      "tradeType": "REFUND",
      "refundTime": 1739620800000,
      "refundMoney": "0.02"
    },
    {
      "requestId": "***",
      "country": "CN",
      "merchantId": "***",
      "applicationId": "***",
      "orderTime": 1739602800000,
      "tradeTime": 1739602800000,
      "productId": "***",
      "productName": "Test product",
      "payMoney": "0.01",
      "currency": "CNY",
      "tradeState": 0,
      "tradeType": "PURCHASE"
    },
  ],
  "continuationToken": "***"
}

[h2]OrderInfo

Parameter Mandatory Type Description
requestId Yes String Purchase order ID associated with a specific transaction, equivalent to purchaseOrderId. The value contains a maximum of 256 characters.
country Yes String Country/region code, which is used to identify the country or region. For details, please refer to the ISO 3166 standard.
merchantId Yes String Merchant ID.
applicationId Yes String App ID.
orderTime Yes Long Time when an order is placed. The value is a UTC timestamp, in milliseconds.
tradeTime Yes Long

Payment time. The value is a UTC timestamp, in milliseconds.

Note: Orders whose (tradeTime) is within the range [startTime,endTime) are returned.

productId Yes String Product ID.
productName Yes String Product name.
payMoney Yes String Payment amount, with the currency unit varying based on the user's ordering country.
couponAmt No String Coupon amount, with the currency unit varying based on the user's ordering country.
currency Yes String Currency.
tradeState Yes Integer

Order status.

0: Successful.

tradeType Yes String

Transaction type.

- PURCHASE: payment.

- REFUND: refund.

refundTime No Long Refund time. The value is a UTC timestamp, in milliseconds.
refundMoney No String Refund amount, with the currency unit varying based on the user's ordering country.