How to sync my order with OmniChat
API Order management
Sync delivery, discount, shipping
To synchronize delivery, discount and shipping data with OmniChat, you must call the checkout updates API as shown in the example below:
curl --location 'https://orders-api.omni.chat/v2/orders/{ORDER_ID}/updateCheckoutData' \
--header Authorization:Bearer r:exemplodeapisecret2014 \
--header 'Content-Type: application/json' \
--data '{
"responsible": "personResponsible",
"selectedShippingAddress": {
"addressLine1": "Rua Teste",
"addressLine2": "Próximo a teste",
"zip": "58000000",
"number": "1",
"recipient": "John Doe",
"addressState": "PR",
"city": "Curitiba",
"suburb": "Curitiba",
"country": "BRA"
},
"selectedFreight": {
"deliveryTime": "1bd",
"freightCost": 10,
"shippingMethod": "SEDEX"
},
"discount": {
"value": 0,
"mode": "ABSOLUTE"
}
}'
Request parameters
responsible
This parameter is mandatory and refers to who requested this event.
selectedShippingAddress
This parameter is optional and refers to the customer address in your checkout.
addressLine1
This parameter is mandatory.
addressLine2
This parameter is optional and refers to the address complement.
zip
This parameter is mandatory.
number
This parameter is mandatory.
recipient
This parameter is mandatory.
addressState
This parameter is mandatory.
city
This parameter is mandatory.
suburb
This parameter is mandatory.
country
This parameter is mandatory and refers to the 3-letter country code. Example: BRA (Brazil)
selectedFreight
This parameter is optional and refers to the selected freight in your checkout.
deliveryTime
This parameter is mandatory.
freightCost
This parameter is mandatory.
shippingMethod
This parameter is mandatory.
discount
This parameter is optional and refers to the discount in your checkout.
value
This parameter is mandatory.
mode
This parameter is mandatory.
Value: ABSOLUTE or PERCENTAGE
Sync items
To synchronize items with OmniChat, you must call the checkout updates API as shown in the example below:
curl --location 'https://orders-api.omni.chat/v2/orders/{ORDER_ID}/items' \
--header Authorization:Bearer r:exemplodeapisecret2014 \
--header 'Content-Type: application/json' \
--data '{
"responsible": "personResponsible",
"itemsToAdd": [
{
"quantity": 1,
"price": 50,
"externalProduct": true,
"externalProductData": {
"productReference": "testing-001",
"service": false,
"product": "Mouse Multilaser",
"externalId": "mm-001",
"detail": "teste",
"sellerId": "amz",
"sellerName": "amazon",
"variant": {
"externalImageURL": "https://m.media-amazon.com/images/I/61cvFkNWMhL.__AC_SX300_SY300_QL70_ML2_.jpg",
"name": "G1 sem fio",
"price": 50,
"salePrice": 50,
"sellerId": "amz",
"sellerName": "amazon",
"externalId": "mm-002",
"erpId": "testing-001",
"unitMultiplier": 1
}
}
}
],
"itemsToUpdate": [
{
"objectId": "tO6SzatZzt",
"quantity": 3
}
],
"itemsToRemove": [
{
"objectId": "8YRbLiCF6q"
}
]
}'
Request parameters
responsible
This parameter is optional and refers to who requested this event.
itemsToAdd
This parameter is optional and refers to the items added at your checkout that are not listed in the OmniChat.
quantity
This parameter is mandatory.
price
This parameter is mandatory.
externalProduct
This parameter is mandatory and refers to whether the product is managed by an external integration.
externalProductData
This parameter is mandatory.
externalProductData.productReference
This parameter is optional and refers to the product erpId.
externalProductData.service
This parameter is mandatory.
externalProductData.product
This parameter is mandatory.
externalProductData.externalId
This parameter is mandatory.
externalProductData.detail
This parameter is mandatory.
externalProductData.sellerId
This parameter is optional.
externalProductData.sellerName
This parameter is optional.
externalProductData.variant
This parameter is mandatory.
externalProductData.variant.externalImageURL
This parameter is mandatory.
externalProductData.variant.name
This parameter is mandatory.
externalProductData.variant.price
This parameter is mandatory.
externalProductData.variant.salePrice
This parameter is mandatory.
externalProductData.variant.sellerId
This parameter is mandatory.
externalProductData.variant.sellerName
This parameter is mandatory.
externalProductData.variant.externalId
This parameter is mandatory.
externalProductData.variant.erpId
This parameter is mandatory.
externalProductData.variant.unitMultiplier
This parameter is mandatory.
itemsToUpdate
This parameter is optional.
objectId
This parameter is mandatory and refers to the item id in OmniChat.
quantity
This parameter is mandatory.
itemsToRemove
This parameter is optional.
objectId
This parameter is mandatory and refers to the item id in OmniChat.
Updated about 1 year ago