Amazon Create Order Flow
The Below Table explains the description of each Block present in Sequence Diagram
Component | Infra Description |
Amazon Smart Connect Platform | Amazon Smart Connect Webhook Event |
Default Service | App Engine Service Name: Default Service |
amzprime-order Service | App Engine Service Name:amzprime-order Service |
PubSub | Topic Name: amzprime_create_order |
WMS Create Order API | API to Create Order in Eshopbox Workspace |
Step 1. The POST endpoint "v1/webhook/orders/created?connectionId={{connectionId}}" will receive the create order event from Amazon Smart Connect Platfrom.
{
"version": "0",
"id": "516848c1-9237-ad5d-2cfa-806bfa34e678",
"detail-type": "Orders.Created",
"source": "com.amazon.yojaka.orders",
"account": "227455371037",
"time": "2021-04-29T02:43:36Z",
"region": "eu-west-1",
"resources": [],
"detail": {
"orderId": "f8f057bc-2179-45eb-ad6f-43630d1d8d24",
"locationId": "05593b4c-eb61-471a-8642-e11f40fb028d",
"merchantId": "AAFR4ZPY4GS0"
}
}
Step 2. Extract the query parameter (connectionId) and orderId from the event.
Step 3. Using connectionId extract channelData(“externalChannelId“, “accountSlug“, “locationId”) only if not present in cache and then set them in cache.
DB Used: eshopbox_client_portal_dev
Table Used: accounts, channels, external_wms_channels.
SELECT
accounts.account_slug AS accountSlug,
channels.connectionId AS connectionId,
channels.externalChannelId AS externalChannelId,
external_wms_channels.locationId AS locationId,
FROM
channels
LEFT JOIN
external_wms_channels
ON channels.id= external_wms_channels.channel_id
LEFT JOIN
accounts
ON channels.account_id = accounts.id
WHERE
channels.connectionId = {{connectionId}}
Step 4. Using orderId extract the order details from Amazon Get Order SDK method.
{
"order": {
"creationTimestamp": 1.620648980981E12,
"id": "1042858d-ae9d-420e-b089-e704c9c6ce03",
"lastUpdatedTimestamp": 1.620650635325E12,
"lineItems": [
{
"cancellations": [],
"charges": [
{
"amount": {
"currency": "INR",
"value": 1500.0
},
"lineItemChargeType": "product",
"name": "OurPrice Principal",
"tax": {
"amount": {
"currency": "INR",
"value": 240.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": 120.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": 120.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "OurPrice Tax",
"rate": 0.16
},
"type": "product"
},
{
"amount": {
"currency": "INR",
"value": -375.0
},
"lineItemChargeType": "productPromotion",
"name": "OurPrice Discount",
"tax": {
"amount": {
"currency": "INR",
"value": -60.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": -30.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": -30.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "OurPrice TaxSaving",
"rate": 0.16
},
"type": "productPromotion"
},
{
"amount": {
"currency": "INR",
"value": 50.0
},
"lineItemChargeType": "giftWrap",
"name": "Giftwrap Principal",
"tax": {
"amount": {
"currency": "INR",
"value": 8.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": 4.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": 4.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "Giftwrap Tax",
"rate": 0.16
},
"type": "giftWrap"
},
{
"amount": {
"currency": "INR",
"value": -25.0
},
"lineItemChargeType": "giftWrapPromotion",
"name": "Giftwrap Discount",
"tax": {
"amount": {
"currency": "INR",
"value": -4.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": -2.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": -2.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "Giftwrap TaxSaving",
"rate": 0.16
},
"type": "giftWrapPromotion"
}
],
"giftAttributes": {
"giftMessagePresent": false,
"giftWrapRequired": false
},
"hazmatLabels": [],
"id": "0",
"marketplaceChannelAttributes": {
"sku": "TestSku1"
},
"merchantSku": "TestSku1",
"numberOfUnits": 5.0,
"serialNumberRequired": false,
"serialNumbers": []
},
{
"cancellations": [],
"charges": [
{
"amount": {
"currency": "INR",
"value": 1000.0
},
"lineItemChargeType": "product",
"name": "OurPrice Principal",
"tax": {
"amount": {
"currency": "INR",
"value": 160.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": 80.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": 80.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "OurPrice Tax",
"rate": 0.16
},
"type": "product"
},
{
"amount": {
"currency": "INR",
"value": -250.0
},
"lineItemChargeType": "productPromotion",
"name": "OurPrice Discount",
"tax": {
"amount": {
"currency": "INR",
"value": -40.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": -20.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": -20.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "OurPrice TaxSaving",
"rate": 0.16
},
"type": "productPromotion"
},
{
"amount": {
"currency": "INR",
"value": 50.0
},
"lineItemChargeType": "giftWrap",
"name": "Giftwrap Principal",
"tax": {
"amount": {
"currency": "INR",
"value": 8.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": 4.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": 4.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "Giftwrap Tax",
"rate": 0.16
},
"type": "giftWrap"
},
{
"amount": {
"currency": "INR",
"value": -25.0
},
"lineItemChargeType": "giftWrapPromotion",
"name": "Giftwrap Discount",
"tax": {
"amount": {
"currency": "INR",
"value": -4.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": -2.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": -2.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "Giftwrap TaxSaving",
"rate": 0.16
},
"type": "giftWrapPromotion"
}
],
"giftAttributes": {
"giftMessagePresent": false,
"giftWrapRequired": false
},
"hazmatLabels": [],
"id": "1",
"marketplaceChannelAttributes": {
"sku": "TestSku3"
},
"merchantSku": "TestSku3",
"numberOfUnits": 5.0,
"serialNumberRequired": false,
"serialNumbers": []
}
],
"locationId": "e5ede046-5f51-4e59-ade4-96e0e6bf613d",
"marketplaceChannelDetails": {
"customerOrderId": "hORk0uaqbf",
"locationId": "Test-location-Eshop",
"marketplaceChannel": {
"channelName": "FBA",
"marketplaceName": "AMAZON_IN"
},
"merchantId": "AAFR4ZPY4GS0",
"shipmentId": "OAfhTyKdaV"
},
"metadata": {
"adapterApp": {
"id": "YojakaFbaAdapterService",
"name": "YojakaFbaAdapterService"
},
"charge": {
"totalAmount": {
"currency": "INR",
"value": 2500.0
},
"totalTax": {
"currency": "INR",
"value": 400.0
}
},
"invoiceInformation": {
"creationTimestamp": 1.620648980078E12,
"id": "EqKYvmJzTc"
},
"orderType": "NEW",
"priority": false
},
"orderCharges": [
{
"amount": {
"currency": "INR",
"value": 100.0
},
"name": "Shipping Principal",
"orderChargeType": "shipping",
"tax": {
"amount": {
"currency": "INR",
"value": 16.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": 8.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": 8.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "Shipping Tax",
"rate": 0.16
}
},
{
"amount": {
"currency": "INR",
"value": -50.0
},
"name": "Shipping Discount",
"orderChargeType": "shippingPromotion",
"tax": {
"amount": {
"currency": "INR",
"value": -8.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": -4.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": -4.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "Shipping TaxSaving",
"rate": 0.16
}
},
{
"amount": {
"currency": "INR",
"value": 1975.0
},
"name": "Total",
"orderChargeType": "total",
"tax": {
"amount": {
"currency": "INR",
"value": 316.0
},
"breakup": [
{
"amount": {
"currency": "INR",
"value": 158.0
},
"name": "SGST",
"rate": 0.08
},
{
"amount": {
"currency": "INR",
"value": 158.0
},
"name": "CGST",
"rate": 0.08
}
],
"name": "Total",
"rate": 0.16
}
}
],
"packages": [
{
"height": {
"dimensionUnit": "CM",
"value": 1.0
},
"id": "4405473214658-846",
"length": {
"dimensionUnit": "CM",
"value": 29.0
},
"packagedLineItems": [
{
"lineItem": {
"id": "0"
},
"quantity": 5.0,
"serialNumbers": []
},
{
"lineItem": {
"id": "1"
},
"quantity": 5.0,
"serialNumbers": []
}
],
"weight": {
"value": 34.0,
"weightUnit": "kilograms"
},
"width": {
"dimensionUnit": "CM",
"value": 1.0
}
}
],
"shippingInfo": {
"expectedShippingTimestamp": 1.621080980077E12,
"recommendedPackages": [
{
"dimensions": {
"height": {
"dimensionUnit": "CM",
"value": 7.4900842621363
},
"length": {
"dimensionUnit": "CM",
"value": 7.114148794237962
},
"width": {
"dimensionUnit": "CM",
"value": 9.230183091462893
}
},
"weight": {
"value": 8.036228863303606,
"weightUnit": "kg"
}
}
],
"recommendedShipMethod": "",
"shipToAddress": {
"encryptionInfo": {
"context": "shipToAddress",
"type": "AWS_KMS"
},
"value": "AYADeFnu+9YxYNIHm/9oxszwfiAAiAADABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREF3UWdwdzh2dGI1aC8ybTR1Unhac0VQTWVJdUhmU0J1YUdVK2kyd3N6VWJoMWdXYXlTRy9JeEhoVC9ORlJiZVViUT09AAZjbGllbnQABnlvamFrYQAIZGF0YVR5cGUADXNoaXBUb0FkZHJlc3MAAQAHYXdzLWttcwBLYXJuOmF3czprbXM6ZXUtd2VzdC0xOjg1OTAwMTAwMzU5MjprZXkvNWU4MGMxZTAtZTZkMS00YjE5LTliNGQtZTcyNTA2NTAxZTE1ALgBAgEAeJRPZRi5hd7lvaXuQmvhxBNqueyu6MnkyqhvSLNyy/9QAUycxhkAp57r5KmcosKfydEAAAB+MHwGCSqGSIb3DQEHBqBvMG0CAQAwaAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAwigtiFSTanI1wWgckCARCAOwd3WrJQ7vzVbGmxwkK2nT/ecuCFfpf3FkWx+tR1MlI9fwV6yDTcL2evPS1XApR8to73cqdjo+/Ilt3zAgAAAAAMAAAQAAAAAAAAAAAAAAAAAESADc878L18uO7yazuKctL/////AAAAAQAAAAAAAAAAAAAAAQAAABcNzf/y8euOnw9Z+F2CmW8NCWqi8tcQAaNcMHU19oZlj+ZC1YvtEhYAZzBlAjEA4+omuHSlkD9NFOQrgkC5IQhVTao7zKokIhLa4SgUid03SGAyOo8skEBiRelFdLBBAjB3Pw9UqAIgpRyU+cJC4tAoy9RUWaBkZbtBeqKykxl/IEGImSbbQn3lS+C9nK4fJMc="
},
"shippingType": "MARKETPLACE"
},
"status": "SHIPLABEL_GENERATED"
},
"sdkResponseMetadata": {
"httpMetadata": {
"allHeaders": {
"x-amz-apigw-id": [
"fHOcuHnAjoEFVUA="
],
"Connection": [
"keep-alive"
],
"x-amzn-RequestId": [
"2d7ac6f4-9a86-4c8a-b51a-e130a5c1cb8d"
],
"Content-Length": [
"23062"
],
"Date": [
"Mon, 10 May 2021 12:44:39 GMT"
],
"X-Amzn-Trace-Id": [
"Root=1-60992ab7-2cdc2a7a7ea2988e6b0a74d4"
],
"Content-Type": [
"application/json"
]
},
"httpHeaders": {
"Connection": "keep-alive",
"Content-Length": "23062",
"Content-Type": "application/json",
"Date": "Mon, 10 May 2021 12:44:39 GMT",
"x-amz-apigw-id": "fHOcuHnAjoEFVUA=",
"x-amzn-RequestId": "2d7ac6f4-9a86-4c8a-b51a-e130a5c1cb8d",
"X-Amzn-Trace-Id": "Root=1-60992ab7-2cdc2a7a7ea2988e6b0a74d4"
},
"httpStatusCode": 200.0
}
}
}
Step 5. Use channelData, event received from Amazon Smart Connect Platfrom and Get Order Details to prepare queueData which will be pushed to PubSub topic “amzprime_create_order” which is subscribed by the POST endpoint "listener/createorder" in esb-amzprime-order-service Repository.
{
"queueData": {
"channelData": {
"externalChannelId": "CH4698",
"accountSlug": "montecarlo",
"connectionId": 294,
"location": {},
"accessToken": "Atza|IwEBILXKb4g1CNQKr-Di92qwiV8JlBzI7eqfXingN4krip_ovDO7-lrgZee_p3FnOwUoMXZpLIInd0PDm6fTbVNyH5_eix01cs2JkIVlMWYDllrVmeLl4-WYHbi-bagIt-2m53sjQfPGgi7gY3FqwXg52uTU6zKgdc-eW7oJUHAIcbHtU3zDvXJGvyejfZmjMd9sSW4NlvVu3sFQtVbmi1AjhlhSk-yLWuS5hKNfzz0Si5jLXEvLptwcZmbgUXWXbSPl7JWJooC5SLMzDyCy9D5eHI-m5shV_NyMiRxPRjzj2Ww0UuF2K20W4rD-Hi8byJObKBen83JTdf96bJn3KouUXCMDv1VuqnLWjOSFOGHs6togCGsWs5ZNkud6GGoDZ7DPjQr61ZFcCZanZTTYNkxhl0mD",
"amzprime_workspaceToken": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1UaERRamxDUlRJelJVUTRRVU0wUVRJNU1FSkVOVGszUVVFeU5qVXdSa1JDTmpBeU16WTROQSJ9.eyJodHRwczovL2FwcERhdGEiOnsiYXBwQ2xpZW50SWQiOiI3NDg4OWI3NDA5NGU2MTFlYmE3MjI4ODgwNmIzYzNjZCJ9LCJodHRwczovL2FjY291bnRTbHVnIjoibW9udGVjYXJsbyIsImh0dHBzOi8vdXNlckRldGFpbHMiOnsiaWQiOjEwMjEsInVzZXJUeXBlIjoiZGVmYXVsdCIsImVtYWlsIjoiYXBwdXNlcjI5QGVzaG9wYm94LmNvbSJ9LCJodHRwczovL2FjY291bnRzIjpbXSwiaHR0cHM6Ly93YXJlaG91c2VzIjpbXSwiaHR0cHM6Ly9wYXJ0bmVycyI6W10sImlzcyI6Imh0dHBzOi8vZXNob3Bib3guYXV0aDAuY29tLyIsInN1YiI6ImF1dGgwfDYwNjJjMTY2YjE0OWM4MDA2OWRmNTI2NiIsImF1ZCI6Imh0dHBzOi8vd21zLm15ZXNob3Bib3guY29tIiwiaWF0IjoxNjE3MTY4OTYyLCJleHAiOjE2MTk3NjA5NjIsImF6cCI6IlF6Vk83ZkhrMkhZeDJZNWIzV0RvaUR1R2U0dkN3akhQIiwic2NvcGUiOiJyZWFkOnByb2R1Y3RfbGlzdGluZ3Mgd3JpdGU6cHJvZHVjdF9saXN0aW5ncyByZWFkOm9yZGVycyByZWFkOnJldHVybnMgd3JpdGU6cmV0dXJucyByZWFkOnBheWFibGVzIHJlYWQ6cGF5b3V0cyByZWFkOmZlZXMiLCJndHkiOiJwYXNzd29yZCJ9.tQ2mSba1nRTG2nu1gUyPANQ8qq5MaaZYY-gInSjLaMMINIILCEzLZb_dDK8zG7xQznJzTYicyO_K5H3I2f6kynU4uT6LUAReBknYzNMd20px2ZtPm5EoTQYGFWE_XcNlOCRdi0JHmvnX48J0nIKyXF5GzZYBb5slhOvK90uRVbLXrK32H_NkF25o87KnJE5446aWzoCfNeuqexTNT5oRqhthx2LEJfu9d1CQJys2T-SR6Nw9Pyx0S2tfx_b55VLt97aLUZFEIGpWJAGaVw9OnX-PFp260Y3naODrciVNBzZxxyb-9CgzuR5QLuSCsR8I-ITTup8ZjV7nZvehoFUfAA"
},
"orderDetail": {
"id": "29f20f95-05d5-423d-9eaa-7da42560fc83",
"locationId": "0d88483e-a595-4388-8450-366a4cdf892c",
"marketplaceChannelDetails": {
"marketplaceChannel": {
"marketplaceName": "AMAZON_IN",
"channelName": "FBA"
},
"locationId": "Eshopbox-test-Node-1",
"shipmentId": "jnd4PnsumT",
"merchantId": "AAFR4ZPY4GS0",
"customerOrderId": "FT5YTP4ROU"
},
"metadata": {
"orderType": "NEW",
"priority": false,
"charge": {
"totalAmount": {
"value": 500.0,
"currency": "INR"
},
"totalTax": {
"value": 80.0,
"currency": "INR"
}
},
"invoiceInformation": {
"id": "jhe7UbhlkS",
"creationTimestamp": 1617181813222
},
"adapterApp": {
"id": "YojakaFbaAdapterService",
"name": "YojakaFbaAdapterService"
}
},
"orderCharges": [
{
"orderChargeType": "shipping",
"name": "Shipping Principal",
"amount": {
"value": 100.0,
"currency": "INR"
},
"tax": {
"breakup": [
{
"name": "SGST",
"rate": 0.08,
"amount": {
"value": 8.0,
"currency": "INR"
}
},
{
"name": "CGST",
"rate": 0.08,
"amount": {
"value": 8.0,
"currency": "INR"
}
}
],
"name": "Shipping Tax",
"rate": 0.16,
"amount": {
"value": 16.0,
"currency": "INR"
}
}
},
{
"orderChargeType": "shippingPromotion",
"name": "Shipping Discount",
"amount": {
"value": -50.0,
"currency": "INR"
},
"tax": {
"breakup": [
{
"name": "SGST",
"rate": 0.08,
"amount": {
"value": -4.0,
"currency": "INR"
}
},
{
"name": "CGST",
"rate": 0.08,
"amount": {
"value": -4.0,
"currency": "INR"
}
}
],
"name": "Shipping TaxSaving",
"rate": 0.16,
"amount": {
"value": -8.0,
"currency": "INR"
}
}
},
{
"orderChargeType": "total",
"name": "Total",
"amount": {
"value": 450.0,
"currency": "INR"
},
"tax": {
"breakup": [
{
"name": "SGST",
"rate": 0.08,
"amount": {
"value": 36.0,
"currency": "INR"
}
},
{
"name": "CGST",
"rate": 0.08,
"amount": {
"value": 36.0,
"currency": "INR"
}
}
],
"name": "Total",
"rate": 0.16,
"amount": {
"value": 72.0,
"currency": "INR"
}
}
}
],
"status": "ACCEPTED",
"creationTimestamp": 1617181814213,
"lastUpdatedTimestamp": 1617181819727,
"shippingInfo": {
"shipToAddress": {
"value": "AYADeGaMDslvc6WkhXNJstLdqu8AiAADABVhd3MtY3J5cHRvLXB1YmxpYy1rZXkAREFqQm1GdTFHcC9XWnlMR0NWU2dHUjZwcXgvbVQyeE93QXN1S1Y0NlhEM1BFeUpReUdER1pyVjJIZTMvd09yZFlCUT09AAZjbGllbnQABnlvamFrYQAIZGF0YVR5cGUADXNoaXBUb0FkZHJlc3MAAQAHYXdzLWttcwBLYXJuOmF3czprbXM6ZXUtd2VzdC0xOjg1OTAwMTAwMzU5MjprZXkvNWU4MGMxZTAtZTZkMS00YjE5LTliNGQtZTcyNTA2NTAxZTE1ALgBAgEAeJRPZRi5hd7lvaXuQmvhxBNqueyu6MnkyqhvSLNyy/9QAZ5EgoG/bD6GAR1IsJsaQTQAAAB+MHwGCSqGSIb3DQEHBqBvMG0CAQAwaAYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAwDBUfe3uyLfFdJBWYCARCAO4a0Ud1QiwRcfA+zB/4s++Z2rtZYaVhATtjNeOaiT8u5PrBPP/cmq9/HrylvC2MWKAwQ15GtDE2fAXbRAgAAAAAMAAAQAAAAAAAAAAAAAAAAACFV/cSxBeWd9AyJSoM35sv/////AAAAAQAAAAAAAAAAAAAAAQAAABeZ6DSl+f9NqtVPmg9HDDC+edClLMc6/IVtCtHpp/3n2ncQbo7OzNMAZzBlAjBahmK/ifowwjtczzqAkzzMx9eIHKBU2P5xbdFphcrvn/nMxWebQAup83FcIVZB4dUCMQD5YR/p6hsI3/BCtzUg6/367ajWekLAnf62DIV5t9Pz5li7wzZlPqemM8GmxJDBUlE=",
"encryptionInfo": {
"type": "AWS_KMS",
"context": "shipToAddress"
}
},
"expectedShippingTimestamp": 1617613813222,
"recommendedShipMethod": "",
"shippingType": "MARKETPLACE",
"recommendedPackages": [
{
"dimensions": {
"length": {
"value": 5.226158302285845,
"dimensionUnit": "CM"
},
"width": {
"value": 3.321689178234958,
"dimensionUnit": "CM"
},
"height": {
"value": 1.8534397560760625,
"dimensionUnit": "CM"
}
},
"weight": {
"value": 7.21675547286458,
"weightUnit": "kg"
}
}
]
},
"lineItems": [
{
"id": "0",
"merchantSku": "TestSku4",
"numberOfUnits": 5,
"cancellations": [],
"serialNumberRequired": false,
"serialNumbers": [],
"hazmatLabelRequired": false,
"hazmatLabels": [],
"giftAttributes": {
"giftMessagePresent": false,
"giftWrapRequired": false
},
"charges": [
{
"type": "product",
"lineItemChargeType": "product",
"name": "OurPrice Principal",
"amount": {
"value": 500.0,
"currency": "INR"
},
"tax": {
"breakup": [
{
"name": "SGST",
"rate": 0.08,
"amount": {
"value": 40.0,
"currency": "INR"
}
},
{
"name": "CGST",
"rate": 0.08,
"amount": {
"value": 40.0,
"currency": "INR"
}
}
],
"name": "OurPrice Tax",
"rate": 0.16,
"amount": {
"value": 80.0,
"currency": "INR"
}
}
},
{
"type": "productPromotion",
"lineItemChargeType": "productPromotion",
"name": "OurPrice Discount",
"amount": {
"value": -125.0,
"currency": "INR"
},
"tax": {
"breakup": [
{
"name": "SGST",
"rate": 0.08,
"amount": {
"value": -10.0,
"currency": "INR"
}
},
{
"name": "CGST",
"rate": 0.08,
"amount": {
"value": -10.0,
"currency": "INR"
}
}
],
"name": "OurPrice TaxSaving",
"rate": 0.16,
"amount": {
"value": -20.0,
"currency": "INR"
}
}
},
{
"type": "giftWrap",
"lineItemChargeType": "giftWrap",
"name": "Giftwrap Principal",
"amount": {
"value": 50.0,
"currency": "INR"
},
"tax": {
"breakup": [
{
"name": "SGST",
"rate": 0.08,
"amount": {
"value": 4.0,
"currency": "INR"
}
},
{
"name": "CGST",
"rate": 0.08,
"amount": {
"value": 4.0,
"currency": "INR"
}
}
],
"name": "Giftwrap Tax",
"rate": 0.16,
"amount": {
"value": 8.0,
"currency": "INR"
}
}
},
{
"type": "giftWrapPromotion",
"lineItemChargeType": "giftWrapPromotion",
"name": "Giftwrap Discount",
"amount": {
"value": -25.0,
"currency": "INR"
},
"tax": {
"breakup": [
{
"name": "SGST",
"rate": 0.08,
"amount": {
"value": -2.0,
"currency": "INR"
}
},
{
"name": "CGST",
"rate": 0.08,
"amount": {
"value": -2.0,
"currency": "INR"
}
}
],
"name": "Giftwrap TaxSaving",
"rate": 0.16,
"amount": {
"value": -4.0,
"currency": "INR"
}
}
}
],
"marketplaceChannelAttributes": {
"sku": "TestSku4"
}
}
],
"packages": []
}
}
}
Step 6. The POST endpoint "listener/createorder" will listen the create order event from the Topic
Step 7. Prepare WMS Request body for Create Order using the event received.
WMS Create Order Keys | Amazon Create Order Keys |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| “0“ (As it is not provided by Yojaka API) |
| “Prepaid” (As it is not provided by Yojaka API) |
| “0“ (Calculation Yet to be Decided) |
| True |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Use “testProduct” as Static Value(Not Provided By Yojaka API) |
|
|
giftWrapPromotion (don’t add this key in WMS request body) |
|
giftWrapCharge (don’t add this key in WMS request body) |
|
| giftWrapCharge - giftWrapPromotion |
|
+
|
| ( |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
shipCharge(don’t add this key in WMS request body) |
+ |
shipChargePromotion(don’t add this key in WMS request body) |
+ |
| shipCharge - shipChargePromotion |
| sum of all |
|
|
WMS Create Order Request Body:
{
"dimension_height": 7.4900842621363,
"promiseDeliveryDate": "",
"vendorOrderNumber": "hORk0uaqbf",
"expectedShipDate": "2021-05-15T17:46:20",
"externalShipmentID": "OAfhTyKdaV",
"customerOrderNumber": "1042858d-ae9d-420e-b089-e704c9c6ce03",
"paymentType": "Prepaid",
"isCOD": "0",
"locationId": "e5ede046-5f51-4e59-ade4-96e0e6bf613d",
"thirdPartyShipping": false,
"balanceDue": 0,
"externalChannelID": "CH0884",
"dimension_width": 9.230183091462893,
"dimension_length": 7.114148794237962,
"weight": 8.036228863303606,
"orderTotal": 1975.0,
"subtotal": 1875,
"shipMethod": "STD",
"shippingAddress": {
"postalCode": "560025",
"customerName": "xyz",
"addressLine1": "Test Address",
"city": "Gurgaon",
"countryCode": "IN",
"countryName": "India",
"contactPhone": "0000000000",
"email": "xyz@test.com",
"state": "Haryana"
},
"billingAddress": {
"postalCode": "560025",
"customerName": "xyz",
"addressLine1": "Test Address",
"city": "Gurgaon",
"countryCode": "IN",
"countryName": "India",
"contactPhone": "0000000000",
"email": "xyz@test.com",
"state": "Haryana"
},
"taxAmount": 400.0,
"orderDate": "2021-05-10T17:46:20",
"externalWarehouseID": "Warehouse",
"items": [
{
"itemID": "TestSku1",
"taxRate": 0.16,
"quantity": 5,
"lineItemSequenceNumber": "0",
"invoiceNumber": "EqKYvmJzTc",
"discount": 375.0,
"isGift": false,
"lineItemTotal": 1740.0,
"isPriorityShipment": false,
"taxAmount": 240.0,
"customerPrice": 1500.0,
"productName": "testProduct"
},
{
"itemID": "TestSku3",
"taxRate": 0.16,
"quantity": 5,
"lineItemSequenceNumber": "1",
"invoiceNumber": "EqKYvmJzTc",
"discount": 250.0,
"isGift": false,
"lineItemTotal": 1160.0,
"isPriorityShipment": false,
"taxAmount": 160.0,
"customerPrice": 1000.0,
"productName": "testProduct"
}
],
"shipChargeAmount": 100.0
}
Step 8.Extract WMS Access Token present in "channelData" by the key name “amzprime_workspaceToken”.
Step 9. Send the WMS Request Body along with access token to WMS Create Order API.
WMS Create Order API: ( httpMethod = POST)
https://wms.eshopbox.com/api/order
Step 10. If order is created successfully then we will get a response of "200 OK" along with a Response Body.
{
"promiseDeliveryDate": "0000-00-00 00:00:00",
"vendorOrderNumber": "hORk0uaqbf",
"expectedShipDate": "2021-05-15 17:46:20",
"created_at": "2021-05-10 17:47:19",
"customerOrderNumber": "1042858d-ae9d-420e-b089-e704c9c6ce03",
"paymentType": "Prepaid",
"isCOD": "0",
"integrationType": "8",
"updated_at": "2021-05-10 17:47:19",
"thirdPartyShipping": false,
"id": 7463364.0,
"onHold": false,
"balanceDue": 0.0,
"externalChannelID": "CH0884",
"orderTotal": 1975.0,
"subtotal": 1875.0,
"shipMethod": "STD",
"shippingAddress": {
"city": "Gurgaon",
"countryCode": "IN",
"postalCode": "560025",
"addressLine1": "Test Address",
"addressLine2": "",
"state": "Haryana",
"countryName": "India",
"contactPhone": "0000000000",
"customerName": "xyz",
"email": "xyz@test.com"
},
"billingAddress": {
"city": "Gurgaon",
"countryCode": "IN",
"postalCode": "560025",
"addressLine1": "Test Address",
"addressLine2": "",
"state": "Haryana",
"countryName": "India",
"contactPhone": "0000000000",
"customerName": "xyz",
"email": "xyz@test.com"
},
"taxAmount": 400.0,
"orderDate": "2021-05-10 17:46:20",
"items": [
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918281",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 75.0,
"giftLabelContent": "",
"lineItemTotal": 348.0,
"customerPrice": 1548.0,
"productName": "testProduct",
"itemID": "TestSku1",
"taxRate": 0.16,
"lineItemSequenceNumber": 0.0,
"sku": "TestSku1",
"taxAmount": 48.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918282",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 75.0,
"giftLabelContent": "",
"lineItemTotal": 348.0,
"customerPrice": 1548.0,
"productName": "testProduct",
"itemID": "TestSku1",
"taxRate": 0.16,
"lineItemSequenceNumber": 0.0,
"sku": "TestSku1",
"taxAmount": 48.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918283",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 75.0,
"giftLabelContent": "",
"lineItemTotal": 348.0,
"customerPrice": 1548.0,
"productName": "testProduct",
"itemID": "TestSku1",
"taxRate": 0.16,
"lineItemSequenceNumber": 0.0,
"sku": "TestSku1",
"taxAmount": 48.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918284",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 75.0,
"giftLabelContent": "",
"lineItemTotal": 348.0,
"customerPrice": 1548.0,
"productName": "testProduct",
"itemID": "TestSku1",
"taxRate": 0.16,
"lineItemSequenceNumber": 0.0,
"sku": "TestSku1",
"taxAmount": 48.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918285",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 75.0,
"giftLabelContent": "",
"lineItemTotal": 348.0,
"customerPrice": 1548.0,
"productName": "testProduct",
"itemID": "TestSku1",
"taxRate": 0.16,
"lineItemSequenceNumber": 0.0,
"sku": "TestSku1",
"taxAmount": 48.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918286",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 50.0,
"giftLabelContent": "",
"lineItemTotal": 232.0,
"customerPrice": 1032.0,
"productName": "testProduct",
"itemID": "TestSku3",
"taxRate": 0.16,
"lineItemSequenceNumber": 1.0,
"sku": "TestSku3",
"taxAmount": 32.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918287",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 50.0,
"giftLabelContent": "",
"lineItemTotal": 232.0,
"customerPrice": 1032.0,
"productName": "testProduct",
"itemID": "TestSku3",
"taxRate": 0.16,
"lineItemSequenceNumber": 1.0,
"sku": "TestSku3",
"taxAmount": 32.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918288",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 50.0,
"giftLabelContent": "",
"lineItemTotal": 232.0,
"customerPrice": 1032.0,
"productName": "testProduct",
"itemID": "TestSku3",
"taxRate": 0.16,
"lineItemSequenceNumber": 1.0,
"sku": "TestSku3",
"taxAmount": 32.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918289",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 50.0,
"giftLabelContent": "",
"lineItemTotal": 232.0,
"customerPrice": 1032.0,
"productName": "testProduct",
"itemID": "TestSku3",
"taxRate": 0.16,
"lineItemSequenceNumber": 1.0,
"sku": "TestSku3",
"taxAmount": 32.0
},
{
"quantity": 1.0,
"giftMessage": "",
"cancellationReason": "",
"orderItemID": "1042858d-ae9d-420e-b089-e704c9c6ce03-17918290",
"cancellationTime": "0000-00-00 00:00:00",
"discount": 50.0,
"giftLabelContent": "",
"lineItemTotal": 232.0,
"customerPrice": 1032.0,
"productName": "testProduct",
"itemID": "TestSku3",
"taxRate": 0.16,
"lineItemSequenceNumber": 1.0,
"sku": "TestSku3",
"taxAmount": 32.0
}
],
"shipChargeAmount": 100.0
}
if order is not create than we will get error responses. for example:
Error Code: 422
Response:
{"customerOrderNumber":["The customerOrderNumber has already been taken."]}