doukeyong3746487 2015-09-18 16:10
浏览 54

使用BigCommerce API在商店上生成订单时出现问题

I am attempting to generate orders on my BigCommerce store using the BigCommerce API. I am using the code below to accomplish this. I am able to ping BigCommerce just fine and I get no errors in the php code. The problem is that it doesn't ever generate the order on my Bigcommerce store.

require('vendor/autoload.php');

use Bigcommerce\Api\Client as Bigcommerce;

Bigcommerce::configure(array(
'store_url' => 'https://my-store.bigcommerce.com/',
'username'  => 'admin',
'api_key'   => 'XXXXXX'
));

$ping = Bigcommerce::getTime();
if ($ping){ echo $ping->format('H:i:s');}

$createFields = array(
"customer_id" => 0,
"date_created" => $today,
"status_id" => 1,
"billing_address" => array(
        "first_name" => "Trisha",
        "last_name" => "McLaughlin",
        "company" => "",
        "street_1" => "12345 W Anderson Ln",
        "street_2" => "",
        "city" => "Austin",
        "state" => "Texas",
        "zip" => "78757",
        "country" => "United States",
        "country_iso2" => "US",
        "phone" => "",
        "email" => "elsie@example.com"),
"shipping_addresses" => array(
        "first_name" => "Trisha",
        "last_name" => "McLaughlin",
        "company" => "",
        "street_1" => "12345 W Anderson Ln",
        "street_2" => "",
        "city" => "Austin",
        "state" => "Texas",
        "zip" => "78757",
        "country" => "United States",
        "country_iso2" => "US",
        "phone" => "",
        "email" => "elsie@example.com"),
"external_source" => "POS",
"products" => array(
        "product_id" => "90",
        "quantity" => "1"));

print_r(Bigcommerce::createOrder($createFields));

What am I missing?

Am I using the BigCommerce API incorrectly?

Any help on figuring out why my code isn't generating orders on my Bigcommerce store would be awesome!

  • 写回答

4条回答 默认 最新

  • duanlu6114 2015-10-06 22:57
    关注

    Try removing the quotes from the "quantity" parameter in the products array. It's expecting an int instead of a string.

    评论

报告相同问题?

悬赏问题

  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 MATLAB中streamslice问题
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
  • ¥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做蓝牙接受端