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 | / | 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
Goods
Name | Type | Length | Required | Description | Sample |
price | / | 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 | / | Y | copy
|
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
{
"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
{
"merchantTransId": "MERCHANT_ORDER_ID_12345678",
"merchantNotifyUrl": "wwww.alipay.hk",
"result": {
"resultCode": "SUCCESS",
"resultStatus": "S",
"resultMessage": "成功"
}
}