{"_id":"54cc2149380ecd0d00ca18ce","project":"5436a1e1d0ffee0e00f18f8c","category":{"_id":"54cc2149380ecd0d00ca18b0","pages":["54cc2149380ecd0d00ca18ca","54cc2149380ecd0d00ca18cb","54cc2149380ecd0d00ca18cc","54cc2149380ecd0d00ca18cd","54cc2149380ecd0d00ca18ce","54cc2149380ecd0d00ca18cf","54cc2149380ecd0d00ca18d0","54cc2149380ecd0d00ca18d1"],"project":"5436a1e1d0ffee0e00f18f8c","__v":1,"version":"54cc2148380ecd0d00ca18aa","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2014-10-23T19:03:27.816Z","from_sync":false,"order":6,"slug":"ruby-client","title":"Ruby client"},"user":"5436a1afb7cf0e1c0020d9ca","parentDoc":null,"version":{"_id":"54cc2148380ecd0d00ca18aa","__v":2,"forked_from":"5436a1e1d0ffee0e00f18f8f","project":"5436a1e1d0ffee0e00f18f8c","createdAt":"2015-01-31T00:26:48.753Z","releaseDate":"2015-01-31T00:26:48.753Z","categories":["54cc2149380ecd0d00ca18ab","54cc2149380ecd0d00ca18ac","54cc2149380ecd0d00ca18ad","54cc2149380ecd0d00ca18ae","54cc2149380ecd0d00ca18af","54cc2149380ecd0d00ca18b0","54cc2149380ecd0d00ca18b1","54cc2149380ecd0d00ca18b2","54cc2149380ecd0d00ca18b3","552f29ca633a5b0d00e99d09"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.1.0","version":"1.1"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2014-10-23T19:52:05.685Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"never","params":[],"url":""},"isReference":false,"order":4,"body":"To add an order to a store, simply call the create method on the Order resource class. (A comprehensive list of the data attributes and their definitions can be found below.)\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"payload = { order: \\\"external_order_identifier\\\" => \\\"ABC123\\\", \\\"subtotal_including_tax\\\" => \\\"12.38\\\", ... }\\n\\nShippingEasy::Resources::Order.create(store_api_key: \\\"d8821dde1d32f408def40b77273d5c11\\\", payload: payload)\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\nIf successful the call will return a hash with the ShippingEasy order ID, as well as the external order identifier originally supplied in your call.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{ \\\"order\\\" => { \\\"id\\\" => \\\"27654\\\", \\\"external_order_identifier\\\" => \\\"ABC123\\\" } }\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\n#### Possible Exceptions\n\n##### ShippingEasy::AccessDeniedError\nYour credentials could not be authenticated or the store api_key could not be found.\n\n##### ShippingEasy::InvalidRequestError\nThe order could not be created on the server for one or more of the following reasons:\n\n* The JSON payload could not be parsed.\n* One or more of the supplied data attributes failed validation and is missing or incorrect.\n* An order with the supplied external_order_identifier already exists for that store.\n\nThe exception will contain a message that indicates which of these conditions failed.\n\n#### Order Attributes\n\nThe following is a list of attributes that should be provided to the ShippingEasy_Order object as a associative array.\n\nAn example hash for the create order API call may be found here: https://gist.github.com/twmills/9349053.\n\n**external_order_identifier**\n: *Required.* The e-commerce system's order ID.\n\n**ordered_at**\n: *Required.* Timestamp when the order was created.\n\n**order_status**\n: Possible values are \"awaiting_shipment\", \"awaiting_payment\", \"awaiting_fulfillment\", \"awaiting_shipment\", \"partially_shipped\". Default is \"awaiting_shipment\".\n\n**total_including_tax**\n: Defaults to 0.0 if not specified.\n\n**total_excluding_tax**\n: Defaults to 0.0 if not specified.\n\n**discount_amount**\n: Defaults to 0.0 if not specified.\n\n**coupon_discount**\n: Defaults to 0.0 if not specified.\n\n**subtotal_including_tax**\n: Defaults to 0.0 if not specified.\n\n**subtotal_excluding_tax**\n: Defaults to 0.0 if not specified.\n\n**subtotal_tax**\n: Defaults to 0.0 if not specified.\n\n**total_tax**\n: Defaults to 0.0 if not specified.\n\n**base_shipping_cost**\n: Defaults to 0.0 if not specified.\n\n**shipping_cost_including_tax**\n: Defaults to 0.0 if not specified.\n\n**shipping_cost_excluding_tax**\n: Defaults to 0.0 if not specified.\n\n**shipping_cost_tax**\n: Defaults to 0.0 if not specified.\n\n**base_handling_cost**\n: Defaults to 0.0 if not specified.\n\n**handling_cost_excluding_tax**\n: Defaults to 0.0 if not specified.\n\n**handling_cost_including_tax**\n: Defaults to 0.0 if not specified.\n\n**handling_cost_tax**\n: Defaults to 0.0 if not specified.\n\n**base_wrapping_cost**\n: Defaults to 0.0 if not specified.\n\n**wrapping_cost_excluding_tax**\n: Defaults to 0.0 if not specified.\n\n**wrapping_cost_including_tax**\n: Defaults to 0.0 if not specified.\n\n**wrapping_cost_tax**\n: Defaults to 0.0 if not specified.\n\n**notes**\n: Customer notes on the order.\n\n**billing_company**\n: Company name for billing address\n\n**billing_first_name**\n: Customer first name for billing address\n\n**billing_last_name**\n: Customer last name for billing address\n\n**billing_address**\n: First address line for billing address\n\n**billing_address2**\n: Additional address line for billing address\n\n**billing_city**\n: City name for billing address\n\n**billing_state**\n: State name for billing address\n\n**billing_country**\n: Country name for billing address\n\n**billing_postal_code**\n: Postal code for billing address\n\n**billing_phone_number**\n: Phone number.\n\n**billing_email**\n: Email address\n\n**recipients**\n: A nested associative array of recipient attributes. At least one recipient is required.\n\n**recipients > company**\n: Company name for shipping address\n\n**recipients > first_name**\n: Customer first name for shipping address\n\n**recipients > last_name**\n: Customer last name for shipping address\n\n**recipients > address**\n: *Required.* First address line for shipping address\n\n**recipients > address2**\n: Additional address line for shipping address\n\n**recipients > city**\n: City name for shipping address\n\n**recipients > state**\n: State name for shipping address\n\n**recipients > country**\n: Country name for shipping address\n\n**recipients > residential**\n: Whether or not address is residential or not. Value can be \"true\" or \"false\".\n\n**recipients > postal_code**\n: *Required.* Postal code for shipping address\n\n**recipients > postal_code_plus_4**\n: Postal code plus 4 for shipping address\n\n**recipients > phone_number**\n: Customer phone number\n\n**recipients > email**\n: Customer email address\n\n**recipients > base_cost**\n: Cost before tax for all line items sent to this recipient\n\n**recipients > cost_excluding_tax**\n: Cost before tax for all line items sent to this recipient\n\n**recipients > cost_including_tax**\n: Cost including tax for all line items sent to this recipient\n\n**recipients > cost_tax**\n: Cost of the tax for all line items sent to this recipient\n\n**recipients > base_handling_cost**\n: Handling cost before tax for all line items sent to this recipient\n\n**recipients > handling_cost_excluding_tax**\n: Handling cost before tax for all line items sent to this recipient\n\n**recipients > handling_cost_including_tax**\n: Handling cost including tax for all line items sent to this recipient\n\n**recipients > handling_cost_tax**\n: Handling cost of the tax for all line items sent to this recipient\n\n**recipients > shipping_zone_id**\n: ID of the shipping zone.\n\n**recipients > shipping_zone_name**\n: Name of the shipping zone.\n\n**recipients > shipping_method**\n: Method of shipment.\n\n**recipients > items_total**\n: Total number of items.\n\n**recipients > items_shipped**\n: Total number of items shipped.\n\n**recipients > line_items**\n: A nested associative array of line item attributes. At least one line item is required.\n\n**recipients > line_items > item_name**\n: Name of the item/product.\n\n**recipients > line_items > sku**\n: SKU of the item/product.\n\n**recipients > line_items > bin_picking_number**\n: Bin number where the item may be stored in a warehouse.\n\n**recipients > line_items > weight_in_ounces**\n: Weight of the line item in ounces.\n\n**recipients > line_items > quantity**\n: Quantity of the the items for the line item.\n\n**recipients > line_items > total_excluding_tax**\n: Total excluding tax for the line item.\n\n**recipients > line_items > unit_price**\n: Unit price of the item.\n\n**recipients > line_items > product_options**\n: Hash of product variations applicable to this line item. E.g. {\"color\":\"red\", \"size\":\"XXL\"}","excerpt":"","slug":"creating-an-order","type":"basic","title":"Creating an order"}
To add an order to a store, simply call the create method on the Order resource class. (A comprehensive list of the data attributes and their definitions can be found below.) [block:code] { "codes": [ { "code": "payload = { order: \"external_order_identifier\" => \"ABC123\", \"subtotal_including_tax\" => \"12.38\", ... }\n\nShippingEasy::Resources::Order.create(store_api_key: \"d8821dde1d32f408def40b77273d5c11\", payload: payload)", "language": "ruby" } ] } [/block] If successful the call will return a hash with the ShippingEasy order ID, as well as the external order identifier originally supplied in your call. [block:code] { "codes": [ { "code": "{ \"order\" => { \"id\" => \"27654\", \"external_order_identifier\" => \"ABC123\" } }", "language": "ruby" } ] } [/block] #### Possible Exceptions ##### ShippingEasy::AccessDeniedError Your credentials could not be authenticated or the store api_key could not be found. ##### ShippingEasy::InvalidRequestError The order could not be created on the server for one or more of the following reasons: * The JSON payload could not be parsed. * One or more of the supplied data attributes failed validation and is missing or incorrect. * An order with the supplied external_order_identifier already exists for that store. The exception will contain a message that indicates which of these conditions failed. #### Order Attributes The following is a list of attributes that should be provided to the ShippingEasy_Order object as a associative array. An example hash for the create order API call may be found here: https://gist.github.com/twmills/9349053. **external_order_identifier** : *Required.* The e-commerce system's order ID. **ordered_at** : *Required.* Timestamp when the order was created. **order_status** : Possible values are "awaiting_shipment", "awaiting_payment", "awaiting_fulfillment", "awaiting_shipment", "partially_shipped". Default is "awaiting_shipment". **total_including_tax** : Defaults to 0.0 if not specified. **total_excluding_tax** : Defaults to 0.0 if not specified. **discount_amount** : Defaults to 0.0 if not specified. **coupon_discount** : Defaults to 0.0 if not specified. **subtotal_including_tax** : Defaults to 0.0 if not specified. **subtotal_excluding_tax** : Defaults to 0.0 if not specified. **subtotal_tax** : Defaults to 0.0 if not specified. **total_tax** : Defaults to 0.0 if not specified. **base_shipping_cost** : Defaults to 0.0 if not specified. **shipping_cost_including_tax** : Defaults to 0.0 if not specified. **shipping_cost_excluding_tax** : Defaults to 0.0 if not specified. **shipping_cost_tax** : Defaults to 0.0 if not specified. **base_handling_cost** : Defaults to 0.0 if not specified. **handling_cost_excluding_tax** : Defaults to 0.0 if not specified. **handling_cost_including_tax** : Defaults to 0.0 if not specified. **handling_cost_tax** : Defaults to 0.0 if not specified. **base_wrapping_cost** : Defaults to 0.0 if not specified. **wrapping_cost_excluding_tax** : Defaults to 0.0 if not specified. **wrapping_cost_including_tax** : Defaults to 0.0 if not specified. **wrapping_cost_tax** : Defaults to 0.0 if not specified. **notes** : Customer notes on the order. **billing_company** : Company name for billing address **billing_first_name** : Customer first name for billing address **billing_last_name** : Customer last name for billing address **billing_address** : First address line for billing address **billing_address2** : Additional address line for billing address **billing_city** : City name for billing address **billing_state** : State name for billing address **billing_country** : Country name for billing address **billing_postal_code** : Postal code for billing address **billing_phone_number** : Phone number. **billing_email** : Email address **recipients** : A nested associative array of recipient attributes. At least one recipient is required. **recipients > company** : Company name for shipping address **recipients > first_name** : Customer first name for shipping address **recipients > last_name** : Customer last name for shipping address **recipients > address** : *Required.* First address line for shipping address **recipients > address2** : Additional address line for shipping address **recipients > city** : City name for shipping address **recipients > state** : State name for shipping address **recipients > country** : Country name for shipping address **recipients > residential** : Whether or not address is residential or not. Value can be "true" or "false". **recipients > postal_code** : *Required.* Postal code for shipping address **recipients > postal_code_plus_4** : Postal code plus 4 for shipping address **recipients > phone_number** : Customer phone number **recipients > email** : Customer email address **recipients > base_cost** : Cost before tax for all line items sent to this recipient **recipients > cost_excluding_tax** : Cost before tax for all line items sent to this recipient **recipients > cost_including_tax** : Cost including tax for all line items sent to this recipient **recipients > cost_tax** : Cost of the tax for all line items sent to this recipient **recipients > base_handling_cost** : Handling cost before tax for all line items sent to this recipient **recipients > handling_cost_excluding_tax** : Handling cost before tax for all line items sent to this recipient **recipients > handling_cost_including_tax** : Handling cost including tax for all line items sent to this recipient **recipients > handling_cost_tax** : Handling cost of the tax for all line items sent to this recipient **recipients > shipping_zone_id** : ID of the shipping zone. **recipients > shipping_zone_name** : Name of the shipping zone. **recipients > shipping_method** : Method of shipment. **recipients > items_total** : Total number of items. **recipients > items_shipped** : Total number of items shipped. **recipients > line_items** : A nested associative array of line item attributes. At least one line item is required. **recipients > line_items > item_name** : Name of the item/product. **recipients > line_items > sku** : SKU of the item/product. **recipients > line_items > bin_picking_number** : Bin number where the item may be stored in a warehouse. **recipients > line_items > weight_in_ounces** : Weight of the line item in ounces. **recipients > line_items > quantity** : Quantity of the the items for the line item. **recipients > line_items > total_excluding_tax** : Total excluding tax for the line item. **recipients > line_items > unit_price** : Unit price of the item. **recipients > line_items > product_options** : Hash of product variations applicable to this line item. E.g. {"color":"red", "size":"XXL"}