如果订单是在我的平台上创建的,它必须在客户的 shopify 网站上创建订单。我可以读取产品(不幸的是一次只能读取 50 个)但是当我尝试创建订单时出现以下错误:
<块引用>"errors": "出于安全原因,请求使用 HTTP Basic 身份验证不能包含 cookie。”
我通过 POST 请求执行此操作:
const body = `{
"order": {
"email": "john@doe.com",
"fulfillment_status": "fulfilled",
"send_receipt": true,
"send_fulfillment_receipt": true,
"line_items": [
{
"variant_id": 39642695925968,
"quantity": 1
}
]
}
}`;
const init = {
method: 'POST',
body
};
fetch('https://API_KEY:PASSWORD@SHOPNAME.myshopify.com/admin/api/2021-07/orders.json', init)
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
我做错了什么?我的目标是确保客户在他的系统中看到处理的订单并且库存减少。