POST CreateOrderEvent
Create/Update an order event, use these to register events against your order. These can be then taylored to run workflows and perform custom actions, such as sending a variety of email notifications for delivery, shipping etc.
This feature must be enabled for your account.
Input and output parameters
*denotes required field.
Input Parameter Name |
Type/Info |
id |
id of the order event in the system, provide this if you want to update the row. |
event_reference* |
your reference to identify the order event, if no "id" is provided we'll use this to update your event. |
order_id* |
identifier for the order in our system you want to associate the event to. |
event_type* |
cancelled | completed | delivered | dispatched | disputed | fullfilled | processing | refunded. |
event_date* |
date event occurred YYYY-MM-DDTHH:MM:SSZ. |
message |
string of infomation you want to include in your campaigns as a merge-tag. |
order_event_lines |
Optional, by default the system will make all order lines available in workflows/trigger-emails.
To limit this list only add the order_line_id matching your previously created order.
For example to notify the contact, ie X number of products have been shipped.
Input Parameter Name |
Type/Info |
order_line_id* |
This is your order-line reference provided at the point of order creation. See: Create/Update Order |
product_price_tax |
float of price of product's tax. This value will overwrite the order_line product_price_tax, useful when populating partial shipping/refund notifications |
product_original_price |
float of product original price. This value will overwrite the order_line product_original_price, useful when populating partial shipping/refund notifications |
product_price |
float product price. This value will overwrite the order_line product_price, useful when populating partial shipping/refund notifications |
product_price_inc_tax |
float product price with tax. This value will overwrite the order_line product_price_inc_tax, useful when populating partial shipping/refund notifications |
product_price_inc_tax |
float product price with tax. This value will overwrite the order_line roduct_price_inc_tax, useful when populating partial shipping/refund notifications |
quantity |
integer of the number of units. This value will overwrite the order_line quantity, useful when populating partial shipping/refund notifications |
row_total |
float total for this order line with all quantity, cost and any discounts applied. This value will overwrite the order_line row_total, useful when populating partial shipping/refund notifications |
row_total_inc_tax |
float total for this order line with tax. This value will overwrite the order_line row_total_inc_tax, useful when populating partial shipping/refund notifications |
row_total_discount |
float total discount applied for this line. This value will overwrite the order_line row_total_discount, useful when populating partial shipping/refund notifications |
|
custom_fields |
Key value pairs, to populate pre-defined custom fields for this order-event. These can be used as merge tags in your email message. |
|
Outputs: |
|
- id - system id for the order
- status - http status code
- message - action performed
- error - only present during failure
|
Examples
curl --request POST \
--url https://api.wiredplus.com/v1/CreateOrderEvent \
--header 'content-type: application/json' \
--data '{"id": "492a93255ab449008e42200a23a81522","order_id": "113bd4e26ab14d049c931a30eaf7b8c4","event_type": "delivered","event_reference": "abc","event_date": "2020-03-26T16:00:00Z","message": "","order_event_lines":[{"order_line_id":"abc123", "product_price_tax": 1.00, "product_original_price": 2.00, "product_price": 3.00, "product_price_inc_tax": 4.00, "quantity": 5, "row_total": 6.00, "row_total_inc_tax": 7.00, "row_total_discount": 8.00}],"custom_fields":{"tracking_reference":"aaaa-bbbb-cccc","tracking_url":"https://mytrackingsite.com/ordertracking/login"}}'
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.wiredplus.com/v1/CreateOrderEvent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => '{"id": "492a93255ab449008e42200a23a81522","order_id": "113bd4e26ab14d049c931a30eaf7b8c4","event_type": "delivered","event_reference": "abc","event_date": "2020-03-26T16:00:00Z","message": "","order_event_lines":[{"order_line_id":"abc123","product_price_tax": 1.00, "product_original_price": 2.00, "product_price": 3.00, "product_price_inc_tax": 4.00, "quantity": 5, "row_total": 6.00, "row_total_inc_tax": 7.00, "row_total_discount": 8.00}],"custom_fields":{"tracking_reference":"aaaa-bbbb-cccc","tracking_url":"https://mytrackingsite.com/ordertracking/login"}}',
CURLOPT_HTTPHEADER => array(
"content-type: application/json"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
var data = {
"id": "492a93255ab449008e42200a23a81522",
"order_id": "113bd4e26ab14d049c931a30eaf7b8c4",
"event_type": "delivered",
"event_reference": "abc",
"event_date": "2020-03-26T16:00:00Z",
"message": "",
"order_event_lines": {
"order_line_id": "abc123",
"product_price_tax": 1.00,
"product_original_price": 2.00,
"product_price": 3.00,
"product_price_inc_tax": 4.00,
"quantity": 5,
"row_total": 6.00,
"row_total_inc_tax": 7.00,
"row_total_discount": 8.00,
},
"custom_fields": {
"tracking_reference": "aaaa-bbbb-cccc",
"tracking_url": "https://mytrackingsite.com/ordertracking/login"
}
};
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.wiredplus.com/v1/CreateOrderEvent",
"method": "POST",
"headers": {},
"processData": false,
"contentType": false,
"mimeType": "application/json",
"data": JSON.stringify(data)
}
$.ajax(settings).done(function (response) {
console.log(response);
});
Result Format JSON