When trying to create an order in Sitecore CDP
/Sitecore Personalize
, I am sending in an ADD, CONFIRM and CHECKOUT event but my checkout event is continuously failing. Why are some reasons that a CHECKOUT event might fail?
3 Answers
Below are some common issues that cause a CHECKOUT event to fail, resulting in no order being created in Sitecore CDP
/Sitecore Personalize
.
item_id
is in the CONFIRM event, but there is no corresponding ADD event for this item id. For example, if in CONFIRM event, products with item idITEM_1
,ITEM_2
andITEM_3
are included. Then there should be a corresponding ADD event for each withitem_id
ITEM_1, ITEM_2 and ITEM_3. If an ADD event is missing for one of these item_ids in the CONFIRM event, the CHECKOUT event will fail.Missing/Invalid ADD event (check all values supplied are valid against the API documentation, such as using strings instead of numbers). See our documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-an-add-event-to-sitecore-cdp.html
Missing/invalid CONFIRM event. See our documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-a-confirm-event-to-sitecore-cdp.html
Missing/invalid CHECKOUT event . See our documentation: https://doc.sitecore.com/cdp/en/developers/sitecore-customer-data-platform--data-model-2-1/send-a-checkout-event-to-sitecore-cdp.html
For more information see our knowledge hub: https://sitecore.cdpknowledgehub.com/docs/web-tagging-testing-and-troubleshooting#orders-not-created
It can be also wrong format of data in the CONFIRM event. Make sure that you always send list of products as array - even when you want to confirm only one product.
If you send something like that:
var viewEvent = {
"browser_id" : _boxever.getID(),
"channel" : "WEB",
"type" : "CONFIRM",
"language" : "EN",
"currency" : "USD",
"page" : window.location.href,
"pos" : "Sygnity",
"product" :
{"item_id" : "LenovoX1"}
,
"_bx_extended_message" : "1"
};
_boxever.eventCreate(viewEvent, function(data){},"json");
Sitecore CDP will accept it and even (according to the debug mode) process it:
{
"ref": "488ee8a3-f57c-4870-976d-cce0529971ad",
"clientKey": "psfu6uh05hsr9c34rptlr06dn864cqrx",
"createdAt": "2022-02-15T16:00:30.893Z",
"modifiedAt": "2022-02-15T16:00:30.897Z",
"type": "CONFIRM",
"status": "PROCESSED",
"channel": "WEB",
"pointOfSale": "Sygnity",
"browserRef": "31f55dae-04b1-4708-83e7-3f13f8817a7d",
"sessionRef": "6c31e4ba-0263-4cae-b08d-e99bd0aae30a",
"arbitraryData": {
"product": {
"item_id": "LenovoX1"
},
"_bx_version": "1.2",
"language": "EN",
"page": "https://polarized-disco-click.glitch.me/",
"currency": "USD",
"_bx_extended_message": "1"
},
"flowExecution": {}
},
But CHECKOUT event will fail.
If you send the same CONFIRM event with products in array structure:
var viewEvent = {
"browser_id" : _boxever.getID(),
"channel" : "WEB",
"type" : "CONFIRM",
"language" : "EN",
"currency" : "USD",
"page" : window.location.href,
"pos" : "Sygnity",
"product" : [
{"item_id" : "LenovoX1"}
],
"_bx_extended_message" : "1"
};
_boxever.eventCreate(viewEvent, function(data){},"json");
Result in the debug mode will be exactly the same (with different structure of the product data):
{
"ref": "803ee756-84a5-45cb-906c-516f8641aee2",
"clientKey": "psfu6uh05hsr9c34rptlr06dn864cqrx",
"createdAt": "2022-02-15T16:05:30.865Z",
"modifiedAt": "2022-02-15T16:05:30.875Z",
"type": "CONFIRM",
"status": "PROCESSED",
"channel": "WEB",
"pointOfSale": "Sygnity",
"browserRef": "31f55dae-04b1-4708-83e7-3f13f8817a7d",
"sessionRef": "ab65ddc4-e1bf-4b29-9336-501b5bd13751",
"arbitraryData": {
"product": [
{
"item_id": "LenovoX1"
}
],
"_bx_version": "1.2",
"language": "EN",
"page": "https://polarized-disco-click.glitch.me/",
"currency": "USD",
"_bx_extended_message": "1"
},
"flowExecution": {}
}
The difference will be visible in the result of CHECKOUT event which this time will be successful.
You can be also confused with the UI of CDP becasue in two scenarios purchase will be visible as "complete" (even when it failed it is still green).
I had exact same parameters which are required even with the matching item_id
but still checkout event was failing. The root cause for that was having the product type as "FLIGHT" like below.
"product": {
"type": "FLIGHT",
"item_id": "FLIGHT_1",
"name": "DUB-LHR Economy Flight",
"currency": "USD",
"price": 200,
"product_id": "DUB-LHR|Economy|EconomyPlus",
"quantity": 1
}
When I replace type as "FLIGHT" with anything else like "FOOD", it started working.
"product": {
"type": "FOOD",
"item_id": "FLIGHT_1",
"name": "DUB-LHR Economy Flight",
"currency": "USD",
"price": 200,
"product_id": "DUB-LHR|Economy|EconomyPlus",
"quantity": 1
}