跳到主要内容

支付查询 API

支付查询 API 提供了查询订单状态和退款状态的能力,方便开发者在需要时主动查询支付结果。

接入说明​

在进行 API 对接之前,开发者需要获取对应的 服务端令牌 作为 API 访问密钥。

生产环境的 API 使用规则如下:

METHOD PATH HTTP/1.1
Host: minihost.tuanjie.cn
Authorization: Bearer <ServiceToken>
Content-Type: application/json

请求体和响应体默认均为 JSON 格式。

订单查询接口​

开发者可以通过订单查询接口主动查询订单的支付状态。

POST /game-api/v2/orders/order/query

请求参数说明​

字段类型是否必需描述
appidstring是小游戏的 Game ID
cp_order_nostring是游戏订单号(开发者系统生成的订单号)
channel_order_nostring是渠道订单号(平台生成的订单号)

请求示例​

{
"appid": "appid",
"cp_order_no": "cp_order_no",
"channel_order_no": "channel_order_no"
}

响应参数说明​

字段类型描述
codeint200 表示成功
messagestring异常信息
dataObject订单信息

data 对象说明​

字段类型描述
appidstring小游戏的 Game ID
cp_order_nostring游戏订单号
cp_extrastring自定义透传参数
channel_order_nostring渠道订单号
amountint64实际支付金额
quantityint64购买数量
currencystring货币类型,如 CNY
coupon_deduct_amountint64优惠券抵扣金额
product_codestring商品编码
product_namestring商品名称
product_priceint64商品单价
statusstring订单状态
created_timeint64订单创建时间戳

订单状态说明​

状态描述
pending等待支付
complete支付完成
failed支付失败
refunded已退款

响应示例​

{
"code": 200,
"message": "success",
"data": {
"appid": "appid",
"cp_order_no": "cp_order_no",
"cp_extra": "extra_info",
"channel_order_no": "channel_order_no",
"amount": 100,
"quantity": 1,
"currency": "CNY",
"coupon_deduct_amount": 0,
"product_code": "example_product_code",
"product_name": "Example Product",
"product_price": 100,
"status": "pending",
"created_time": 1640995200
}
}

退款查询接口​

开发者可以通过退款查询接口主动查询退款订单的状态。

POST /game-api/v2/orders/refund/query

请求参数说明​

字段类型是否必需描述
appidstring是小游戏的 Game ID
refund_nostring是退款单号

请求示例​

{
"appid": "appid",
"refund_no": "refund_no"
}

响应参数说明​

字段类型描述
codeint200 表示成功
messagestring异常消息
dataObject退款信息

data 对象说明​

字段类型描述
appidstring小游戏的 Game ID
cp_order_nostring游戏订单号
channel_order_nostring渠道订单号
refund_nostring退款单号
refund_amountint64退款金额
created_timeint64退款申请时间戳

响应示例​

{
"code": 200,
"message": "success",
"data": {
"appid": "appid",
"cp_order_no": "cp_order_no",
"channel_order_no": "channel_order_no",
"refund_no": "refund_no",
"refund_amount": 50,
"created_time": 1640995200
}
}