Java PHP中的Bigcommerce创建订单错误api
我想在我的bigcommerce商店中添加订单,您是否知道我想使用以下代码:Java PHP中的Bigcommerce创建订单错误api,java,php,jquery,api,bigcommerce,Java,Php,Jquery,Api,Bigcommerce,我想在我的bigcommerce商店中添加订单,您是否知道我想使用以下代码: $billing_array = array(array("first_name"=> "MG", "last_name"=> "Shah", "company"=> "", "street_1"=> "12345 W Ander
$billing_array = array(array("first_name"=> "MG",
"last_name"=> "Shah",
"company"=> "",
"street_1"=> "12345 W Anderson Ln",
"street_2"=> "",
"city"=> "Austin",
"state"=> "Texas",
"zip"=> "78757",
"country"=> "United States",
"country_iso2"=> "US",
"phone"=> "",
"email"=> "a@example.com"),);
$shipping_array = array(
array( "first_name"=> "MG",
"last_name"=> "Shah",
"company"=> "",
"street_1"=> "12345 W Anderson Ln",
"street_2"=> "",
"city"=> "Austin",
"state"=> "Texas",
"zip"=> "78757",
"country"=> "United States",
"country_iso2"=> "US",
"phone"=> "",
"email"=> "a@example.com"
)
,);
$products_array= array();
for($i=0;$i<sizeof($products);$i++)
{
$products_array[] = array(array('product_id' => $products[$i]['products_id'],
'quantity' => $products[$i]['products_qty']),);
}
$createFields= array(
"customer_id" => 0,
"status_id"=> 10,
"billing_address"=> $billing_array,
"shipping_addresses"=>$shipping_array,
"products"=>$products_array,
"external_source"=> "POS"
);
$data_array_jason = json_encode($createFields);
$products_passed = Bigcommerce::createOrder($data_array_jason);
$billing\u array=array(array(“first\u name”=>“MG”,
“姓氏”=>“沙阿”,
“公司”=>“”,
“street_1”=>“12345 W Anderson Ln”,
“街道2=>”,
“城市”=>“奥斯汀”,
“州”=>“德克萨斯州”,
“zip”=>“78757”,
“国家”=>“美国”,
“国家/地区iso2=>“美国”,
“电话”=>“”,
“电子邮件”=>”a@example.com"),);
$shipping\u数组=数组(
数组(“first_name”=>“MG”,
“姓氏”=>“沙阿”,
“公司”=>“”,
“street_1”=>“12345 W Anderson Ln”,
“街道2=>”,
“城市”=>“奥斯汀”,
“州”=>“德克萨斯州”,
“zip”=>“78757”,
“国家”=>“美国”,
“国家/地区iso2=>“美国”,
“电话”=>“”,
“电子邮件”=>”a@example.com"
)
,);
$products_array=array();
对于($i=0;$i$产品[$i]['products\u id'],
“数量”=>$products[$i]['products\U qty'),);
}
$createFields=array(
“客户id”=>0,
“状态标识”=>10,
“计费地址”=>$billing\u数组,
“shipping_addresses”=>$shipping_数组,
“产品”=>$products\U阵列,
“外部_源”=>“位置”
);
$data\u array\u jason=json\u encode($createFields);
$products\u passed=Bigcommerce::createOrder($data\u array\u jason);
我得到了错误
bool(false)
,我在使用POST方法请求时看到了此错误。您对此问题有何答案请指导我。请用下面的数组替换您的数组
$billing_array = array(
"first_name"=> "MG",
"last_name"=> "Shah",
"company"=> "",
"street_1"=> "12345 W Anderson Ln",
"street_2"=> "",
"city"=> "Austin",
"state"=> "Texas",
"zip"=> "78757",
"country"=> "United States",
"country_iso2"=> "US",
"phone"=> "",
"email"=> "a@example.com"
);
$shipping_array = array(
array( "first_name"=> "MG",
"last_name"=> "Shah",
"company"=> "",
"street_1"=> "12345 W Anderson Ln",
"street_2"=> "",
"city"=> "Austin",
"state"=> "Texas",
"zip"=> "78757",
"country"=> "United States",
"country_iso2"=> "US",
"phone"=> "",
"email"=> "a@example.com"
)
,);
$products_array= array();
for($i=0;$i<sizeof($products);$i++){
$products_array[] = array( 'product_id' => $products[$i]['products_id'],
'quantity' => $products[$i]['products_qty']
);
}
$createFields= array(
"customer_id" => 0,
"status_id"=> 10,
"billing_address"=> $billing_array,
"shipping_addresses"=>$shipping_array,
"products"=>$products_array,
"external_source"=> "POS"
);
$data_array_jason = json_encode($createFields);
$products_passed = Bigcommerce::createOrder($data_array_jason);
$billing\u数组=数组(
“名字”=>“MG”,
“姓氏”=>“沙阿”,
“公司”=>“”,
“street_1”=>“12345 W Anderson Ln”,
“街道2=>”,
“城市”=>“奥斯汀”,
“州”=>“德克萨斯州”,
“zip”=>“78757”,
“国家”=>“美国”,
“国家/地区iso2=>“美国”,
“电话”=>“”,
“电子邮件”=>”a@example.com"
);
$shipping\u数组=数组(
数组(“first_name”=>“MG”,
“姓氏”=>“沙阿”,
“公司”=>“”,
“street_1”=>“12345 W Anderson Ln”,
“街道2=>”,
“城市”=>“奥斯汀”,
“州”=>“德克萨斯州”,
“zip”=>“78757”,
“国家”=>“美国”,
“国家/地区iso2=>“美国”,
“电话”=>“”,
“电子邮件”=>”a@example.com"
)
,);
$products_array=array();
对于($i=0;$i$产品[$i]['products\u id'],
“数量”=>$products[$i][“产品数量”]
);
}
$createFields=array(
“客户id”=>0,
“状态标识”=>10,
“计费地址”=>$billing\u数组,
“shipping_addresses”=>$shipping_数组,
“产品”=>$products\U阵列,
“外部_源”=>“位置”
);
$data\u array\u jason=json\u encode($createFields);
$products\u passed=Bigcommerce::createOrder($data\u array\u jason);
然后现在检查它是否正常工作。非常感谢您