创建订单
此页展示签名接口的 request 与 response 结构,供日后让商户系统从服务器端创建 Yuter 凭证或订单。
POST
/api/integrations/merchant/orders/create商户创建订单接口的结构。
Request 字段
字段
类型
必填
说明
customerobject
是
创建订单所需的客户资料。
itemsarray
是
订单项目或所选凭证方案。
merchantReferencestring
否
商户端对账用参考编号。
Response 字段
字段
类型
说明
codenumber
返回代码。
successboolean
创建成功时会出现。
orderIdstring
已创建的 Yuter 订单 Id。
bookingIdstring
如适用,所创建的凭证 Id。
messagestring
可读消息。
返回代码
为了让商户文档及收银员界面更简单,Yuter 将此集成返回统一成四个顶层代码。
代码
含义
备注
1
成功
订单验证成功或已成功核销。
2
已核销
此订单在本次请求前已完成核销。
3
无效订单
booking id 无效,或找不到相关订单。
4
其他错误
认证失败、不可核销、商户无权限,或其他受控错误。
创建订单 cURL
创建订单 endpoint 的 request 与 response。
cURL 示例
API_KEY='<raw merchant api key>'
TIMESTAMP=$(($(date +%s) * 1000))
NONCE=$(uuidgen)
BODY='{"customer":{"name":"Test User","email":"test@example.com"},"items":[{"programId":"69ce982e96a5b33a356ab001","variantId":"69ce982e96a5b33a356ab002","quantity":1}],"merchantReference":"ORDER-20260411-001"}'
PATH='/api/integrations/merchant/orders/create'
PAYLOAD="POST
$PATH
$TIMESTAMP
$NONCE
$BODY"
SIGNATURE=$(printf "%s" "$PAYLOAD" | openssl dgst -sha256 -hmac "$API_KEY" -hex | sed 's/^.* //')
curl -X POST "https://www.yuterwellness.com$PATH" \
-H "Content-Type: application/json" \
-H "x-api-key: $API_KEY" \
-H "x-timestamp: $TIMESTAMP" \
-H "x-nonce: $NONCE" \
-H "x-signature: $SIGNATURE" \
-d "$BODY"响应示例
{
"code": 1,
"success": true,
"message": "Order created successfully",
"orderId": "69ce982e96a5b33a356ac111",
"bookingId": "69ce982e96a5b33a356abab0"
}