Update sales order
const url = 'https://order.shopgate.io/v1/merchants/example/orders/example';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"externalCode":"000000274","notes":"Please wrap each item individually.","lineItems":[{"code":"386","parentLineItemCode":"286","status":"open","subStatus":"replaced","quantity":1,"routedQuantity":1,"fulfillmentMethod":"directShip","fulfillmentLocationCode":"DERetail001","shipToAddressSequenceIndex":1,"product":{"code":"24-MB02","name":"Fusion Backpack","image":"https://myawesomeshop.com/images/img1.jpg","price":59.99,"salePrice":39.99,"currencyCode":"EUR","identifiers":{"mfgPartNum":"100-440-0.750-3434-A","upc":"\"72527273070\"","ean":"\"401234567890\"","isbn":"978-3-16-148410-0","sku":"UGG-BB-PUR-06","distiPartNum":"\"235454356363\""},"options":[{"code":"color","name":"Color","value":{"code":"red","name":"Red"}}]},"currencyCode":"EUR","shippingAmount":1,"taxAmount":0,"tax2Amount":0,"taxExempt":true,"unitPromoAmount":0,"unitDiscountAmount":0,"discountAmount":0,"promoAmount":0,"overrideAmount":1,"extendedPrice":72,"price":1,"substitutionAllowed":true,"fulfillmentSlot":{"id":"5_2019-09-03","date":"2019-09-03","weekday":"fri","from":"08:00","to":"08:59","status":"active","orderCount":10},"appliedPromotions":[{"code":"2020summerPromotion","name":"Summer Promotion for 2020","model":"simpleDiscount","description":"This promotion is for our summer coupons","promotionalText":"This coupons gives you 10% off to celebrate the summer 2020","status":"active","startDate":"2020-07-01T00:00:000","endDate":"2020-07-01T00:00:000","target":"order","type":"coupon","discount":{"type":"percentage","amount":10},"conditions":{"$and":[{"subTotal":{"gte":100}},{"$or":[{"fulfillmentMethod":{"$in":["directShip","BOPIS","ROPIS"]}},{"customer.segment.code":{"$in":["employees","contractors"]}}]}]},"impact":{"conditions":{"lineItem.product.categoryCode":{"$in":["shirts"]},"lineItem.quantity":1},"automaticallyAddedToCart":false},"coupon":{"code":"summer2020","name":"Coupon 10off for the summer 2020","limits":{"overall":10,"maxPerCustomer":null}},"couponSet":null,"limitConditions":{"maxOverallUsageCount":100,"maxCustomerUsageCount":1,"maxUsagePerOrder":1,"cantBeCombinedWithPromotionCode":{"$in":["bogo1"]}}}],"replacedLineItemId":1,"quantityChangeReason":"wrongItem"}],"specialInstructions":"House behind the dumpster","data":{"collectedLoyaltyPoints":10},"fulfillmentStatus":"open","addressSequences":[{"type":"pickup","firstName":"Max","middleName":null,"lastName":"Muster","mobile":"+49 12345 6789 003","emailAddress":"max.muster@shopgate.com"},{"type":"billing","customerContactId":"0b475af4-7ed9-4065-b4bb-7d76c537d820"},{"type":"shipping","firstName":"Max","middleName":null,"lastName":"Muster","company":"Awesome Company Inc","address1":"1234 Main Street","city":"Butzbach","region":"HE","postalCode":"35510","country":"DE","mobile":"+49 12345 6789 003","emailAddress":"max.muster@shopgate.com","orderSegment":{"selectedShippingMethod":{"code":"express","serviceLevel":{"code":"express","carrier":{"code":"DHL"}}}}}],"paymentTransactions":[{"externalCode":"pi_GTS8a787uuRMaC86GBxpDABYn","paymentMethod":{"code":"stripe"},"authorizedAmount":1}],"primaryBillToAddressSequenceIndex":0,"primaryShipToAddressSequenceIndex":1,"status":"new","sourceIp":"85.45.62.2","userAgent":"Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0","domain":"www.mydomain.com","platform":"engage","os":"ios","subTotal":1,"discountAmount":0,"promoAmount":0,"shippingSubTotal":1,"shippingDiscountAmount":1,"shippingPromoAmount":1,"shippingTotal":1,"taxAmount":0,"tax2Amount":0,"taxSummary":[{"code":"default_19","name":"19%","amount":1.5}],"total":1,"customer":{"attributes":[{"code":"tshirtSize","value":"L"}]}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://order.shopgate.io/v1/merchants/example/orders/example \ --header 'Content-Type: application/json' \ --data '{ "externalCode": "000000274", "notes": "Please wrap each item individually.", "lineItems": [ { "code": "386", "parentLineItemCode": "286", "status": "open", "subStatus": "replaced", "quantity": 1, "routedQuantity": 1, "fulfillmentMethod": "directShip", "fulfillmentLocationCode": "DERetail001", "shipToAddressSequenceIndex": 1, "product": { "code": "24-MB02", "name": "Fusion Backpack", "image": "https://myawesomeshop.com/images/img1.jpg", "price": 59.99, "salePrice": 39.99, "currencyCode": "EUR", "identifiers": { "mfgPartNum": "100-440-0.750-3434-A", "upc": "\"72527273070\"", "ean": "\"401234567890\"", "isbn": "978-3-16-148410-0", "sku": "UGG-BB-PUR-06", "distiPartNum": "\"235454356363\"" }, "options": [ { "code": "color", "name": "Color", "value": { "code": "red", "name": "Red" } } ] }, "currencyCode": "EUR", "shippingAmount": 1, "taxAmount": 0, "tax2Amount": 0, "taxExempt": true, "unitPromoAmount": 0, "unitDiscountAmount": 0, "discountAmount": 0, "promoAmount": 0, "overrideAmount": 1, "extendedPrice": 72, "price": 1, "substitutionAllowed": true, "fulfillmentSlot": { "id": "5_2019-09-03", "date": "2019-09-03", "weekday": "fri", "from": "08:00", "to": "08:59", "status": "active", "orderCount": 10 }, "appliedPromotions": [ { "code": "2020summerPromotion", "name": "Summer Promotion for 2020", "model": "simpleDiscount", "description": "This promotion is for our summer coupons", "promotionalText": "This coupons gives you 10% off to celebrate the summer 2020", "status": "active", "startDate": "2020-07-01T00:00:000", "endDate": "2020-07-01T00:00:000", "target": "order", "type": "coupon", "discount": { "type": "percentage", "amount": 10 }, "conditions": { "$and": [ { "subTotal": { "gte": 100 } }, { "$or": [ { "fulfillmentMethod": { "$in": [ "directShip", "BOPIS", "ROPIS" ] } }, { "customer.segment.code": { "$in": [ "employees", "contractors" ] } } ] } ] }, "impact": { "conditions": { "lineItem.product.categoryCode": { "$in": [ "shirts" ] }, "lineItem.quantity": 1 }, "automaticallyAddedToCart": false }, "coupon": { "code": "summer2020", "name": "Coupon 10off for the summer 2020", "limits": { "overall": 10, "maxPerCustomer": null } }, "couponSet": null, "limitConditions": { "maxOverallUsageCount": 100, "maxCustomerUsageCount": 1, "maxUsagePerOrder": 1, "cantBeCombinedWithPromotionCode": { "$in": [ "bogo1" ] } } } ], "replacedLineItemId": 1, "quantityChangeReason": "wrongItem" } ], "specialInstructions": "House behind the dumpster", "data": { "collectedLoyaltyPoints": 10 }, "fulfillmentStatus": "open", "addressSequences": [ { "type": "pickup", "firstName": "Max", "middleName": null, "lastName": "Muster", "mobile": "+49 12345 6789 003", "emailAddress": "max.muster@shopgate.com" }, { "type": "billing", "customerContactId": "0b475af4-7ed9-4065-b4bb-7d76c537d820" }, { "type": "shipping", "firstName": "Max", "middleName": null, "lastName": "Muster", "company": "Awesome Company Inc", "address1": "1234 Main Street", "city": "Butzbach", "region": "HE", "postalCode": "35510", "country": "DE", "mobile": "+49 12345 6789 003", "emailAddress": "max.muster@shopgate.com", "orderSegment": { "selectedShippingMethod": { "code": "express", "serviceLevel": { "code": "express", "carrier": { "code": "DHL" } } } } } ], "paymentTransactions": [ { "externalCode": "pi_GTS8a787uuRMaC86GBxpDABYn", "paymentMethod": { "code": "stripe" }, "authorizedAmount": 1 } ], "primaryBillToAddressSequenceIndex": 0, "primaryShipToAddressSequenceIndex": 1, "status": "new", "sourceIp": "85.45.62.2", "userAgent": "Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0", "domain": "www.mydomain.com", "platform": "engage", "os": "ios", "subTotal": 1, "discountAmount": 0, "promoAmount": 0, "shippingSubTotal": 1, "shippingDiscountAmount": 1, "shippingPromoAmount": 1, "shippingTotal": 1, "taxAmount": 0, "tax2Amount": 0, "taxSummary": [ { "code": "default_19", "name": "19%", "amount": 1.5 } ], "total": 1, "customer": { "attributes": [ { "code": "tshirtSize", "value": "L" } ] } }'Update sales order
Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Unique merchant code which represents the unique “merchant account”.
Unique order number
Request Body
Section titled “Request Body”object
External order id
Example
000000274Customer notes where the shopper can provide special instructions. The notes are shown in the In-Store App & Admin.
Example
Please wrap each item individually.object
Identifier for the line item. Needs to be unique within the sales order.
Example
386Identifier for the parent line item. Needs to be unique within the sales order.
Example
286Example
inProgressExample
nullExample
1Sum of this line item in fulfillment orders.
Example
1Example
ROPISExample
DERetail001Index of the address in the address sequence array where it should be shipped to
object
Product code
Example
24-MB02Product name
Example
Fusion BackpackMain image url of the product
Example
https://myawesomeshop.com/images/img1.jpgMain price of the product
Example
59.99Sale price of the product
Example
39.99Example
EURobject
Example
100-440-0.750-3434-AExample
"72527273070"Example
"401234567890"Example
978-3-16-148410-0Example
UGG-BB-PUR-06Example
"235454356363"object
Example
colorExample
Colorobject
Example
redExample
RedExample
EURTax amount of the first tax group (e.g. for german taxes this is an absolut number based on either 7% or 19% of the order total; the order total is 10.00 EUR so the taxAmount is 10.00 EUR * 0.19 = 1.9 EUR)
Tax amount of the second tax group (can be used for additional taxes like for example US state taxes)
Amount of all applied promotions for a single unit (single quantity).
Example
-4Amount of all applied discounts (promotions with coupons) for a single unit (single quantity).
Example
-3Total amount of all applied promotions with coupons for the line item. (Formula: lineItem.unitDiscountAmount * lineItem.quantity)
Example
-6Total amount of all applied promotions for the line item. (Formula: lineItem.unitPromoAmount * lineItem.quantity)
Example
-8The extended Price is the final price of the line item, including all discounts & promotions that apply to this line item, and also already multiplied with the quantity. Formula: (product.price or product.salePrice if not empty) * quantity + promoAmount + discountAmount. Example: A product original price is 60€ (product.price), but it is on sale for 40€ (product.salePrice). Ordered quantity is 2, there is no discount but there is a promotion that applies to this product and gives 10% additional discount (unitPromoAmount = 4€, promoAmount = 8€). The extended price of this line item should be (40€ * 2) + (-8€) = 72€.
Example
72Price of the line item
Determines if a substitution is allowed for this line item.
object
Id of the fulfillment slot
Example
5_2019-09-03Hour and minute of the day where the time should start
Example
08:00Example
08:59Limit of orders which can be placed in this slot. This value can only be set for the type fulfillmentSlot
Example
20Example
{ "id": "5_2019-09-03", "date": "2019-09-03", "weekday": "fri", "from": "08:00", "to": "08:59", "status": "active", "orderCount": 10}Applied promotions of the order. If the order is in the status new this parameter will be ignored. The system will automatically calc the promotions for the order
object
Example
2020summerPromotionExample
Summer Promotion for 2020Example
This promotion is for our summer couponsPromotional text that will be displayed to the customer
Example
This coupons gives you 10% off to celebrate the summer 2020Example
2020-07-01T00:00:000Example
2020-07-01T00:00:000Example
couponobject
Example
10object
Example
{ "$and": [ { "subTotal": { "gte": 100 } }, { "$or": [ { "fulfillmentMethod": { "$in": [ "directShip", "BOPIS", "ROPIS" ] } }, { "customer.segment.code": { "$in": [ "employees", "contractors" ] } } ] } ]}Describes the impact of the promotion to specific line items. This only applies to BOGO promotions
object
Condition for products which should be impacted by the promotion
This only applies to BOGO promotions.
Available condition fields are:
- lineItem.product.code
- lineItem.product.categoryCode
- lineItem.product.price
- lineItem.product.salePrice
- lineItem.product.quantity
- lineItem.product.options.<optionsCode>
- lineItem.product.properties.<propertyCode>
Indicates if the product which the customer would receive is automatically added to the cart. This only applies if the condition has one rule with a single product code
Example
{ "conditions": { "lineItem.product.categoryCode": { "$in": [ "shirts" ] }, "lineItem.quantity": 1 }, "automaticallyAddedToCart": false}object
Unique coupon code. This code can be used by the end customer to activate a promotion in his cart.
Example
summer2020Name of the Coupon
Example
Coupons 10offobject
Limit for the overall usage of this coupon
Example
10Indicates how often this coupon can be used per customer
Example
1Example
{ "code": "summer2020", "name": "Coupon 10off for the summer 2020", "limits": { "overall": 10, "maxPerCustomer": null }}object
Example
2020summerSaleCouponsOnly available and must be set for generated couponSet type.
Example
20Example
All summer sale coupons for 2020Example
This coupon set contains all coupons for 2020Example
summer2020-Example
-covidExample
nullSet the limits how often the promotion can be used by a customer and with which other promotion it can be combined. For the field cantBeCombinedWithPromotionCode promotion code(s) can be given or a special code anyProductPromotions|anyOrderPromotions that will exclude any product|order promotion when it gets calculated. Available condition fields are:
- maxOverallUsageCount
- maxCustomerUsageCount
- maxUsagePerOrder (only works for target=product)
- cantBeCombinedWithPromotionCode
Example
{ "maxOverallUsageCount": 100, "maxCustomerUsageCount": 1, "maxUsagePerOrder": 1, "cantBeCombinedWithPromotionCode": { "$in": [ "bogo1" ] }}Reason for a quantity change. Needs to be set if a new quantity is set. Deprecated reasons:
- wrongAttribute
- wrongProduct
- changedMind
- brokenOrDamaged
- outOfStock
Special instructions of the order. It can contain special shipping or fulfillment instructions
Example
House behind the dumpsterExample
{ "collectedLoyaltyPoints": 10}If the array is set it will replace all addresses
object
“addressSequences” must include either a “customerContactId” or all of “firstName”, “lastName” and “emailAddress”
Example
0b475af4-7ed9-4065-b4bb-7d76c537d820“addressSequences” must include either a “customerContactId” or all of “firstName”, “lastName” and “emailAddress”
Example
MaxExample
René“addressSequences” must include either a “customerContactId” or all of “firstName”, “lastName” and “emailAddress”
Example
MusterExample
Shopgate GmbHExample
Schloßstr. 10Example
Haus BExample
erste EtageExample
nullExample
ButzbachExample
HEExample
"35510"ISO 3166 ALPHA-2 / ISO 3166-2 Country Code
Example
DEobject
Number of a postbox
Number of a post
Validated according to country code
Example
+49 12345 6789 001Validated according to country code
Example
+49 12345 6789 002Validated according to country code
Example
+49 12345 6789 003“addressSequences” must include either a “customerContactId” or all of “firstName”, “lastName” and “emailAddress”
Example
max.muster@shopgate.comobject
object
Example
standardShippingobject
Example
standardExample
4.99object
Example
DHLExample
[ { "type": "pickup", "firstName": "Max", "middleName": null, "lastName": "Muster", "mobile": "+49 12345 6789 003", "emailAddress": "max.muster@shopgate.com" }, { "type": "billing", "customerContactId": "0b475af4-7ed9-4065-b4bb-7d76c537d820" }, { "type": "shipping", "firstName": "Max", "middleName": null, "lastName": "Muster", "company": "Awesome Company Inc", "address1": "1234 Main Street", "city": "Butzbach", "region": "HE", "postalCode": "35510", "country": "DE", "mobile": "+49 12345 6789 003", "emailAddress": "max.muster@shopgate.com", "orderSegment": { "selectedShippingMethod": { "code": "express", "serviceLevel": { "code": "express", "carrier": { "code": "DHL" } } } } }]object
External identifier for this transaction
Example
pi_GTS8a787uuRMaC86GBxpDABYnobject
Example
stripeOriginally authorized amount
Position in the AddressSequences-Array, mandatory for all fulfillment methods that include billing like directShip and BOPIS
Example
0Position in the AddressSequences-Array, mandatory for all fulfillment methods that include shipping like directShip
Example
1IP address from the client where the order was placed. It can be a IPv4 or IPv6 address
Example
85.45.62.2The UserAgent string from headers of the incoming request.
Example
Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0The domain from which order came.
Example
www.mydomain.comThe platform from which the order came.
Example
engageOperation system of the source device
Example
iosTotal amount of all applied promotions with coupons on order level. Without line item level promotions, since these are already included in the order subtotal.
Example
0Total amount of all applied promotions on order level. Without line item level promotions, since these are already included in the order subtotal.
Example
-5Tax amount of the first tax group (e.g. for german taxes this is an absolut number based on either 7% or 19% of the order total; the order total is 10.00 EUR so the taxAmount is 10.00 EUR * 0.19 = 1.9 EUR)
Tax amount of the second tax group (can be used for additional taxes like for example US state taxes)
object
Example
default_19Example
19%Example
1.5Updates the given attribute for the newly created anonymous customer
object
Custom customer attribute
object
Code of the defined customer attribute
Example
tshirtSizeValue for this attribute. Its a free text field for attributes where no values are set. Attributes which have value set should contains the code in an object. For instance value: { "code": "fish" }
Example
LResponses
Section titled “Responses”Sales order updated
Validation failed
object
object
Examplegenerated
{ "errors": [ { "entityIndex": 1, "entity": "example", "entityId": "example", "code": 1, "message": "example", "subentityPath": [ "example" ] } ]}
