https://developers.weixin.qq.com/doc/store/shop/API/order/list_get.htmlhttps://developers.weixin.qq.com/miniprogram/dev/api/open-api/store/wx.openStoreOrderDetail.html
微信小店的token获取成功,但无法获取订单list,报错如下
获取从 2025-04-28 09:27:59 到 2025-04-28 19:27:59 的订单
发生错误: 获取订单列表失败,错误码: 48001, 错误信息: api unauthorized rid: 680f6640-0a5814dc-7658c57b
请检查您的WECHAT_APPID和WECHAT_SECRET环境变量是否正确设置
代码如下:
url = f"https://api.weixin.qq.com/product/order/get_list?access_token={access_token}"
# 构建请求参数
payload = {
"start_create_time": start_create_time,
"end_create_time": end_create_time,
"status": status,
"page": page,
"page_size": page_size,
"source": source
}
# 发送POST请求
response = requests.post(url, json=payload)
# 检查响应状态码
if response.status_code != 200:
raise Exception(f"获取订单列表失败,状态码: {response.status_code}")