We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
ReferencesIn-App PurchasesOrder/SubscriptionServerAPI for Querying Orders Related to Specific Purchase Records

API for Querying Orders Related to Specific Purchase Records

Function

This API is used to query payment orders and refunded orders related to purchase records in a specific period.

Scenario

Call this API when you want to query the payment orders and refunded orders related to purchase records of the previous day, by setting the start time to 00:00 of the previous day and the end time to 00:00 of the current day.

NOTE

Order information of the current day may change. Therefore, you are advised to call this API for querying orders of the previous day, instead of the current day.

Prototype

Protocol

HTTPS POST

Direction

Developer server -> Huawei IAP server

URL

{rootUrl}/applications/v1/merchantQuery

NOTE

The value of rootUrl varies depending on the site. You must select the order service address of the nearest site for access. For details, please refer to Site Information and Site Selection.

Data Format

Request: Content-Type: application/json

Response: Content-Type: application/json

Request Parameters

Request Header

Expand

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Value: application/json; charset=UTF-8

Authorization

Yes

String

Authentication information, which should contain data generated based on the access token for authentication by the Huawei IAP server. The access token is obtained through the Huawei public API for OAuth 2.0-based authentication. The authentication information format is described in Overview, and for details about how to obtain the access token, please refer to API for Obtaining an App-Level Access Token.

Request Body

Expand

Parameter

Mandatory

Type

Description

startAt

Yes

Long

Start time of the specific period. The value is a UTC timestamp, in milliseconds. The value of this parameter cannot be later than the current time. Only orders whose payment time (tradeTime) is later than this parameter value can be queried.

endAt

Yes

Long

End time of the specific period. The value is a UTC timestamp, in milliseconds. The time difference between this parameter value and the value of startAt should be equal to or less than 48 hours. This parameter value must be greater than the value of startAt. Only orders whose payment time (tradeTime) is earlier than this parameter value can be queried.

continuationToken

No

String

continuationToken returned in the last query to query the data on the next page.

Request Example

POST /applications/v1/merchantQuery
Content-Type: application/json; charset=UTF-8
Authorization: Basic QVQ6Q1YzQ1NPbVlBaGwrZUtRWExtMTBVV2pyWXZHTVF4MmYvcVMya1B0ZElLY3UwaFJrdFNTMmxwdk1FQkIyYldXWGt0REVaR3I4UjFUTTRLMVlmNXdwWU80RG04THdXQWxjaFhEYjBMUjBNTUJtWnFYcGFtazc3THN3UnFJbkhHK28xekdqRzNSMg==
Accept: application/json
Content-Length: 98
{
  "startAt": 1666800000000,
  "endAt": 1666886400000
}

Response Parameters

Response Header

Expand

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Value: application/json; charset=UTF-8

Response Body

Expand

Parameter

Mandatory

Type

Description

responseCode

Yes

String

Result code. The options are as follows:

  • 0: success
  • Other values: failure. For details about the result codes, please refer to Result Codes.

responseMessage

No

String

Response description.

orderInfoList

No

JSONArray

List of order information, in JSON format. Each JSONObject indicates the information of an order. For details about the order information format, please refer to the description of OrderInfo.

continuationToken

No

String

Token to query data on the next page. If a value is returned, pass it in the next query request to query data on the next page.

Table 1 OrderInfo
Expand

Parameter

Mandatory

Type

Description

orderNo

Yes

String

Huawei order ID.

requestId

Yes

String

Merchant request ID.

country

Yes

String

Country or region code, which is used to identify a country or region. The value must comply with 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.

productId

Yes

String

Product ID.

productName

Yes

String

Product name.

payMoney

Yes

String

Payment amount. The unit is dependent on the currency.

couponAmt

No

String

Coupon amount. The unit is dependent on the currency.

mpAmt

No

String

Deduction amount converted from bonus points. The unit is dependent on the currency.

mpRfdAmt

No

String

Refund amount converted from bonus points. The unit is dependent on the currency.

currency

Yes

String

Currency.

payType

Yes

Integer

Payment method. For details about its values, please refer to the PayType table at the bottom of the Data Models section.

tradeState

Yes

Integer

Order status. The options are as follows:

  • 0: successful
  • 2: failed
  • 4: unpaid

tradeType

Yes

String

Transaction type. The options are as follows:

  • PURCHASE: payment
  • REFUND: refund

oriOrderNo

No

String

ID of the original Huawei order that is refunded, which is returned when tradeType is set to REFUND.

refundTime

No

Long

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

refundMoney

No

String

Refund amount. The unit is dependent on the currency.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
Content-Length: 455
{
    "responseCode": "0",
    "orderInfoList": [
        {
            "orderNo": "V202209272021234015A069C79",
            "requestId": "20220927202901112349187041.101721234",
            "country": "CN",
            "merchantId": "9000860001552381234",
            "applicationId": "101721234",
            "orderTime": 1664281771000,
            "tradeTime": 1664281771000,
            "productId": "ballcost04",
            "productName": "abc",
            "payMoney": "10.00",
            "couponAmt": "0.10",
            "currency": "CNY",
            "payType": 4,
            "tradeState": 0,
            "tradeType": "PURCHASE"
        }
    ],
  "continuationToken": "eyJwYWdlU2l6ZSI6MSwicG9zaXRpb24iOiIxNTc2MDczODYzMTQyLjk4MEMzMDFFLjI5MzcifQ=="
}

Debugging Using Postman

You can use Postman to debug this API online.

Search in References
Enter a keyword.