目录

Closing an Order

Function

Closes an existing order.

Scenario

When a user creates an order in your app, your server synchronously creates the order in Huawei Pay. If a user needs to cancel an order and create a new one, your server calls this API to close the existing order in Huawei Pay prior to cancellation. This prevents duplicate payments in edge cases.

Prototype

Request Parameters

Request Header

Parameter Mandatory Type Description
Content-Type Yes String The value is application/json; charset=UTF-8.
PayMercAuth Yes String The value is a JSON string of PayMercAuth.

Request Body

Parameter Mandatory Type Description
mercOrderNo Yes String Merchant order number, which is generated by the merchant during the pre-order process and must be unique. The value contains a maximum of 46 characters.

Request Example

POST /api/v1/aggr/transactions/orders/close HTTP/1.1
Content-Type: application/json;charset=UTF-8
PayMercAuth: {"callerId":"10132120***","traceId":"202305151026422776499","time":1684117602555,"authId":"120291744647139***","headerSign":"u+H1Oe3fXV9mGCES89XA7tSjp8+********************lOG7eAFfwjEWJu5JyvY5KunSeE6DiKs=","bodySign":"yWDtXOBqDoItPgHmF57L6U5G7F/*******************asPj10iUIFeaszpiRT2aQDaqLGaxvta6J5UxIUmAp+wGdV/juGEvQ="}
Accept: application/json
{
  "mercOrderNo": "czl00120240705***"
}

Response Parameters

Response Header

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

Response Body

Parameter Mandatory Type Description
resultCode Yes String Return code. 000000 indicates success, and other values indicate exceptions. For details, see Result Codes.
resultDesc Yes String Result description.
subCode No String Service result code.
subDesc No String Service result description.
sign Yes String Signature, which is used to perform anti-tamper verification on response packets.

Response Example

HTTP/1.1 200 OK
Content-Type: application/json; charset=UTF-8
{
  "resultCode": "000000",
  "resultDesc": "Success.",
  "sign": "MEQCIEIWzdpziRyTi8vhwWHFu********************0YAMabeCgTDG77e+2XJItvq/ZkIcCN5/B20pQ=="
}

Result Codes

For error codes of resultCode other than 400000, see Common Result Codes.

Return Code Result Code Description Solution
400000 UNKNOW_ERROR Service temporarily unavailable. Try again later. Try again later.
400000 INVALID_ARGUMENTS Invalid parameter. Check the request parameters.
400000 INVALID_MERCNO Invalid merchant number. Check whether the input merchant number is correct.
400000 MERC_ORDER_NOT_EXIST The merchant order ID does not exist. Check whether the input order ID is correct.