Skip to main content

Import orders

This endpoint allows you to import a list of transaction orders into your Kameleoon account. You can also use this endpoint to update orders and their properties if they already exist in our database. The data should be sent as a JSON string in the request’s body.

HTTP Request

POST https://api.products.kameleoon.com/sync/orders

List of query parameters

ParameterTypeRequiredDescription
shop_idStringTrueYour Store Key. You can find this in Recommendations > Settings > Store settings in the Kameleoon app. You can also contact your Customer Success Manager for the key.
shop_secretStringTrueYour Secret Key. You can find this in Recommendations > Settings > Store settings in the Kameleoon app. You can also contact your Customer Success Manager for the key.
ordersArrayTrueList of orders. Find in this table the parameters required for orders.

List of parameters for orders object

ParameterTypeRequiredDescription
idStringTrueOrder ID
external_idStringTrueThis is a unique identifier associated with a user in your system or CRM. (To ensure accurate matching with Kameleoon VisitorCode, the ID must first be stored as a Kameleoon Custom Data. When setting up this custom data, make sure to enable the option Use this custom data as a unique identifier for cross-device matching to ensure that the ID is used to link user activities across both systems.)
statusStringTrueOrder status (for example, Processing, Out for delivery, Delivered)
channelStringTrueMedium used for order (for example, Website, App, In-store)
dateIntegerTrueUnix timestamp in seconds of when the order was placed or updated
offlineBooleanFalseFlags orders as offline. It is set to false by default
location_idStringTrueUser's location (city) ID
promocodeStringFalsePromo code used in the order
delivery_typeStringFalseDelivery type (for example, Courier, Pickup in-store)
delivery_addressStringFalseDestination address for CRM
delivery_dateDateFalseExpected delivery date. Format: "YYYY-MM-DD"
delivery_timeTimeFalseExpected delivery time. Format: "HH:MM"
payment_typeStringFalsePayment type (for example, Cash, Card, Wire)
tax_freeBooleanFalseIndicates whether the item is tax-free
bank_issuerStringFalseBank issuer
bank_pos_processorStringFalseIndicates what point of sales (POS) system/terminal was used at the time of payment
bank_loyalty_programStringFalseBank loyalty program
bank_total_installmentIntegerFalseTotal installments needed to be paid through the bank
payment_card_providerStringFalsePayment card provider
gift_packageBooleanFalseIndicates whether the item will be in a gift package
valueObjectTrueOrder grand total. Find the required parameter for value in this table.
payment_structureObjectTrueA breakdown of the payment (for example, cash payments, discounts, delivery fees). Find the parameters required for payment_structure in this table.
itemsObjectTrueEverything that is included in the order. Find the parameters required for items in this table.

List of parameters for value object

ParameterTypeRequiredDescription
TotalNumericTrueOrder total

List of parameters for payment_structure object

ParameterTypeRequiredDescription
cashNumericFalseIndicates what portion of the order total was paid in cash
bonusesNumericFalseIndicates what portion of the order total was paid with bonuses
deliveryNumericFalseIndicates the cost of the order's delivery
discountNumericFalseIndicates the order's discounted value
note

Please ensure that value.total == payment_structure.cash + payment_structure.bonuses + payment_structure.delivery - payment_structure.discount

List of parameters for items object

ParameterTypeRequiredDescription
idStringTruePurchased product's ID
priceNumericTruePrice of a single unit of the product
quantityIntegerTrueTotal quantity of the chosen product(s)
statusStringTrueItem status; can only be: created, invoiced, shipped, delivered, cancelled, refunded
original_priceNumericFalseProduct's original price
discount_productNumericFalseProduct's discounted price
discount_bonusesNumericFalseProduct's discounted bonuses
delivery_companyStringFalsePostal service that delivered the item
barcodeStringFalseProduct's barcode
line_idStringFalseUnique ID for this product's position (line item) in your store's order system.
cancel_reasonStringFalseCancellation reason
note

The items object is required when you create an order. You can send it as an empty array when updating an order's status.

Example JSON request


{
"shop_id": "DvLWN2ZTMZ",
"shop_secret": "EIxTuot8sj",
"orders": [
{
"id": "yKsvZbWpCL",
"external_id":"jhfakfkadak",
"status": "Processing",
"channel": "In-store",
"date": 1602338740,
"offline": false,
"location_id": "7701123",
"promocode": "vxawxSi9Uy",
"delivery_type": "courier",
"delivery_address": "111 Peter Street, Toronto, ON, M5V 2H1",
"delivery_date": "2021-12-21",
"delivery_time": "15:00",
"tax_free": false,
"bank_issuer": "Scotiabank",
"bank_pos_processor": "Clover",
"bank_loyalty_program": "PC Optimum",
"bank_total_installment": 0,
"payment_card_provider": "Visa"
"gift_package":true,
"value": {
"total": 200.13,
},
"payment_structure": {
"cash": 190,
"bonuses": 15,
"delivery": 20,
"discount": 24.87
},
"items": [
{
"id": "ITEM-ID-1",
"price": 205,
"quantity": 1,
"status": "created",
"original_price": 230,
"discount_product": 30,
"discount_bonuses": 20,
"delivery_company": "Canada Post",
"barcode_id": "195204003541",
"line_id": "195204003541-22323443-123434",
"cancel_reason": "none",
},
}
...
]
},
...
]
}

Canceling an order

Since the Import orders endpoint is used for both creating and updating orders, you can use it to register a canceled order.

To register a canceled order, provide the following:

Query parameters

ParameterTypeRequiredDescription
shop_idStringTrueYour Store Key. You can find this in Recommendations > Settings > Store settings in the Kameleoon app. You can also contact your Customer Success Manager for the key.
shop_secretStringTrueYour Secret Key. You can find this in Recommendations > Settings > Store settings in the Kameleoon app. You can also contact your Customer Success Manager for the key.
ordersArrayTrueList of orders. Provide the orders you'd like to register as canceled.

orders object parameters

ParameterTypeRequiredDescription
idStringTrueOrder ID
statusStringTrueOrder's status (set to cancelled)

Example cancellation JSON request

{
"shop_id": "DvLWN2ZTMZ",
"shop_secret": "EIxTuot8sj",
"orders": [
{
"id": "yKsvZbWpCL",
"status": "Cancelled"
},
...
]
}