douque8855 2016-12-08 09:06
浏览 101

如何使用API​​查看我的Shopify订单?

I am using Shopify API to create products and orders. But I can't find a way to checkout my order through api call.

    $request = new CURLCall();
    $line_items = array("line_items" =>
        array(array(
                "variant_id" => 123456789,
                "quantity" => 5))
    );
    $data = json_encode(array("checkout" => $line_items));
    $url = "https://{API_KEY}:{Password}@shop.myshopify.com/admin/checkouts.json";

    // Initialize CURL for PHP
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        'Content-Type: application/json',
        'Content-Length: ' . strlen($data),
        'Accept: application/json')
    );
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
    curl_setopt($curl, CURLOPT_POST, 1);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $data);
    $response = curl_exec($curl);
    print_r($response);

Code above returns this message,

{"errors":"Not Found"}

Thank you.

  • 写回答

1条回答 默认 最新

  • dseax40600 2016-12-08 19:47
    关注

    First off, you cannot checkout an order with the API. Secondly, you can read the abandoned checkouts with your call to the checkouts endpoint.

    If you want to actually cash in an order you create, you would want to create a transaction for the order, not a checkout. You can create capture transactions for example. You can never actually transact money this way though... your customer has to enter their credit card details to turn API created orders into real ones.

    评论

报告相同问题?

悬赏问题

  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端
  • ¥15 基于PLC的三轴机械手程序