如何调用 cs cart api 创建订单?

how to call cs cart api for creating orders?

我正在我的一个 cs 购物车网站中创建 api 功能,并通过 api 功能提交订单。

这适用于新的 windows 服务器、运行 MySQL 5、PHP 5.6 和 IIS。我正在尝试通过邮递员验证传输的数据是什么。

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://my-testwebsite.com/api.php?_d=orders&ajax_custom=1",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\r\n  \"user_id\": \"4\",\r\n  \"shipping_id\": \"0\",\r\n  \"payment_id\": \"6\",\r\n  \"products\": {\r\n      \"1000323256\": {\r\n        \"product_id\": \"1002\",\r\n        \"amount\": \"100\"\r\n       },\r\n      \"103101663\": {\r\n        \"product_id\": \"1002\",\r\n        \"amount\":\"100\"\r\n      }\r\n  }\r\n}",
  CURLOPT_HTTPHEADER => array(
    "Authorization: Basic dmluY2VudC5hcm9ja2lhcmFqQGZ1amlmaWxtLmNvbTplUUE3NzdmN2RrSUR0ODVieVoyM1R0NDYxVzMwRGNTMQ==",
    "Content-Type: application/json",
    "Postman-Token: 050a8bff-d6da-4a0d-b6e8-4cb01bd2c112",
    "cache-control: no-cache"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;

请关注CS-Cart Docs > Developer Guide > REST API > Supported Entities > Orders > Create an Order