0

我正在尝试使用具有以下参数的 Admin API 创建结帐 url。

网址:https://shopy-test11.myshopify.com/admin/api/2020-10/checkouts.json

{
  "checkout": {
    "line_items": [
      {
        "variant_id": 37033347711169,"quantity": 2
        
    }
    ]
  }
}

不幸的是,它返回以下错误,在我能找到的任何地方都没有正确记录。

{
    "errors": {
        "line_items": {
            "0": {
                "variant_id": [
                    {
                        "code": "invalid",
                        "message": "is invalid",
                        "options": {}
                    }
                ]
            }
        }
    }
}

我也试过 Shopify-api ruby​​ gem 并得到同样的错误。网上有一些类似的问题,但没有人回答为什么会出现这个问题以及如何解决它。这是正在开发的新应用程序,它将创建自定义结帐。只有一个销售渠道是“在线商店”,并且适用于所有产品。任何想法如何解决这个问题?任何帮助表示赞赏。

4

1 回答 1

-1

You seem to be mixing up concepts here. The checkout API is only associated with the Storefront API, and has nothing to do with the Admin API.

So this URL: /admin/api/2020-10/checkouts.json seems to be impossible. There is no endpoint in the admin API for checkouts, whereas, Storefront API which does have checkouts, might be your proper URL. So try that:

/api/2020-10/checkouts.json

And if you have the correct token in your header, it will likely work.

于 2020-10-13T19:48:55.167 回答