external_order_identifier: order already exists with that identifier

Posted in General by David Addison Fri Jan 22 2016 15:27:42 GMT+0000 (UTC)·2·Viewed 573 times

external_order_identifier order already exists with that identifier I'm feeding an order number into the field when I send the JSON. The number is an integer (e.g. 35900). What am I doing wrong? I'm using the ASP.NET C# Library.
David Addison
Jan 22, 2016

Just to be clear, I am creating a new order. This is my code example. I've redacted some information with *'s. The piece about 'Utilities.SendMail' is sending an email with the response code while we're testing the code.

/-----Shipping Easy API-----------------/
string apiKey = "**";
string apiSecret = "**";
string storeKey = "**";

            var client = new ShippingEasy.Client(apiKey, apiSecret);

            List<CartItem> cartItems = trackingManager.ShoppingCart.DisplayCart();

            ShippingEasy.Order shippingeasyorder = new ShippingEasy.Order
            {   

                ExternalOrderIdentifier = this.trackingManager.LastOrderID.ToString(),
                OrderedAt = DateTime.Now,
                BillingAddress = order.billingAddress1,
                BillingAddress2 = order.billingAddress2,
                BillingCity = order.billingCity,
                BillingCountry = order.billingCountry,
                BillingEmail = order.emailAddress,
                BillingFirstName = order.billingFirstName,
                BillingLastName = order.billingLastName,
                BillingPhoneNumber = order.billingPhone,
                BillingPostalCode = order.billingZip,
                BillingState = order.billingState,
                SubtotalExcludingTax = order.subTotal,
                SubtotalTax = order.tax,
                SubtotalIncludingTax = order.tax + order.subTotal,
                BaseShippingCost = order.shippingAmount,
                TotalIncludingTax = order.total,
                Recipients =
                        {
                            new ShippingEasy.Recipient
                            {
                                FirstName = order.shippingFirstName,
                                LastName = order.shippingLastName,
                                Address = order.shippingAddress1,
                                Address2 = order.shippingAddress2,
                                City = order.shippingCity,
                                State = order.shippingState,
                                Country = order.shippingCountry,
                                PostalCode = order.shippingZip,
                                ShippingMethod = order.shippingMethodID.ToString(),
                                CostExcludingTax = order.subTotal,
                                CostTax = order.tax,
                                CostIncludingTax = order.subTotal + order.tax,
                                Email = order.emailAddress,
                                PhoneNumber = order.shippingPhone
                            }
                        }
            };

            foreach (var item in cartItems)
            {
                shippingeasyorder.Recipients[0].LineItems.Add(new ShippingEasy.LineItem { ItemName = item.shortDescription, Quantity = item.qty, Sku = item.SKU, UnitPrice = item.price });
            }

            ShippingEasy.HttpResponse response = client.CreateOrder(storeKey, shippingeasyorder).HttpResponse;

            Utilities.SendMail("*********", "******", "Shipping Easy Status", "OrderID: " + this.trackingManager.LastOrderID + " Response Status: " + response.Status + " : " + response.Body);

            /*------End Shipping Easy API----------------*/
Jack Ship
Jan 22, 2016

Within a ShippingEasy store, each order that you send must have a unique value for external_order_identifier. What value did you specify when you got that error?

  
Markdown is allowed