use de\xqueue\maileon\api\client\HTTPResponseCodes;
use de\xqueue\maileon\api\client\transactions\TransactionsService;
use de\xqueue\maileon\api\client\transactions\AttributeType;
use de\xqueue\maileon\api\client\transactions\TransactionType;
use de\xqueue\maileon\api\client\transactions\DataType;
// Create the configuration holding the API key
$config = array(
"BASE_URI" => "https://api.maileon.com/1.0",
"API_KEY" => "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"DEBUG" => false
);
// Create the service
$transactionsService = new TransactionsService($config);
// Define the attributes of the transaction type
$attributes = array();
array_push($attributes, new AttributeType(null, "gender", DataType::$STRING, false));
array_push($attributes, new AttributeType(null, "title", DataType::$STRING, false));
array_push($attributes, new AttributeType(null, "first_name", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "last_name", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "phone", DataType::$STRING, false));
array_push($attributes, new AttributeType(null, "campaign", DataType::$STRING, false));
array_push($attributes, new AttributeType(null, "webshop_id", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "language", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "customer_no", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "order_no", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "currency", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "billing_address.name", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "billing_address.street1", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "billing_address.street2", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "billing_address.zip", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "billing_address.city", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "shipping_address.name", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "shipping_address.street1", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "shipping_address.street2", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "shipping_address.zip", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "shipping_address.city", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "items", DataType::$JSON, true));
array_push($attributes, new AttributeType(null, "order_date", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "total", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "payment_type", DataType::$STRING, true));
array_push($attributes, new AttributeType(null, "voucher_code", DataType::$STRING, false));
// And create a transaction type with name "order_confirmation_standard"
$trt = new TransactionType(null, "order_confirmation_standard", $attributes);
// Submit it to Maileon
$response = $transactionsService->createTransactionType($trt);
// Check the response
if ($response->isSuccess()) {
...
} else {
...
}