Order Create

Order Create

In order to ensure that the merchant has sufficient inventory before charging the user, AlipayHK will invoke the Order Create API prior to debiting the user’s account. The merchant must return the check result and reserve (lock) the required stock and hold it until receiving AlipayHK’s transaction result notification.

  • Retry Mechanism:
AlipayHK will synchronously retry for few times while the API call fails. The add-on purchase will fail if all retries fail.

Request

Name

Type

Length

Required

Description

Sample

requestId

String

64

Y

order

Order

/

Y

Order info

{

    "orderAmount": {

        "amount": 1.08,

        "currency": "HKD"

    },

    "goodsList": [

        {

            "price": {

                "amount": 1.08,

                "currency": "HKD"

            },

            "quantity": "1",

            "title": "測試商品"

        }

    ]

}

extendInfo

String

1024

N

{\"contentId\":\"110123450002\",\"spuId\":\"72032179\"}

Order

Name

Type

Length

Required

Description

Sample

orderAmount

Money

/

Y

goodsList

List<Goods>

/

Y

Goods

Name

Type

Length

Required

Description

Sample

price

Money

/

Y

quantity

String

/

Y

title

String

/

N

Name of goods

Money

Name

Type

Length

Required

Description

Sample

amount

Number

/

Y

Amount, unit: Yuan

currency

String

/

Y

Response

Name

Type

Length

Required

Description

Sample

merchantTransId

String

64

Y

Merchant transaction number

merchantNotifyUrl

String

256

Y

AlipayHK will call this url while user success pay for products.

API detail refers to:  Order Notification

result

Result

/

Y

copy
{
    "resultCode": "SUCCESS", // 结果码
    "resultMessage": "success", // 错误描述
    "resultStatus": "S" // F - 失败  S- 成功 U-未知
}

Result

Name

Type

Length

Required

Description

Sample

resultCode

String

64

Y

SUCCESS

resultStatus

String

2

Y

F:Fail

S:Success

U:Unknown

S

resultMessage

String

256

Y

success

ResultCode

No

ResultCode

ResultStatus

Remarks

1

SUCCESS

S

Success

2

PROCESS_FAIL

F

General business failure

3

PARAM_ILLEGAL

F

Illegal parameters

4

OUT_OF_STOCK

F

Out of stock

5

GOODS_NOT_EXIST

F

Goods not exist

6

UNKNOWN_EXCEPTION

U

Unknown exception

Sample

Request

copy
{
    "requestId": "fdy9730943y0egh38eh10sj219sj09r1",
    "order": {
        "orderAmount": {
            "amount": 1.08,
            "currency": "HKD"
        },
        "goodsList": [
            {
                "price": {
                    "amount": 1.08,
                    "currency": "HKD"
                },
                "quantity": "1",
                "title": "測試商品"
            }
        ]
    },
    "extendInfo": "{\"contentId\":\"110123450002\",\"spuId\":\"72032179\"}"
}

Response

copy
{
  "merchantTransId": "MERCHANT_ORDER_ID_12345678",
  "merchantNotifyUrl": "wwww.alipay.hk",
  "result": {
    "resultCode": "SUCCESS",
    "resultStatus": "S",
    "resultMessage": "成功"
  }
}