<?php
//client can de downloaded from https://github.com/Newsman/newsman-api-php
require_once("Newsman/Client.php");
// you can get your API KEY, your newsman_user_id and list_id from My account -> API
$newsman_user_id = "your-username";
$api_key = "your-api-key";
$list_id = "your-list-id";
$orders = array(
array(
"order_no" => 32189883,
"created_at" => "2025-10-15 17:45:14",
"total" => 75.42,
"status" => "shipped",
"email" => "john@doe.com",
"firstname" => "John",
"lastname" => "doe",
"phone" => "747123328",
"currency" => "RON",
"fees" => 10.0524,
"shipping" => 17.5,
"products" => array(
array
(
"id" => 332,
"quantity" => 1,
"price" => 15.69,
"variation_code" => ""
),
array
(
"id" => 331,
"quantity" => 1,
"price" => 15.69,
"variation_code" => ""
),
array
(
"id" => 330,
"quantity" => 1,
"price" => 10.85,
"variation_code" => ""
),
array
(
"id" => 328,
"quantity" => 1,
"price" => 15.69,
"variation_code"s => ""
)
)
),
array(
"order_no" => 40236375,
"created_at" => "2025-10-15 17:44:12",
"total" => 18200,
"status" => "delivered",
"email" => "jack3@doe.com",
"firstname" => "John",
"lastname" => "doe",
"phone" => "747123328",
"currency" => "RON",
"fees" => 3158.6777,
"shipping" => 0,
"products" => array(
array
(
"id" => 352,
"quantity" => 1,
"price" => 16500,
"variation_code" => 100000001
)
)
)
);
try {
$client = new Newsman_Client($newsman_user_id, $api_key);
$ret = $client->remarketing->saveOrders($list_id, $orders);
} catch (Exception $e) {
//do something with the error, eg: log $e->getMessage()
}
return $ret;
?>