Hemi Connectors / Magento2 Technical Scope / Magento 2 Connector Integration / Magento 2 Order Management

Magento 2 Order Management

ORDER MANAGEMENT

Summary of Changes: (The purpose of this table is to keep traceability and Product team to highlight the things that were changed into the scope, based on comments or discussions)

Date Version Created / Updated Notes
v1.0 Bogomil Pavlov First publish
25/07/2023 v1.1 Danail Deltchev Clean up
02.08.2023 v1.2 Bogomil Pavlov Additional field and logic
25.08.2023 v1.3 Bogomil Pavlov Product Type changed
21.09.2023 v1.4 Bogomil Pavlov Add rounding for calculated fileds.
10.10.2023 v1.5 Bogomil Pavlov Additional field and logic
02.01.2023 v1.6 Bogomil Pavlov Rename field
30.04.2024 v1.7 Bogomil Pavlov Add Extension Attributes for each product in order
01.07.2024 v1.8 Bogomil Pavlov Include Product Options in Order Export
06.08.2024 v1.9 Bogomil Pavlov Additional Logic for bundles
14.02.2025 v2.0 Bogomil Exclude empty node from payload
27.02.2025 v2.1 Bogomil Extend order shipping method

Order Creation

There is an API method that will allow orders to be created in Magento, https://ccadmin-m2.stage.guidance.com/swagger#/operations/salesOrderRepositoryV1/salesOrderRepositoryV1SavePut

Create orders will work only if we have activated Export Orders flag in magento2_seller table and Active = Yes in magento2_connector. By default we will export only Ready For Shipping orders and after successful export we mark the orders as order_item > magento_exported = yes. Please note we will need to store a proper history for the orders as well. <v1.9>In case of bundle products we want to export the actual components only</v1.9>

Request: PUT /V1/orders/create

Sample Request:

PUT "https://ccadmin-m2.stage.guidance.com/rest/all/V1/orders/create"
-H "accept: application/json"
-H "Content-Type: application/json"
-H "Authorization: Bearer bhhpyso7tb5i5wn0a7oapl0jz99rbqn0"
-d "{
  "entity": {
    "adjustment_negative": 0,
    "adjustment_positive": 0,
    "applied_rule_ids": "string",
    "base_adjustment_negative": 0,
    "base_adjustment_positive": 0,
    "base_currency_code": "string",
    "base_discount_amount": 0,
    "base_discount_canceled": 0,
    "base_discount_invoiced": 0,
    "base_discount_refunded": 0,
    "base_grand_total": 0,
    "base_discount_tax_compensation_amount": 0,
    "base_discount_tax_compensation_invoiced": 0,
    "base_discount_tax_compensation_refunded": 0,
    "base_shipping_amount": 0,
    "base_shipping_canceled": 0,
    "base_shipping_discount_amount": 0,
    "base_shipping_discount_tax_compensation_amnt": 0,
    "base_shipping_incl_tax": 0,
    "base_shipping_invoiced": 0,
    "base_shipping_refunded": 0,
    "base_shipping_tax_amount": 0,
    "base_shipping_tax_refunded": 0,
    "base_subtotal": 0,
    "base_subtotal_canceled": 0,
    "base_subtotal_incl_tax": 0,
    "base_subtotal_invoiced": 0,
    "base_subtotal_refunded": 0,
    "base_tax_amount": 0,
    "base_tax_canceled": 0,
    "base_tax_invoiced": 0,
    "base_tax_refunded": 0,
    "base_total_canceled": 0,
    "base_total_due": 0,
    "base_total_invoiced": 0,
    "base_total_invoiced_cost": 0,
    "base_total_offline_refunded": 0,
    "base_total_online_refunded": 0,
    "base_total_paid": 0,
    "base_total_qty_ordered": 0,
    "base_total_refunded": 0,
    "base_to_global_rate": 0,
    "base_to_order_rate": 0,
    "billing_address_id": 0,
    "can_ship_partially": 0,
    "can_ship_partially_item": 0,
    "coupon_code": "string",
    "created_at": "string",
    "customer_dob": "string",
    "customer_email": "string",
    "customer_firstname": "string",
    "customer_gender": 0,
    "customer_group_id": 0,
    "customer_id": 0,
    "customer_is_guest": 0,
    "customer_lastname": "string",
    "customer_middlename": "string",
    "customer_note": "string",
    "customer_note_notify": 0,
    "customer_prefix": "string",
    "customer_suffix": "string",
    "customer_taxvat": "string",
    "discount_amount": 0,
    "discount_canceled": 0,
    "discount_description": "string",
    "discount_invoiced": 0,
    "discount_refunded": 0,
    "edit_increment": 0,
    "email_sent": 0,
    "entity_id": 0,
    "ext_customer_id": "string",
    "ext_order_id": "string",
    "forced_shipment_with_invoice": 0,
    "global_currency_code": "string",
    "grand_total": 0,
    "discount_tax_compensation_amount": 0,
    "discount_tax_compensation_invoiced": 0,
    "discount_tax_compensation_refunded": 0,
    "hold_before_state": "string",
    "hold_before_status": "string",
    "increment_id": "string",
    "is_virtual": 0,
    "order_currency_code": "string",
    "original_increment_id": "string",
    "payment_authorization_amount": 0,
    "payment_auth_expiration": 0,
    "protect_code": "string",
    "quote_address_id": 0,
    "quote_id": 0,
    "relation_child_id": "string",
    "relation_child_real_id": "string",
    "relation_parent_id": "string",
    "relation_parent_real_id": "string",
    "remote_ip": "string",
    "shipping_amount": 0,
    "shipping_canceled": 0,
    "shipping_description": "string",
    "shipping_discount_amount": 0,
    "shipping_discount_tax_compensation_amount": 0,
    "shipping_incl_tax": 0,
    "shipping_invoiced": 0,
    "shipping_refunded": 0,
    "shipping_tax_amount": 0,
    "shipping_tax_refunded": 0,
    "state": "string",
    "status": "string",
    "store_currency_code": "string",
    "store_id": 0,
    "store_name": "string",
    "store_to_base_rate": 0,
    "store_to_order_rate": 0,
    "subtotal": 0,
    "subtotal_canceled": 0,
    "subtotal_incl_tax": 0,
    "subtotal_invoiced": 0,
    "subtotal_refunded": 0,
    "tax_amount": 0,
    "tax_canceled": 0,
    "tax_invoiced": 0,
    "tax_refunded": 0,
    "total_canceled": 0,
    "total_due": 0,
    "total_invoiced": 0,
    "total_item_count": 0,
    "total_offline_refunded": 0,
    "total_online_refunded": 0,
    "total_paid": 0,
    "total_qty_ordered": 0,
    "total_refunded": 0,
    "updated_at": "string",
    "weight": 0,
    "x_forwarded_for": "string",
    "items": [
      {
        "additional_data": "string",
        "amount_refunded": 0,
        "applied_rule_ids": "string",
        "base_amount_refunded": 0,
        "base_cost": 0,
        "base_discount_amount": 0,
        "base_discount_invoiced": 0,
        "base_discount_refunded": 0,
        "base_discount_tax_compensation_amount": 0,
        "base_discount_tax_compensation_invoiced": 0,
        "base_discount_tax_compensation_refunded": 0,
        "base_original_price": 0,
        "base_price": 0,
        "base_price_incl_tax": 0,
        "base_row_invoiced": 0,
        "base_row_total": 0,
        "base_row_total_incl_tax": 0,
        "base_tax_amount": 0,
        "base_tax_before_discount": 0,
        "base_tax_invoiced": 0,
        "base_tax_refunded": 0,
        "base_weee_tax_applied_amount": 0,
        "base_weee_tax_applied_row_amnt": 0,
        "base_weee_tax_disposition": 0,
        "base_weee_tax_row_disposition": 0,
        "created_at": "string",
        "description": "string",
        "discount_amount": 0,
        "discount_invoiced": 0,
        "discount_percent": 0,
        "discount_refunded": 0,
        "event_id": 0,
        "ext_order_item_id": "string",
        "free_shipping": 0,
        "gw_base_price": 0,
        "gw_base_price_invoiced": 0,
        "gw_base_price_refunded": 0,
        "gw_base_tax_amount": 0,
        "gw_base_tax_amount_invoiced": 0,
        "gw_base_tax_amount_refunded": 0,
        "gw_id": 0,
        "gw_price": 0,
        "gw_price_invoiced": 0,
        "gw_price_refunded": 0,
        "gw_tax_amount": 0,
        "gw_tax_amount_invoiced": 0,
        "gw_tax_amount_refunded": 0,
        "discount_tax_compensation_amount": 0,
        "discount_tax_compensation_canceled": 0,
        "discount_tax_compensation_invoiced": 0,
        "discount_tax_compensation_refunded": 0,
        "is_qty_decimal": 0,
        "is_virtual": 0,
        "item_id": 0,
        "locked_do_invoice": 0,
        "locked_do_ship": 0,
        "name": "string",
        "no_discount": 0,
        "order_id": 0,
        "original_price": 0,
        "parent_item_id": 0,
        "price": 0,
        "price_incl_tax": 0,
        "product_id": 0,
        "product_type": "string",
        "qty_backordered": 0,
        "qty_canceled": 0,
        "qty_invoiced": 0,
        "qty_ordered": 0,
        "qty_refunded": 0,
        "qty_returned": 0,
        "qty_shipped": 0,
        "quote_item_id": 0,
        "row_invoiced": 0,
        "row_total": 0,
        "row_total_incl_tax": 0,
        "row_weight": 0,
        "sku": "string",
        "store_id": 0,
        "tax_amount": 0,
        "tax_before_discount": 0,
        "tax_canceled": 0,
        "tax_invoiced": 0,
        "tax_percent": 0,
        "tax_refunded": 0,
        "updated_at": "string",
        "weee_tax_applied": "string",
        "weee_tax_applied_amount": 0,
        "weee_tax_applied_row_amount": 0,
        "weee_tax_disposition": 0,
        "weee_tax_row_disposition": 0,
        "weight": 0,
        "product_option": {
          "extension_attributes": {
            "custom_options": [
              {
                "option_id": "string",
                "option_value": "string",
                "extension_attributes": {
                  "file_info": {
                    "base64_encoded_data": "string",
                    "type": "string",
                    "name": "string"
                  }
                }
              }
            ],
            "bundle_options": [
              {
                "option_id": 0,
                "option_qty": 0,
                "option_selections": [
                  0
                ],
                "extension_attributes": {}
              }
            ],
            "downloadable_option": {
              "downloadable_links": [
                0
              ]
            },
            "giftcard_item_option": {
              "giftcard_amount": "string",
              "custom_giftcard_amount": 0,
              "giftcard_sender_name": "string",
              "giftcard_recipient_name": "string",
              "giftcard_sender_email": "string",
              "giftcard_recipient_email": "string",
              "giftcard_message": "string",
              "extension_attributes": {
                "giftcard_created_codes": [
                  "string"
                ]
              }
            },
            "configurable_item_options": [
              {
                "option_id": "string",
                "option_value": 0,
                "extension_attributes": {}
              }
            ]
          }
        },
        "extension_attributes": {
          "gift_message": {
            "gift_message_id": 0,
            "customer_id": 0,
            "sender": "string",
            "recipient": "string",
            "message": "string",
            "extension_attributes": {
              "entity_id": "string",
              "entity_type": "string",
              "wrapping_id": 0,
              "wrapping_allow_gift_receipt": true,
              "wrapping_add_printed_card": true
            }
          },
          "gw_id": "string",
          "gw_base_price": "string",
          "gw_price": "string",
          "gw_base_tax_amount": "string",
          "gw_tax_amount": "string",
          "gw_base_price_invoiced": "string",
          "gw_price_invoiced": "string",
          "gw_base_tax_amount_invoiced": "string",
          "gw_tax_amount_invoiced": "string",
          "gw_base_price_refunded": "string",
          "gw_price_refunded": "string",
          "gw_base_tax_amount_refunded": "string",
          "gw_tax_amount_refunded": "string",
          "hs_code": "string",
          "unit_name": "string",
          "unit_amount": 0,
          "pref_program_indicator": "string",
          "sps_order_line_item": {
            "id": 0,
            "order_id": 0,
            "order_line": {
              "id": 0,
              "line_item_id": 0,
              "line_sequence_number": "string",
              "buyer_part_number": "string",
              "vendor_part_number": "string",
              "consumer_package_code": "string",
              "ean": "string",
              "gtin": "string",
              "upc_case_code": "string",
              "product_id": [
                {
                  "id": 0,
                  "order_line_id": 0,
                  "part_number_qual": "string",
                  "part_number": "string"
                }
              ],
              "order_qty": 0,
              "order_qty_uom": "string",
              "purchase_price": 0,
              "buyers_currency": "string",
              "product_size_code": "string",
              "product_size_description": "string",
              "product_color_code": "string",
              "product_color_description": "string",
              "product_material_description": "string",
              "department": "string",
              "class": "string",
              "nrf_standard_color_and_size": {
                "id": 0,
                "order_line_id": 0,
                "nrf_color_code": "string",
                "nrf_size_code": "string"
              }
            },
            "dates": [
              {
                "id": 0,
                "line_item_id": 0,
                "date_time_qualifier": "string",
                "date": "string",
                "time": "string"
              }
            ],
            "price_information": [
              {
                "id": 0,
                "line_item_id": 0,
                "price_type_id_code": "string",
                "unit_price": 0
              }
            ],
            "product_or_item_description": [
              {
                "id": 0,
                "line_item_id": 0,
                "product_characteristic_code": "string",
                "product_description": "string"
              }
            ],
            "physical_details": [
              {
                "id": 0,
                "line_item_id": 0,
                "pack_qualifier": "string",
                "pack_value": 0,
                "pack_size": 0,
                "pack_uom": "string"
              }
            ],
            "references": [
              {
                "id": 0,
                "line_item_id": 0,
                "reference_qual": "string",
                "reference_id": "string",
                "description": "string"
              }
            ],
            "notes": [
              {
                "id": 0,
                "line_item_id": 0,
                "note_code": "string",
                "note": "string"
              }
            ],
            "floor_ready": [
              {
                "id": 0,
                "line_item_id": 0,
                "floor_ready_required": "string",
                "floor_ready_type_code": "string",
                "floor_ready_description": "string",
                "floor_ready_id": "string"
              }
            ],
            "subline": [
              {
                "id": 0,
                "line_item_id": 0,
                "subline_item_detail": {
                  "id": 0,
                  "subline_id": 0,
                  "line_sequence_number": "string",
                  "buyer_part_number": "string",
                  "vendor_part_number": "string",
                  "consumer_package_code": "string",
                  "ean": "string",
                  "gtin": "string",
                  "upc_case_code": "string",
                  "product_id": [
                    {
                      "id": 0,
                      "subline_item_detail_id": 0,
                      "part_number_qual": "string",
                      "part_number": "string"
                    }
                  ],
                  "qty_per": 0,
                  "qty_per_uom": "string",
                  "purchase_price": 0,
                  "buyers_currency": "string",
                  "product_size_code": "string",
                  "product_size_description": "string",
                  "product_color_code": "string",
                  "product_color_description": "string",
                  "product_material_description": "string",
                  "nrf_standard_color_and_size": {
                    "id": 0,
                    "subline_item_detail_id": 0,
                    "nrf_color_code": "string",
                    "nrf_size_code": "string"
                  }
                },
                "price_information": [
                  {
                    "id": 0,
                    "subline_id": 0,
                    "price_type_id_code": "string",
                    "unit_price": 0
                  }
                ],
                "product_or_item_description": [
                  {
                    "id": 0,
                    "subline_id": 0,
                    "product_characteristic_code": "string",
                    "product_description": "string"
                  }
                ],
                "floor_ready": [
                  {
                    "id": 0,
                    "subline_id": 0,
                    "floor_ready_required": "string",
                    "floor_ready_type_code": "string",
                    "floor_ready_description": "string",
                    "floor_ready_id": "string"
                  }
                ]
              }
            ],
            "quantities_schedules_locations": [
              {
                "id": 0,
                "line_item_id": 0,
                "total_qty": 0,
                "total_qty_uom": "string",
                "location_quantity": [
                  {
                    "id": 0,
                    "quantities_schedules_locations_id": 0,
                    "location": "string",
                    "qty": 0
                  }
                ],
                "dates": [
                  {
                    "id": 0,
                    "quantities_schedules_locations_id": 0,
                    "date_time_qualifier": "string",
                    "date": "string",
                    "time": "string"
                  }
                ]
              }
            ],
            "taxes": [
              {
                "id": 0,
                "line_item_id": 0,
                "tax_type_code": "string",
                "tax_amount": 0,
                "tax_percent": 0,
                "jurisdiction_qual": "string",
                "jurisdiction_code": "string",
                "tax_exempt_code": 0,
                "tax_id": "string"
              }
            ],
            "charges_allowances": [
              {
                "id": 0,
                "line_item_id": 0,
                "allow_chrg_indicator": "string",
                "allow_chrg_code": "string",
                "allow_chrg_amt": 0,
                "allow_chrg_percent_qual": 0,
                "allow_chrg_percent": 0,
                "allow_chrg_handling_code": "string",
                "allow_chrg_handling_description": "string"
              }
            ]
          },
          "returnable": true,
          "returnable_reason": "string",
          "ps_item_price": "string",
          "reseller_retail_price": "string",
          "clearance": "string",
          "parent_item_id": "string",
          "price_incl_tax": "string",
          "base_price_incl_tax": "string",
          "final_sale": "string"
        }
      }
    ],
    "billing_address": {
      "address_type": "string",
      "city": "string",
      "company": "string",
      "country_id": "string",
      "customer_address_id": 0,
      "customer_id": 0,
      "email": "string",
      "entity_id": 0,
      "fax": "string",
      "firstname": "string",
      "lastname": "string",
      "middlename": "string",
      "parent_id": 0,
      "postcode": "string",
      "prefix": "string",
      "region": "string",
      "region_code": "string",
      "region_id": 0,
      "street": [
        "string"
      ],
      "suffix": "string",
      "telephone": "string",
      "vat_id": "string",
      "vat_is_valid": 0,
      "vat_request_date": "string",
      "vat_request_id": "string",
      "vat_request_success": 0,
      "extension_attributes": {}
    },
    "payment": {
      "account_status": "string",
      "additional_data": "string",
      "additional_information": [
        "string"
      ],
      "address_status": "string",
      "amount_authorized": 0,
      "amount_canceled": 0,
      "amount_ordered": 0,
      "amount_paid": 0,
      "amount_refunded": 0,
      "anet_trans_method": "string",
      "base_amount_authorized": 0,
      "base_amount_canceled": 0,
      "base_amount_ordered": 0,
      "base_amount_paid": 0,
      "base_amount_paid_online": 0,
      "base_amount_refunded": 0,
      "base_amount_refunded_online": 0,
      "base_shipping_amount": 0,
      "base_shipping_captured": 0,
      "base_shipping_refunded": 0,
      "cc_approval": "string",
      "cc_avs_status": "string",
      "cc_cid_status": "string",
      "cc_debug_request_body": "string",
      "cc_debug_response_body": "string",
      "cc_debug_response_serialized": "string",
      "cc_exp_month": "string",
      "cc_exp_year": "string",
      "cc_last4": "string",
      "cc_number_enc": "string",
      "cc_owner": "string",
      "cc_secure_verify": "string",
      "cc_ss_issue": "string",
      "cc_ss_start_month": "string",
      "cc_ss_start_year": "string",
      "cc_status": "string",
      "cc_status_description": "string",
      "cc_trans_id": "string",
      "cc_type": "string",
      "echeck_account_name": "string",
      "echeck_account_type": "string",
      "echeck_bank_name": "string",
      "echeck_routing_number": "string",
      "echeck_type": "string",
      "entity_id": 0,
      "last_trans_id": "string",
      "method": "string",
      "parent_id": 0,
      "po_number": "string",
      "protection_eligibility": "string",
      "quote_payment_id": 0,
      "shipping_amount": 0,
      "shipping_captured": 0,
      "shipping_refunded": 0,
      "extension_attributes": {
        "notification_message": "string",
        "vault_payment_token": {
          "entity_id": 0,
          "customer_id": 0,
          "public_hash": "string",
          "payment_method_code": "string",
          "type": "string",
          "created_at": "string",
          "expires_at": "string",
          "gateway_token": "string",
          "token_details": "string",
          "is_active": true,
          "is_visible": true
        },
        "afterpay_token": "string",
        "afterpay_order_id": "string"
      }
    },
    "status_histories": [
      {
        "comment": "string",
        "created_at": "string",
        "entity_id": 0,
        "entity_name": "string",
        "is_customer_notified": 0,
        "is_visible_on_front": 0,
        "parent_id": 0,
        "status": "string",
        "extension_attributes": {}
      }
    ],
    "extension_attributes": {
      "shipping_assignments": [
        {
          "shipping": {
            "address": {
              "address_type": "string",
              "city": "string",
              "company": "string",
              "country_id": "string",
              "customer_address_id": 0,
              "customer_id": 0,
              "email": "string",
              "entity_id": 0,
              "fax": "string",
              "firstname": "string",
              "lastname": "string",
              "middlename": "string",
              "parent_id": 0,
              "postcode": "string",
              "prefix": "string",
              "region": "string",
              "region_code": "string",
              "region_id": 0,
              "street": [
                "string"
              ],
              "suffix": "string",
              "telephone": "string",
              "vat_id": "string",
              "vat_is_valid": 0,
              "vat_request_date": "string",
              "vat_request_id": "string",
              "vat_request_success": 0,
              "extension_attributes": {}
            },
            "method": "string",
            "total": {
              "base_shipping_amount": 0,
              "base_shipping_canceled": 0,
              "base_shipping_discount_amount": 0,
              "base_shipping_discount_tax_compensation_amnt": 0,
              "base_shipping_incl_tax": 0,
              "base_shipping_invoiced": 0,
              "base_shipping_refunded": 0,
              "base_shipping_tax_amount": 0,
              "base_shipping_tax_refunded": 0,
              "shipping_amount": 0,
              "shipping_canceled": 0,
              "shipping_discount_amount": 0,
              "shipping_discount_tax_compensation_amount": 0,
              "shipping_incl_tax": 0,
              "shipping_invoiced": 0,
              "shipping_refunded": 0,
              "shipping_tax_amount": 0,
              "shipping_tax_refunded": 0,
              "extension_attributes": {}
            },
            "extension_attributes": {}
          },
          "items": [
            {
              "additional_data": "string",
              "amount_refunded": 0,
              "applied_rule_ids": "string",
              "base_amount_refunded": 0,
              "base_cost": 0,
              "base_discount_amount": 0,
              "base_discount_invoiced": 0,
              "base_discount_refunded": 0,
              "base_discount_tax_compensation_amount": 0,
              "base_discount_tax_compensation_invoiced": 0,
              "base_discount_tax_compensation_refunded": 0,
              "base_original_price": 0,
              "base_price": 0,
              "base_price_incl_tax": 0,
              "base_row_invoiced": 0,
              "base_row_total": 0,
              "base_row_total_incl_tax": 0,
              "base_tax_amount": 0,
              "base_tax_before_discount": 0,
              "base_tax_invoiced": 0,
              "base_tax_refunded": 0,
              "base_weee_tax_applied_amount": 0,
              "base_weee_tax_applied_row_amnt": 0,
              "base_weee_tax_disposition": 0,
              "base_weee_tax_row_disposition": 0,
              "created_at": "string",
              "description": "string",
              "discount_amount": 0,
              "discount_invoiced": 0,
              "discount_percent": 0,
              "discount_refunded": 0,
              "event_id": 0,
              "ext_order_item_id": "string",
              "free_shipping": 0,
              "gw_base_price": 0,
              "gw_base_price_invoiced": 0,
              "gw_base_price_refunded": 0,
              "gw_base_tax_amount": 0,
              "gw_base_tax_amount_invoiced": 0,
              "gw_base_tax_amount_refunded": 0,
              "gw_id": 0,
              "gw_price": 0,
              "gw_price_invoiced": 0,
              "gw_price_refunded": 0,
              "gw_tax_amount": 0,
              "gw_tax_amount_invoiced": 0,
              "gw_tax_amount_refunded": 0,
              "discount_tax_compensation_amount": 0,
              "discount_tax_compensation_canceled": 0,
              "discount_tax_compensation_invoiced": 0,
              "discount_tax_compensation_refunded": 0,
              "is_qty_decimal": 0,
              "is_virtual": 0,
              "item_id": 0,
              "locked_do_invoice": 0,
              "locked_do_ship": 0,
              "name": "string",
              "no_discount": 0,
              "order_id": 0,
              "original_price": 0,
              "parent_item_id": 0,
              "price": 0,
              "price_incl_tax": 0,
              "product_id": 0,
              "product_type": "string",
              "qty_backordered": 0,
              "qty_canceled": 0,
              "qty_invoiced": 0,
              "qty_ordered": 0,
              "qty_refunded": 0,
              "qty_returned": 0,
              "qty_shipped": 0,
              "quote_item_id": 0,
              "row_invoiced": 0,
              "row_total": 0,
              "row_total_incl_tax": 0,
              "row_weight": 0,
              "sku": "string",
              "store_id": 0,
              "tax_amount": 0,
              "tax_before_discount": 0,
              "tax_canceled": 0,
              "tax_invoiced": 0,
              "tax_percent": 0,
              "tax_refunded": 0,
              "updated_at": "string",
              "weee_tax_applied": "string",
              "weee_tax_applied_amount": 0,
              "weee_tax_applied_row_amount": 0,
              "weee_tax_disposition": 0,
              "weee_tax_row_disposition": 0,
              "weight": 0,
              "product_option": {
                "extension_attributes": {
                  "custom_options": [
                    {
                      "option_id": "string",
                      "option_value": "string",
                      "extension_attributes": {
                        "file_info": {
                          "base64_encoded_data": "string",
                          "type": "string",
                          "name": "string"
                        }
                      }
                    }
                  ],
                  "bundle_options": [
                    {
                      "option_id": 0,
                      "option_qty": 0,
                      "option_selections": [
                        0
                      ],
                      "extension_attributes": {}
                    }
                  ],
                  "downloadable_option": {
                    "downloadable_links": [
                      0
                    ]
                  },
                  "giftcard_item_option": {
                    "giftcard_amount": "string",
                    "custom_giftcard_amount": 0,
                    "giftcard_sender_name": "string",
                    "giftcard_recipient_name": "string",
                    "giftcard_sender_email": "string",
                    "giftcard_recipient_email": "string",
                    "giftcard_message": "string",
                    "extension_attributes": {
                      "giftcard_created_codes": [
                        "string"
                      ]
                    }
                  },
                  "configurable_item_options": [
                    {
                      "option_id": "string",
                      "option_value": 0,
                      "extension_attributes": {}
                    }
                  ]
                }
              },
              "extension_attributes": {
                "gift_message": {
                  "gift_message_id": 0,
                  "customer_id": 0,
                  "sender": "string",
                  "recipient": "string",
                  "message": "string",
                  "extension_attributes": {
                    "entity_id": "string",
                    "entity_type": "string",
                    "wrapping_id": 0,
                    "wrapping_allow_gift_receipt": true,
                    "wrapping_add_printed_card": true
                  }
                },
                "gw_id": "string",
                "gw_base_price": "string",
                "gw_price": "string",
                "gw_base_tax_amount": "string",
                "gw_tax_amount": "string",
                "gw_base_price_invoiced": "string",
                "gw_price_invoiced": "string",
                "gw_base_tax_amount_invoiced": "string",
                "gw_tax_amount_invoiced": "string",
                "gw_base_price_refunded": "string",
                "gw_price_refunded": "string",
                "gw_base_tax_amount_refunded": "string",
                "gw_tax_amount_refunded": "string",
                "hs_code": "string",
                "unit_name": "string",
                "unit_amount": 0,
                "pref_program_indicator": "string",
                "sps_order_line_item": {
                  "id": 0,
                  "order_id": 0,
                  "order_line": {
                    "id": 0,
                    "line_item_id": 0,
                    "line_sequence_number": "string",
                    "buyer_part_number": "string",
                    "vendor_part_number": "string",
                    "consumer_package_code": "string",
                    "ean": "string",
                    "gtin": "string",
                    "upc_case_code": "string",
                    "product_id": [
                      {
                        "id": 0,
                        "order_line_id": 0,
                        "part_number_qual": "string",
                        "part_number": "string"
                      }
                    ],
                    "order_qty": 0,
                    "order_qty_uom": "string",
                    "purchase_price": 0,
                    "buyers_currency": "string",
                    "product_size_code": "string",
                    "product_size_description": "string",
                    "product_color_code": "string",
                    "product_color_description": "string",
                    "product_material_description": "string",
                    "department": "string",
                    "class": "string",
                    "nrf_standard_color_and_size": {
                      "id": 0,
                      "order_line_id": 0,
                      "nrf_color_code": "string",
                      "nrf_size_code": "string"
                    }
                  },
                  "dates": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "date_time_qualifier": "string",
                      "date": "string",
                      "time": "string"
                    }
                  ],
                  "price_information": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "price_type_id_code": "string",
                      "unit_price": 0
                    }
                  ],
                  "product_or_item_description": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "product_characteristic_code": "string",
                      "product_description": "string"
                    }
                  ],
                  "physical_details": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "pack_qualifier": "string",
                      "pack_value": 0,
                      "pack_size": 0,
                      "pack_uom": "string"
                    }
                  ],
                  "references": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "reference_qual": "string",
                      "reference_id": "string",
                      "description": "string"
                    }
                  ],
                  "notes": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "note_code": "string",
                      "note": "string"
                    }
                  ],
                  "floor_ready": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "floor_ready_required": "string",
                      "floor_ready_type_code": "string",
                      "floor_ready_description": "string",
                      "floor_ready_id": "string"
                    }
                  ],
                  "subline": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "subline_item_detail": {
                        "id": 0,
                        "subline_id": 0,
                        "line_sequence_number": "string",
                        "buyer_part_number": "string",
                        "vendor_part_number": "string",
                        "consumer_package_code": "string",
                        "ean": "string",
                        "gtin": "string",
                        "upc_case_code": "string",
                        "product_id": [
                          {
                            "id": 0,
                            "subline_item_detail_id": 0,
                            "part_number_qual": "string",
                            "part_number": "string"
                          }
                        ],
                        "qty_per": 0,
                        "qty_per_uom": "string",
                        "purchase_price": 0,
                        "buyers_currency": "string",
                        "product_size_code": "string",
                        "product_size_description": "string",
                        "product_color_code": "string",
                        "product_color_description": "string",
                        "product_material_description": "string",
                        "nrf_standard_color_and_size": {
                          "id": 0,
                          "subline_item_detail_id": 0,
                          "nrf_color_code": "string",
                          "nrf_size_code": "string"
                        }
                      },
                      "price_information": [
                        {
                          "id": 0,
                          "subline_id": 0,
                          "price_type_id_code": "string",
                          "unit_price": 0
                        }
                      ],
                      "product_or_item_description": [
                        {
                          "id": 0,
                          "subline_id": 0,
                          "product_characteristic_code": "string",
                          "product_description": "string"
                        }
                      ],
                      "floor_ready": [
                        {
                          "id": 0,
                          "subline_id": 0,
                          "floor_ready_required": "string",
                          "floor_ready_type_code": "string",
                          "floor_ready_description": "string",
                          "floor_ready_id": "string"
                        }
                      ]
                    }
                  ],
                  "quantities_schedules_locations": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "total_qty": 0,
                      "total_qty_uom": "string",
                      "location_quantity": [
                        {
                          "id": 0,
                          "quantities_schedules_locations_id": 0,
                          "location": "string",
                          "qty": 0
                        }
                      ],
                      "dates": [
                        {
                          "id": 0,
                          "quantities_schedules_locations_id": 0,
                          "date_time_qualifier": "string",
                          "date": "string",
                          "time": "string"
                        }
                      ]
                    }
                  ],
                  "taxes": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "tax_type_code": "string",
                      "tax_amount": 0,
                      "tax_percent": 0,
                      "jurisdiction_qual": "string",
                      "jurisdiction_code": "string",
                      "tax_exempt_code": 0,
                      "tax_id": "string"
                    }
                  ],
                  "charges_allowances": [
                    {
                      "id": 0,
                      "line_item_id": 0,
                      "allow_chrg_indicator": "string",
                      "allow_chrg_code": "string",
                      "allow_chrg_amt": 0,
                      "allow_chrg_percent_qual": 0,
                      "allow_chrg_percent": 0,
                      "allow_chrg_handling_code": "string",
                      "allow_chrg_handling_description": "string"
                    }
                  ]
                },
                "returnable": true,
                "returnable_reason": "string",
                "ps_item_price": "string",
                "reseller_retail_price": "string",
                "clearance": "string",
                "parent_item_id": "string",
                "price_incl_tax": "string",
                "base_price_incl_tax": "string",
                "final_sale": "string"
              }
            }
          ],
          "stock_id": 0,
          "extension_attributes": {}
        }
      ],
      "payment_additional_info": [
        {
          "key": "string",
          "value": "string"
        }
      ],
      "base_customer_balance_amount": 0,
      "customer_balance_amount": 0,
      "base_customer_balance_invoiced": 0,
      "customer_balance_invoiced": 0,
      "base_customer_balance_refunded": 0,
      "customer_balance_refunded": 0,
      "base_customer_balance_total_refunded": 0,
      "customer_balance_total_refunded": 0,
      "gift_cards": [
        {
          "id": 0,
          "code": "string",
          "amount": 0,
          "base_amount": 0
        }
      ],
      "base_gift_cards_amount": 0,
      "gift_cards_amount": 0,
      "base_gift_cards_invoiced": 0,
      "gift_cards_invoiced": 0,
      "base_gift_cards_refunded": 0,
      "gift_cards_refunded": 0,
      "applied_taxes": [
        {
          "code": "string",
          "title": "string",
          "percent": 0,
          "amount": 0,
          "base_amount": 0,
          "extension_attributes": {
            "rates": [
              {
                "code": "string",
                "title": "string",
                "percent": 0,
                "extension_attributes": {
                  "rate_percent": 0,
                  "tax_name": "string",
                  "juris_code": "string",
                  "taxable": 0,
                  "tax": 0
                }
              }
            ]
          }
        }
      ],
      "item_applied_taxes": [
        {
          "type": "string",
          "item_id": 0,
          "associated_item_id": 0,
          "applied_taxes": [
            {
              "code": "string",
              "title": "string",
              "percent": 0,
              "amount": 0,
              "base_amount": 0,
              "extension_attributes": {
                "rates": [
                  {
                    "code": "string",
                    "title": "string",
                    "percent": 0,
                    "extension_attributes": {
                      "rate_percent": 0,
                      "tax_name": "string",
                      "juris_code": "string",
                      "taxable": 0,
                      "tax": 0
                    }
                  }
                ]
              }
            }
          ],
          "extension_attributes": {}
        }
      ],
      "converting_from_quote": true,
      "gift_message": {
        "gift_message_id": 0,
        "customer_id": 0,
        "sender": "string",
        "recipient": "string",
        "message": "string",
        "extension_attributes": {
          "entity_id": "string",
          "entity_type": "string",
          "wrapping_id": 0,
          "wrapping_allow_gift_receipt": true,
          "wrapping_add_printed_card": true
        }
      },
      "gw_id": "string",
      "gw_allow_gift_receipt": "string",
      "gw_add_card": "string",
      "gw_base_price": "string",
      "gw_price": "string",
      "gw_items_base_price": "string",
      "gw_items_price": "string",
      "gw_card_base_price": "string",
      "gw_card_price": "string",
      "gw_base_tax_amount": "string",
      "gw_tax_amount": "string",
      "gw_items_base_tax_amount": "string",
      "gw_items_tax_amount": "string",
      "gw_card_base_tax_amount": "string",
      "gw_card_tax_amount": "string",
      "gw_base_price_incl_tax": "string",
      "gw_price_incl_tax": "string",
      "gw_items_base_price_incl_tax": "string",
      "gw_items_price_incl_tax": "string",
      "gw_card_base_price_incl_tax": "string",
      "gw_card_price_incl_tax": "string",
      "gw_base_price_invoiced": "string",
      "gw_price_invoiced": "string",
      "gw_items_base_price_invoiced": "string",
      "gw_items_price_invoiced": "string",
      "gw_card_base_price_invoiced": "string",
      "gw_card_price_invoiced": "string",
      "gw_base_tax_amount_invoiced": "string",
      "gw_tax_amount_invoiced": "string",
      "gw_items_base_tax_invoiced": "string",
      "gw_items_tax_invoiced": "string",
      "gw_card_base_tax_invoiced": "string",
      "gw_card_tax_invoiced": "string",
      "gw_base_price_refunded": "string",
      "gw_price_refunded": "string",
      "gw_items_base_price_refunded": "string",
      "gw_items_price_refunded": "string",
      "gw_card_base_price_refunded": "string",
      "gw_card_price_refunded": "string",
      "gw_base_tax_amount_refunded": "string",
      "gw_tax_amount_refunded": "string",
      "gw_items_base_tax_refunded": "string",
      "gw_items_tax_refunded": "string",
      "gw_card_base_tax_refunded": "string",
      "gw_card_tax_refunded": "string",
      "reward_points_balance": 0,
      "reward_currency_amount": 0,
      "base_reward_currency_amount": 0,
      "avatax_response": "string",
      "sps_order": {
        "id": 0,
        "vendor_id": 0,
        "magento_order_id": "string",
        "reseller_order_id": "string",
        "po_number": "string",
        "is_acknowledged": 0,
        "asn_sent": 0,
        "invoice_sent": 0,
        "status": 0,
        "error": "string",
        "meta": {
          "id": 0,
          "order_id": 0,
          "version": "string"
        },
        "header": {
          "id": 0,
          "order_id": 0,
          "addresses": [
            {
              "id": 0,
              "order_header_id": 0,
              "address_type_code": "string",
              "location_code_qualifier": "string",
              "address_location_number": "string",
              "address_name": "string",
              "address_alternate_name": "string",
              "address_alternate_name2": "string",
              "address1": "string",
              "address2": "string",
              "address3": "string",
              "address4": "string",
              "city": "string",
              "state": "string",
              "postal_code": "string",
              "country": "string",
              "contacts": [
                {
                  "id": 0,
                  "address_id": 0,
                  "contact_type_code": "string",
                  "contact_name": "string",
                  "primary_phone": "string",
                  "primary_fax": "string",
                  "primary_email": "string"
                }
              ]
            }
          ],
          "carrier_information": [
            {
              "id": 0,
              "order_header_id": 0,
              "carrier_trans_method_code": "string",
              "carrier_alpha_code": "string",
              "carrier_routing": "string",
              "service_level_codes": [
                {
                  "id": 0,
                  "carrier_information_id": 0,
                  "service_level_code": "string"
                }
              ]
            }
          ],
          "charges_allowances": [
            {
              "id": 0,
              "order_header_id": 0,
              "allow_chrg_indicator": "string",
              "allow_chrg_code": "string",
              "allow_chrg_amt": 0,
              "allow_chrg_percent_qual": "string",
              "allow_chrg_percent": 0,
              "allow_chrg_handling_code": "string",
              "allow_chrg_handling_description": "string"
            }
          ],
          "contacts": [
            {
              "id": 0,
              "order_header_id": 0,
              "contact_type_code": "string",
              "contact_name": "string",
              "primary_phone": "string",
              "primary_fax": "string",
              "primary_email": "string"
            }
          ],
          "dates": [
            {
              "id": 0,
              "order_header_id": 0,
              "date_time_qualifier": "string",
              "date": "string",
              "time": "string"
            }
          ],
          "fob_related_instruction": [
            {
              "id": 0,
              "order_header_id": 0,
              "fob_pay_code": "string",
              "fob_location_qualifier": "string",
              "fob_location_description": "string"
            }
          ],
          "notes": [
            {
              "id": 0,
              "order_header_id": 0,
              "note_code": "string",
              "note": "string"
            }
          ],
          "order_header": {
            "id": 0,
            "order_header_id": 0,
            "trading_partner_id": "string",
            "purchase_order_number": "string",
            "tset_purpose_code": "string",
            "primary_po_type_code": "string",
            "release_number": "string",
            "purchase_order_date": "string",
            "purchase_order_time": "string",
            "ship_complete_code": "string",
            "buyers_currency": "string",
            "department": "string",
            "vendor": "string",
            "division": "string",
            "customer_account_number": "string",
            "customer_order_number": "string"
          },
          "payment_terms": [
            {
              "id": 0,
              "order_header_id": 0,
              "terms_type": "string",
              "terms_basis_date_code": "string",
              "terms_discount_percentage": 0,
              "terms_discount_date": "string",
              "terms_discount_due_days": 0,
              "terms_net_due_date": "string",
              "terms_net_due_days": 0,
              "terms_discount_amount": 0,
              "terms_description": "string",
              "payment_method_code": "string",
              "payment_method_id": "string",
              "terms_due_day": "string"
            }
          ],
          "quantity_totals": [
            {
              "id": 0,
              "order_header_id": 0,
              "quantity_totals_qualifier": "string",
              "quantity": 0,
              "quantity_uom": "string"
            }
          ],
          "references": [
            {
              "id": 0,
              "order_header_id": 0,
              "reference_qual": "string",
              "reference_id": "string",
              "description": "string"
            }
          ],
          "taxes": [
            {
              "id": 0,
              "order_header_id": 0,
              "tax_type_code": "string",
              "tax_amount": 0,
              "tax_percent": 0,
              "jurisdiction_qual": "string",
              "jurisdiction_code": "string",
              "tax_exempt_code": "string",
              "tax_id": "string"
            }
          ]
        },
        "line_items": [
          {
            "id": 0,
            "order_id": 0,
            "order_line": {
              "id": 0,
              "line_item_id": 0,
              "line_sequence_number": "string",
              "buyer_part_number": "string",
              "vendor_part_number": "string",
              "consumer_package_code": "string",
              "ean": "string",
              "gtin": "string",
              "upc_case_code": "string",
              "product_id": [
                {
                  "id": 0,
                  "order_line_id": 0,
                  "part_number_qual": "string",
                  "part_number": "string"
                }
              ],
              "order_qty": 0,
              "order_qty_uom": "string",
              "purchase_price": 0,
              "buyers_currency": "string",
              "product_size_code": "string",
              "product_size_description": "string",
              "product_color_code": "string",
              "product_color_description": "string",
              "product_material_description": "string",
              "department": "string",
              "class": "string",
              "nrf_standard_color_and_size": {
                "id": 0,
                "order_line_id": 0,
                "nrf_color_code": "string",
                "nrf_size_code": "string"
              }
            },
            "dates": [
              {
                "id": 0,
                "line_item_id": 0,
                "date_time_qualifier": "string",
                "date": "string",
                "time": "string"
              }
            ],
            "price_information": [
              {
                "id": 0,
                "line_item_id": 0,
                "price_type_id_code": "string",
                "unit_price": 0
              }
            ],
            "product_or_item_description": [
              {
                "id": 0,
                "line_item_id": 0,
                "product_characteristic_code": "string",
                "product_description": "string"
              }
            ],
            "physical_details": [
              {
                "id": 0,
                "line_item_id": 0,
                "pack_qualifier": "string",
                "pack_value": 0,
                "pack_size": 0,
                "pack_uom": "string"
              }
            ],
            "references": [
              {
                "id": 0,
                "line_item_id": 0,
                "reference_qual": "string",
                "reference_id": "string",
                "description": "string"
              }
            ],
            "notes": [
              {
                "id": 0,
                "line_item_id": 0,
                "note_code": "string",
                "note": "string"
              }
            ],
            "floor_ready": [
              {
                "id": 0,
                "line_item_id": 0,
                "floor_ready_required": "string",
                "floor_ready_type_code": "string",
                "floor_ready_description": "string",
                "floor_ready_id": "string"
              }
            ],
            "subline": [
              {
                "id": 0,
                "line_item_id": 0,
                "subline_item_detail": {
                  "id": 0,
                  "subline_id": 0,
                  "line_sequence_number": "string",
                  "buyer_part_number": "string",
                  "vendor_part_number": "string",
                  "consumer_package_code": "string",
                  "ean": "string",
                  "gtin": "string",
                  "upc_case_code": "string",
                  "product_id": [
                    {
                      "id": 0,
                      "subline_item_detail_id": 0,
                      "part_number_qual": "string",
                      "part_number": "string"
                    }
                  ],
                  "qty_per": 0,
                  "qty_per_uom": "string",
                  "purchase_price": 0,
                  "buyers_currency": "string",
                  "product_size_code": "string",
                  "product_size_description": "string",
                  "product_color_code": "string",
                  "product_color_description": "string",
                  "product_material_description": "string",
                  "nrf_standard_color_and_size": {
                    "id": 0,
                    "subline_item_detail_id": 0,
                    "nrf_color_code": "string",
                    "nrf_size_code": "string"
                  }
                },
                "price_information": [
                  {
                    "id": 0,
                    "subline_id": 0,
                    "price_type_id_code": "string",
                    "unit_price": 0
                  }
                ],
                "product_or_item_description": [
                  {
                    "id": 0,
                    "subline_id": 0,
                    "product_characteristic_code": "string",
                    "product_description": "string"
                  }
                ],
                "floor_ready": [
                  {
                    "id": 0,
                    "subline_id": 0,
                    "floor_ready_required": "string",
                    "floor_ready_type_code": "string",
                    "floor_ready_description": "string",
                    "floor_ready_id": "string"
                  }
                ]
              }
            ],
            "quantities_schedules_locations": [
              {
                "id": 0,
                "line_item_id": 0,
                "total_qty": 0,
                "total_qty_uom": "string",
                "location_quantity": [
                  {
                    "id": 0,
                    "quantities_schedules_locations_id": 0,
                    "location": "string",
                    "qty": 0
                  }
                ],
                "dates": [
                  {
                    "id": 0,
                    "quantities_schedules_locations_id": 0,
                    "date_time_qualifier": "string",
                    "date": "string",
                    "time": "string"
                  }
                ]
              }
            ],
            "taxes": [
              {
                "id": 0,
                "line_item_id": 0,
                "tax_type_code": "string",
                "tax_amount": 0,
                "tax_percent": 0,
                "jurisdiction_qual": "string",
                "jurisdiction_code": "string",
                "tax_exempt_code": 0,
                "tax_id": "string"
              }
            ],
            "charges_allowances": [
              {
                "id": 0,
                "line_item_id": 0,
                "allow_chrg_indicator": "string",
                "allow_chrg_code": "string",
                "allow_chrg_amt": 0,
                "allow_chrg_percent_qual": 0,
                "allow_chrg_percent": 0,
                "allow_chrg_handling_code": "string",
                "allow_chrg_handling_description": "string"
              }
            ]
          }
        ],
        "summary": {
          "id": 0,
          "order_id": 0,
          "total_amount": 0,
          "total_line_item_number": 0
        },
        "created_at": "string",
        "updated_at": "string"
      },
      "cancel_after": "string",
      "ps_order_shipping": "string",
      "ps_order_tax": "string",
      "ps_order_total": "string",
      "ref3_x": "string",
      "reseller_order_id": "string",
      "reseller_order_date": "string",
      "reseller_order_total": "string",
      "reseller_order_tax": "string",
      "reseller_payment_method": "string",
      "reseller_shipping_total": "string",
      "reseller_transaction_number": "string",
      "reservation_number": "string",
      "return_code": "string",
      "reseller_id": "string",
      "pickup_store_id": "string",
      "order_type": "string",
      "firstname": "string",
      "lastname": "string",
      "telephone": "string",
      "postcode": "string",
      "last_trans_id": "string",
      "cc_trans_id": "string",
      "site_code": "string",
      "gift_card_numbers": "string",
      "shipping_tax_amount": "string",
      "base_shipping_tax_amount": "string",
      "shipping_incl_tax": "string",
      "base_shipping_incl_tax": "string",
      "coupon_code": "string",
      "order_promotions": [
        {
          "order_promotion": {
            "promotion_id": 0,
            "promotion_name": "string"
          }
        }
      ],
      "kount_ris": {
        "ris_id": 0,
        "order_id": 0,
        "score": 0,
        "response": "string",
        "rule": "string",
        "description": "string",
        "transaction_id": "string",
        "geox": "string",
        "country": "string",
        "kaptcha": "string",
        "cards": "string",
        "emails": "string",
        "devices": "string"
      }
    }
  }
}

Example request to create an order for the Walmart US store:

{
    "entity": {
        "base_currency_code": "USD",
        "base_discount_amount": 0,
        "base_grand_total": 38,
        "base_shipping_amount": 5,
        "base_shipping_incl_tax": 5,
        "base_shipping_tax_amount": 0,
        "base_shipping_discount_amount": 0,
        "base_subtotal": 33,
        "base_subtotal_incl_tax": 33,
        "base_total_due": 0,
        "base_total_paid": 38,
        "base_to_global_rate": 1,
        "base_to_order_rate": 1,
        "discount_tax_compensation_amount": 0,
        "base_discount_tax_compensation_amount": 0,
        "shipping_discount_tax_compensation_amount": 0,
        "customer_is_guest": 1,
        "customer_email": "ahofs@guidance.com",
        "customer_firstname": "Andrew",
        "customer_group_id": 0,
        "customer_lastname": "Hofstetter",
        "customer_note_notify": 0,
        "discount_amount": 0,
        "email_sent": 1,
        "ext_order_id": "WAP12345678",
        "global_currency_code": "AUD",
        "grand_total": 38,
        "order_currency_code": "USD",
        "shipping_amount": 5,
        "shipping_tax_amount": 0,
        "shipping_description": "Flat Rate - Fixed",
        "shipping_discount_amount": 0,
        "shipping_incl_tax": 5,
        "state": "processing",
        "status": "processing",
        "store_currency_code": "USD",
        "store_to_base_rate": 0,
        "store_to_order_rate": 0,
        "store_id": 31,
        "subtotal": 33,
        "subtotal_incl_tax": 33,
        "total_due": 0,
        "total_paid": 38,
        "total_item_count": 1,
        "total_qty_ordered": 1,
        "tax_amount": 0,
        "weight": 1,
        "items": [
            {
                "base_original_price": 33,
                "base_price": 33,
                "base_tax_amount":10,
                "base_price_incl_tax": 33,
                "base_row_total": 33,
                "base_row_total_incl_tax": 33,
                "name": "MAXI V NECK - Electric - 24 / XXL",
                "original_price": 33,
                "price": 33,
                "price_incl_tax": 33,
                "product_type": "simple",
                "qty_ordered": 1,
                "row_total": 33,
                "tax_amount":10,
                "row_total_incl_tax": 33,
                "sku": "9346639095200",
                "store_id": 31,
                "weight": 1,
                "product_id":1234,
                "brand_id":25,
                "extension_attributes":{
                   "unipart_excluded":"1",                        
                   "unipart_included":"9"
                }   
            }
        ],
        "billing_address": {
            "address_type": "billing",
            "city": "Orange",
            "company": "",
            "country_id": "US",
            "email": "ahofs@guidance.com",
            "firstname": "Andrew",
            "lastname": "Hofstetter",
            "postcode": "92865",
            "region": "CA",
            "street": [
                "1234 E. Del Mar Ave"
            ],
            "telephone": "7145551212"
        },
        "payment": {
            "method": "purchaseorder",
            "po_number": "1234567890wap"
        },
        "status_histories": [
            {
                "comment": "Order created by WAP",
                "status": "processing"
            }
        ],
        "extension_attributes": {
            "shipping_assignments": [
                {
                    "shipping": {
                        "address": {
                            "address_type": "shipping",
                            "city": "Orange",
                            "company": "",
                            "country_id": "US",
                            "email": "ahofs@guidance.com",
                            "firstname": "Andrew",
                            "lastname": "Hofstetter",
                            "postcode": "92865",
                            "region": "CA",
                            "street": [
                                "1234 E. Del Mar Ave"
                            ],
                            "telephone": "7145551212"
                        },
                        "method": "freeshipping_freeshipping",
                        "total": {
                            "base_shipping_amount": 5,
                            "base_shipping_incl_tax": 5,
                            "shipping_amount": 5,
                            "shipping_incl_tax": 5
                        },
                        "extension_attributes": []
                    },
                    "items": [
                        {
                            "base_original_price": 33,
                            "base_price": 33,
                            "base_price_incl_tax": 33,
                            "base_row_total": 33,
                            "base_row_total_incl_tax": 33,
                            "name": "MAXI V NECK - Electric - 24 / XXL",
                            "original_price": 33,
                            "price": 33,
                            "price_incl_tax": 33,
                            "product_type": "simple",
                            "qty_ordered": 1,
                            "row_total": 33,
                            "row_total_incl_tax": 33,
                            "sku": "9346639095200",
                            "store_id": 31,
                            "weight": 1,
                            "product_id":1234,
                            "brand_id":12354,
                            "extension_attributes": [],
                                "product_option": {
                                 "extension_attributes": {
                                   "additional_options": {
                                      "option1": {
                                      "option_id": "Colour",
                                      "option_value": "Navy" 
                                      },
                                      "option2": {
                                      "option_id": "Model",
                                      "option_value": "Defender 90"
                   } }

        }
                }
                    ],
                    "extension_attributes": []
                }
            ],
            "applied_taxes": [],
            "item_applied_taxes": [],
            "converting_from_quote": false
        }
    }
}

MAPPINGS

Magento Field Hemi Field Comment
entity >base_currency_code orders > order_currency
entity >base_discount_amount “0“
entity >base_grand_total orders > order_total_amount
entity >base_shipping_amount orders > shipping_service_cost
entity >base_shipping_incl_tax orders > shipping_service_cost
entity >base_shipping_tax_amount “0“ TODO
entity >base_shipping_discount_amount “0“
entity >base_subtotal orders > order_subtotal_amount Without VAT
entity >base_subtotal_incl_tax orders > order_subtotal_amount
entity >base_total_due “0“
entity >base_total_paid orders > order_total_amount
entity >base_to_global_rate “1”
entity >base_to_order_rate “1”
entity >discount_tax_compensation_amount “0“
entity >base_discount_tax_compensation_amount “0“
entity >shipping_discount_tax_compensation_amount “0“
entity >customer_is_guest “1”
entity >customer_email orders > buyer_mail
entity >customer_firstname orders > shipping_buyer_name
entity >customer_group_id “0“
entity >customer_lastname orders > orders > shipping_buyer_name Send only the last name
entity >customer_note_notify “0“
entity >discount_amount “0“
entity > customer_note label_request > url Not sure where we want to store the label url in Hemi
entity >email_sent “1“
entity >ext_order_id orders > marketplace_order_id
entity >global_currency_code orders > order_currency
entity >grand_total orders > order_total_amount
entity >order_currency_code orders > order_currency
entity >shipping_amount orders > shipping_service_cost
entity >shipping_tax_amount “0“
entity >shipping_description orders > shipping_service
entity >shipping_discount_amount “0“
entity >shipping_incl_tax orders > shipping_service_cost
entity >state (v1.2) Magento2 Seller > Order State Default value “processing“
entity >status (v1.2) Magento2 Seller > Order Status Default value "in_fulfillment"
entity >store_currency_code orders > order_currency
entity >store_to_base_rate “0“
entity >store_to_order_rate “0“
entity >store_id magento2_seller > Store Code
entity >subtotal orders > order_subtotal_amount
entity >subtotal_incl_tax orders > order_subtotal_amount
entity >total_due “0“
entity >total_paid orders > order_total_amount
entity >total_item_count order_item > id We need to sum the order item ids
entity >total_qty_ordered order_item > item_quantity We need to sum the item quantity
entity >tax_amount “0“
entity >weight order_item > item_weight Sum of order item weight, If not populated in Hemi use the default weight
entity >items>base_original_price item_account > RRP
entity >items>base_price order_item > item_trans_price Without VAT
entity >items>base_price_incl_tax order_item > item_trans_price
entity >items>base_row_total order_item > item_trans_price * order_item >item_quantity Without VAT.
(v1.4)We want to round the result up to the four decimal point.
entity >items>base_row_total_incl_tax order_item > item_trans_price * order_item >item_quantity (v1.4)We want to round the result up to the four decimal point.
entity >items>name order_item > item_title
entity >items>original_price item_account > RRP
entity >items>price order_item > item_trans_price Without VAT
entity >items>price_incl_tax order_item > item_trans_price
entity >items>base_tax_amount Order Item > Vat Item Price / Item tax price If we have populated the item tax price we pick it otherwise we use the Vat Item Price
entity >items>tax_amount Order Item > Vat Item Price / Item tax price If we have populated the item tax price we pick it otherwise we use the Vat Item Price
entity >items>product_type <v1.3>“simple“</v1.3>
entity >items>qty_ordered order_item >item_quantity
entity >items>row_total order_item > item_trans_price Without VAT and the sum of the Qty * Price
(v1.4)We want to round the result up to the four decimal point.
entity >items>row_total_incl_tax order_item > item_trans_price Sum of the Qty * Price
(v1.4)We want to round the result up to the four decimal point.
entity >items>sku order_item > item_sku
entity >items>store_id magento2_seller > Store Code
entity >items>weight order_item > item_weight If not populated in Hemi use the default weight
entity >items>product_id (v1.2)item_account_magento2 > Magento product id Please note we want to be able to import in this field.

Also we would like to include a new field in Magento 2 Seller > Use Product Id. If this field is set as true we want to include in the payload the product id when we are exporting orders to magento2 and add a validation if the product id is missing to return internal Error in Orders > Connector Error | | <v1.6>entity >items>brand</v1.6> | (v1.5)item_account_magento2 > Magento Brand id | Please note we want to be able to import in this field. Also we would like to include a new field in Magento 2 Seller > Use Brand Id. If this field is set as true we want to include in the payload the brand id when we are exporting orders to magento2 and add a validation if the brand id is missing to return internal Error in Orders > Connector Error | | <v1.7>entity >items>extension_attributes | item_account_magento2 > Extension Attributes | We want to introduce a new field in Item Account Magento2 called “Extension Attributes”. The field type should be the same as our Item/Variation Specifics and we need to have Name and Value. We can have more than one attribute added and we want to include everything in the payload for each product in order. If nothing is imported in Hemi we send empty node</v1.7> | | <v1.8>entity >items>product_option | | <v1.9>Product options are something specific for the product which allows Magento to differentiate the products. Thus we want to add additional logic for the bundle and if we have a case of an order with bundle products we want for the componen to inherit the bundle product options. If we have a case for more than one components we inherit the same bundle product options. For example we have a Bundle: Bundle SKU - “123” with product option “Color:Navy” Bundle Component - “456” without product option

When we are exporting the order we will include only the component “456” and we want to inherit the product option “Color:Navy” from the bundle “123”</v1.9> | | entity >items>extension_attributes | | | | entity >items>additional_options | item_account_magento2 > Product Options | We want to introduce a new field in Item Account Magento2 called “Product Options”. The field type should be the same as our Item/Variation Specifics and we need to have Name and Value. We can have more than one option added and we want to include everything in the payload for each product in order. Please note we have to count the options and push them with increment: "option1": { "option_id": "Colour", "option_value": "Navy" }, "option2": { "option_id": "Model", "option_value": "Defender 90" } <v2.0>If nothing is imported in Hemi and fields are emtpy or NULL we exclude the node from the payload</v2.0> | | entity >items>option_id | item_account_magento2 > Product Options Name | | | entity >items>option_value | item_account_magento2 > Product Options Value | </v1.8> | | entity >billing_address>address_type | "billing" | | | entity >billing_address>city | orders > billing_cityname | | | entity >billing_address>company | orders >billing_company_name | | | entity >billing_address>country_id | orders >billing_country_code | | | entity >billing_address>email | orders >buyer_mail | | | entity >billing_address>firstname | orders >billing_name | | | entity >billing_address>lastname | orders >billing_name | Only the last name of the string | | entity >billing_address>postcode | orders >billing_postal_code | | | entity >billing_address>region | orders >billing_state_province | | | entity >billing_address>street | orders > billing_street1 / billing_street2 | Can have Multiple Strings | | entity >billing_address>telephone | orders >billing_phone | | | entity >payment>method | (v1.2) Magento2 Seller > Order Payment Method | Default Value “purchaseorder“ | | entity >payment>po_number | orders > id | | | entity >status_histories>comment | ““ | | | entity >status_histories>status | orders > tool_status | Additional Mapping provided | | entity >extension_attributes>shipping_assignments>shipping>address>address_type | "shipping" | | | entity >extension_attributes>shipping_assignments>shipping>address>city | orders > shipping_city | | | entity >extension_attributes>shipping_assignments>shipping>address>company | orders >shipping_company_name | | | entity >extension_attributes>shipping_assignments>shipping>address>country_id | orders >shipping_country_code | | | entity >extension_attributes>shipping_assignments>shipping>address>email | orders >buyer_mail | | | entity >extension_attributes>shipping_assignments>shipping>address>firstname | orders >shipping_buyer_name | | | entity >extension_attributes>shipping_assignments>shipping>address>lastname | orders >shipping_buyer_name | Get only the last string | | entity >extension_attributes>shipping_assignments>shipping>address>postcode | orders >shipping_postal_code | | | entity >extension_attributes>shipping_assignments>shipping>address>region | orders >shipping_state_province | | | entity >extension_attributes>shipping_assignments>shipping>address>street | orders >shipping_street1/shipping_street2 | | | entity >extension_attributes>shipping_assignments>shipping>address>telephone | orders >shipping_phone | | | entity >extension_attributes>shipping_assignments>shipping>method | <v2.1> Magento 2 Seller > Order Shipping Method OR orders >shipping_service | Please note we pick with priority Magento 2 Seller > Order Shipping Method (new field) if this is missing we want to pick orders >shipping_service else. If orders >shipping_service is empty we push empty value.</v2.1> | | entity >extension_attributes>shipping_assignments>shipping>total>base_shipping_amount | orders >shipping_service_cost | Without VAT | | entity >extension_attributes>shipping_assignments>shipping>total>base_shipping_incl_tax | orders >shipping_service_cost | | | entity >extension_attributes>shipping_assignments>shipping>total>shipping_amount | orders >shipping_service_cost | Without VAT | | entity >extension_attributes>shipping_assignments>shipping>total>shipping_incl_tax | orders >shipping_service_cost | | | entity >extension_attributes>shipping_assignments>items>base_original_price | item_account > RRP | | | entity >extension_attributes>shipping_assignments>items>base_price | order_item > item_trans_price | Without VAT | | entity >extension_attributes>shipping_assignments>items>base_price_incl_tax | order_item > item_trans_price | | | entity >extension_attributes>shipping_assignments>items>base_row_total | order > order_total_amount | Without VAT | | entity >extension_attributes>shipping_assignments>items>base_row_total_incl_tax | order > order_total_amount | | | entity >extension_attributes>shipping_assignments>items>name | order_item > item_title | | | entity >extension_attributes>shipping_assignments>items>original_price | item_account > RRP | | | entity >extension_attributes>shipping_assignments>items>price | order_item > item_strans_price | Without VAT | | entity >extension_attributes>shipping_assignments>items>price_incl_tax | order_item > item_strans_price | | | entity >extension_attributes>shipping_assignments>items>product_type | "configurable" | | | entity >extension_attributes>shipping_assignments>items>qty_ordered | order_item > item_quantity | | | entity >extension_attributes>shipping_assignments>items>row_total | order_item > item_strans_price | Without VAT and Sum Price Qty (v1.4)We want to round the result up to the four decimal point. | | entity >extension_attributes>shipping_assignments>items>row_total_incl_tax | order_item > item_strans_price | Sum Price Qty (v1.4)We want to round the result up to the four decimal point. | | entity >extension_attributes>shipping_assignments>items>sku | order_item > item_sku | | | entity >extension_attributes>shipping_assignments>items>store_id | magento2_seller > Store Code | | | entity >extension_attributes>shipping_assignments>items>weight | order_item > item_weigth | | | entity >extension_attributes>extension_attributes | | Can be excluded from the payload | | entity >extension_attributes>applied_taxes | | Can be excluded from the payload | | entity >extension_attributes>item_applied_taxes | | Can be excluded from the payload | | entity >extension_attributes>converting_from_quote | “false” | |

Sample Response Body:

{
  "base_currency_code": "USD",
  "base_discount_amount": 0,
  "base_grand_total": 38,
  "base_discount_tax_compensation_amount": 0,
  "base_shipping_amount": 5,
  "base_shipping_discount_amount": 0,
  "base_shipping_incl_tax": 5,
  "base_shipping_tax_amount": 0,
  "base_subtotal": 33,
  "base_subtotal_incl_tax": 33,
  "base_total_due": 0,
  "base_total_paid": 38,
  "base_to_global_rate": 1,
  "base_to_order_rate": 1,
  "billing_address_id": 11385355,
  "created_at": "2021-05-12 08:36:30",
  "customer_email": "ahofs@guidance.com",
  "customer_firstname": "Andrew",
  "customer_group_id": 0,
  "customer_is_guest": 1,
  "customer_lastname": "Hofstetter",
  "customer_note_notify": 0,
  "discount_amount": 0,
  "email_sent": 1,
  "entity_id": 5696469,
  "ext_order_id": "WAP12345678",
  "global_currency_code": "AUD",
  "grand_total": 38,
  "discount_tax_compensation_amount": 0,
  "increment_id": "31000000013",
  "order_currency_code": "USD",
  "protect_code": "20bf86ee200c6c113dd36559b8992357",
  "shipping_amount": 5,
  "shipping_description": "Flat Rate - Fixed",
  "shipping_discount_amount": 0,
  "shipping_discount_tax_compensation_amount": 0,
  "shipping_incl_tax": 5,
  "shipping_tax_amount": 0,
  "state": "processing",
  "status": "processing",
  "store_currency_code": "USD",
  "store_id": 31,
  "store_name": "Avenue US Website\nAvenue US Resellers\nWalmart US Store",
  "store_to_base_rate": 0,
  "store_to_order_rate": 0,
  "subtotal": 33,
  "subtotal_incl_tax": 33,
  "tax_amount": 0,
  "total_due": 0,
  "total_item_count": 1,
  "total_paid": 38,
  "total_qty_ordered": 1,
  "updated_at": "2021-05-12 08:36:30",
  "weight": 1,
  "items": [
    {
      "base_original_price": 33,
      "base_price": 33,
      "base_price_incl_tax": 33,
      "base_row_total": 33,
      "base_row_total_incl_tax": 33,
      "created_at": "2021-05-12 08:36:30",
      "item_id": 27057014,
      "name": "MAXI V NECK - Electric - 24 / XXL",
      "order_id": 5696469,
      "original_price": 33,
      "price": 33,
      "price_incl_tax": 33,
      "product_type": "simple",
      "qty_ordered": 1,
      "row_total": 33,
      "row_total_incl_tax": 33,
      "sku": "9346639095200",
      "store_id": 31,
      "updated_at": "2021-05-12 08:36:30",
      "weight": 1,
      "extension_attributes": {
        "returnable": true,
        "returnable_reason": "",
        "ps_item_price": "33",
        "clearance": "0",
        "price_incl_tax": "33",
        "base_price_incl_tax": "33",
        "final_sale": "0"
      }
    }
  ],
  "billing_address": {
    "address_type": "billing",
    "city": "Orange",
    "company": "",
    "country_id": "US",
    "email": "ahofs@guidance.com",
    "entity_id": 11385355,
    "firstname": "Andrew",
    "lastname": "Hofstetter",
    "parent_id": 5696469,
    "postcode": "92865",
    "region": "CA",
    "region_code": "CA",
    "street": [
      "1234 E. Del Mar Ave"
    ],
    "telephone": "7145551212"
  },
  "payment": {
    "account_status": null,
    "additional_information": [],
    "cc_last4": null,
    "entity_id": 5695820,
    "method": "purchaseorder",
    "parent_id": 5696469,
    "po_number": "1234567890wap"
  },
  "status_histories": [
    {
      "comment": "Order created by WAP",
      "entity_id": 23653564,
      "is_customer_notified": null,
      "is_visible_on_front": null,
      "parent_id": 5696469,
      "status": "processing"
    }
  ],
  "extension_attributes": {
    "shipping_assignments": [
      {
        "shipping": {
          "address": {
            "address_type": "shipping",
            "city": "Orange",
            "company": "",
            "country_id": "US",
            "email": "ahofs@guidance.com",
            "entity_id": 11385356,
            "firstname": "Andrew",
            "lastname": "Hofstetter",
            "parent_id": 5696469,
            "postcode": "92865",
            "region": "CA",
            "region_code": "CA",
            "street": [
              "1234 E. Del Mar Ave"
            ],
            "telephone": "7145551212"
          },
          "method": "freeshipping_freeshipping",
          "total": {
            "base_shipping_amount": 5,
            "base_shipping_incl_tax": 5,
            "shipping_amount": 5,
            "shipping_incl_tax": 5
          }
        },
        "items": [
          {
            "base_original_price": 33,
            "base_price": 33,
            "base_price_incl_tax": 33,
            "base_row_total": 33,
            "base_row_total_incl_tax": 33,
            "name": "MAXI V NECK - Electric - 24 / XXL",
            "original_price": 33,
            "price": 33,
            "price_incl_tax": 33,
            "product_type": "simple",
            "qty_ordered": 1,
            "row_total": 33,
            "row_total_incl_tax": 33,
            "sku": "9346639095200",
            "store_id": 31,
            "weight": 1,
            "extension_attributes": {
              "returnable": true,
              "returnable_reason": "",
              "clearance": "0",
              "price_incl_tax": "33",
              "base_price_incl_tax": "33",
              "final_sale": "0"
            }
          }
        ]
      }
    ],
    "applied_taxes": [],
    "item_applied_taxes": [],
    "converting_from_quote": false,
    "ps_order_shipping": "5.0000",
    "ps_order_tax": "0.0000",
    "ps_order_total": "38.0000",
    "order_type": "9",
    "firstname": "Andrew",
    "lastname": "Hofstetter",
    "telephone": "7145551212",
    "postcode": "92865",
    "site_code": "3777",
    "gift_card_numbers": "[]",
    "shipping_tax_amount": "0",
    "base_shipping_tax_amount": "0",
    "shipping_incl_tax": "5",
    "base_shipping_incl_tax": "5"
  }
}

Sample Response Header:

cache-control: no-store, no-cache, must-revalidate
 connection: Upgrade, Keep-Alive
 content-type: text/html; charset=UTF-8
 date: Tue, 11 May 2021 07:20:50 GMT
 expires: Thu, 19 Nov 1981 08:52:00 GMT
 keep-alive: timeout=5, max=100
 pragma: no-cache
 server: Apache/2.4.29 (Ubuntu)
 transfer-encoding: chunked
 upgrade: h2
 vary: Accept-Encoding
 x-content-encoding-over-network: gzip
 x-frame-options: SAMEORIGIN
 x-ua-compatible: IE=edge

MAPPING for the response. What we need to get from the response

Magento Field Hemi Field Comment
entity_id orders > magento_order_id
increment_id orders_magento > Increment Id
items > item_id order_item_magento > Item Id

STATUS MAPPING for when we create an order status from Magento

Magento Field > Status Hemi Field Hemi Status
Status > complete orders > tool_status Shipped
Status > in_fulfillment orders > tool_status Ready For Shipping
Status > processing orders > tool_status Pending
Status >closed orders > tool_status Canceled

This creates the order in Magento and the response back will include the Magento order “entity_id” and “increment_id” which can be used for other operations on the order. Regarding the default weight we will need to inlude new option need to be included in Magento 2 Seller table which should represent a simple checkbox and if selected to use a default weight, for each order without weight on the order items, equals to 0.5 per quantity

There are some notable fields here:

ext_order_id – This can be the order ID in your system or a reference number

store_id – This should be the store ID from the table below Their UAT environment has the following stores setup:

Reseller Name Store ID Store Code Warehouse Code
Walmart 31 walmart_us us_online
Amazon USA 32 amazon_us us_online
David Jones AU 33 david_jones_au au_online
Zalando 34 zalando --

Address “street” field can be multiple strings for line 1, line 2 etc. up to 4 street address lines

Payment method should always be “purchaseorder”

If error is returned we store it in orders > magento_error

Additional options will be added in the way we are exporting the orders. Because of the different requests from our clients we will need to include additional options for the way we are exporting order to Mangeto2 in the Magento2 Seller table. We will have 3 different order export setup.

Depends on the option selected we will export order in different way.

We will also change the field types as follows:

Export Orders -radio button Export Orders Per Seller (https://wearepentagon.atlassian.net/wiki/spaces/~16347122/pages/2826731521/Magento2+Export+Orders+Per+Seller ) - radio button Export Orders Item Tax - checkbox

The idea is based on which export type is selected we can have Cumulative item tax for both

  • Export Orders is our standard order export which is working at the moment as expected and we no not want to do any changes there.
  • Export Orders Per Seller a new functionality described in the link above.
  • Export Orders Item Tax the only difference here is in the items node:

    "items":[
             {
                "base_original_price":"99.95",
                "base_price":18.18,
                "base_price_incl_tax":"20",
                "base_row_total":36.36,
                "base_row_total_incl_tax":40,
                "base_tax_amount":"1.82",
                "name":"CITY CHIC Women Claire Jumper[Black,22 \/ XL]",
                "original_price":"99.95",
                "price":18.18,
                "price_incl_tax":"20",
                "product_type":"configurable",
                "qty_ordered":"2",
                "row_total":36.36,
                "row_total_incl_tax":40,
                "tax_amount":"1.82",
                "sku":"9346639305149",
                "store_id":"35",
                "weight":1
             }
    

The base_tax_amount and tax_amount need to be multiply by the order item quantity. Order Item > Vat Item Price Order Item > Quantity If we have Item tax price added on the order we treat this as US order and need to do the same multiply by the order item quantity. Order Item > Item Tax Price Order Item > Quantity

So in this example we will want to have:

"tax_amount":"3.64",
"base_tax_amount":"3.64"

Get Order Status

This method will let you check the order status of a specified order by it’s entity_id https://ccadmin-m2.stage.guidance.com/swagger#/salesOrderRepositoryV1/salesOrderRepositoryV1GetGet

Or you can get the details for multiple orders back based on filters applied https://ccadmin-m2.stage.guidance.com/swagger#/salesOrderRepositoryV1/salesOrderRepositoryV1GetListGet

The idea of this cron is to work as get modified orders because in order to keep the consistency between all systems we need to make sure all Magento Statuses are updated in Hemi. For this cron we will use multiple orders back based on filters applied https://ccadmin-m2.stage.guidance.com/swagger#/salesOrderRepositoryV1/salesOrderRepositoryV1GetListGet and we will store a new record in last_run_date every time we have a successful cron run or if we already have such record we will update it. The search criteria will check for orders created from specific date and specific store ID which we can get from the account_magento2 table which refers to the magento seller. The first run of the cron by default will check for orders in the last 3 months and every successful run of the cron need to store a new record in last_run_date table. With every next run of the get orders status we will need to check the latest record in last_run_date for that cron and overlap 15 mins from the latest last_run_date. The search criteria will look like:

searchCriteria[filter_groups][0][filters][0][field]=updated_at&
searchCriteria[filter_groups][0][filters][0][value]=2021-05-12 00:00:00&
searchCriteria[filter_groups][0][filters][0][condition_type]=from
searchCriteria[filter_groups][1][filters][0][field]=store_id&
searchCriteria[filter_groups][1][filters][0][value]=31&
searchCriteria[filter_groups][1][filters][0][condition_type]=equal&
searchCriteria[pageSize]=100&
searchCriteria[currentPage]=1

Request:

https://ccadmin-m2.stage.guidance.com/rest/all/V1/orders?searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=created_at&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=2021-04-12%2000%3A00%3A00&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5BconditionType%5D=from

Response:

Same as above but we need to check the status from the response and if different to update in Hemi

How to track the order statuses and refunds from the payload. First we wont receive any particular order status but we will need to set the correct order details in Hemi. The key field from the payload are: entity > total_paid entity > total_refunded entity > shipping_refunded entity > shipping_tax_refunded item > amount_refunded item > tax_refunded item > qty_refunded Based on the info we recive in these fileds we decide how to create the refund row in Hemi.
For example if we have an order with one item despite of the quantity: If we have entity -> total_refunded = entity -> total_paid we treat this as a full refund and need to store a new payment row with type refund and add the relevant refund rows item and shipping with their total amounts.

If we have entity -> total_refunded < entity -> total_paid we tret this as a partial refund and need to store a new payment row with type refund and add the relevant refund rows item and shipping with their total amounts. In order to get the refund rows couple of checks need to be done: If we have entity -> total_refunded = entity -> shipping_refunded + entity -> shipping_tax_refunded this means we have only refunded the shipping cost and we add refund row with type shipping with the total_refunded amount. If we have entity -> total_refunded = item -> amount_refunded + item -> tax_refunded this means we have only refunded the item cost and we add refund row with type item with the total_refunded amount. If we have entity -> total_refunded = item -> amount_refunded + item -> tax_refunded + entity -> shipping_refunded + entity -> shipping_tax_refunded this means we have refunded the item cost and the shipping cost and we add refund row with type item with the item -> amount_refunded + item -> tax_refunded amount and refund row with type shipping with the entity -> shipping_refunded + entity -> shipping_tax_refunded amount. Please note item > qty_refunded indicates which item from the order is refunded!

For example if we have an order with more than one item despite of the quantity:

The tricky part here is to properly track which items are refunded and what quantity using the item > qty_refunded field and be careful how we are refunding the shipping cost because we receive it on aa order level from Magento but in Hemi we store it on item level due to the shipping cost splitter.

There is a tricky part and if we have parent_item_id we need to look into only the parent record.

Every refund row we create from Magento2 we need to create it with status pending and process by MP = 1

When we have to create the refund rows in Hemi if the return is created on Magento2 we will have to add the order_payment (type refund) and also set Mangento order_payment_magento2 > return_created = true

MAPPING for when we get an order status from Magento

Magento Field > Status Hemi Field Hemi Status
Status > complete orders > tool_status Shipped
Status > in_fulfillment orders > tool_status Ready For Shipping
Status > processing orders > tool_status Canceled
Status > reseller_imported orders > tool_status Incomplete
Status > in_transit orders > tool_status Ready For Shipping
Status > partial_returned orders > tool_status Shipped / Refund Processor
Status > picked_up orders > tool_status Shipped
Status > partial_ship orders > tool_status Shipped
Status > ready_for_pickup orders > tool_status Ready For Shipping
Status >afterpay_payment_review orders > tool_status Pending
Status >canceled orders > tool_status Canceled
Status >closed orders > tool_status Canceled
Status >decline_kount orders > tool_status Not in use
Status >fraud orders > tool_status Pending
Status >holded orders > tool_status Not in use
Status >payment_review orders > tool_status Pending
Status >paypal_canceled_reversal orders > tool_status Not in use
Status >paypal_reversed orders > tool_status Not in use
Status >pending_payment orders > tool_status Pending
Status >review_kount orders > tool_status Pending
Status >zip_authorised orders > tool_status Pending

Create Shipments

For cases when you need to push shipment data to Magento, like the Zalando orders, this method is available https://ccadmin-m2.stage.guidance.com/swagger#/salesShipOrderV1/salesShipOrderV1ExecutePost

Request: POST /V1/order/{orderId}/ship Parameters: orderId - get from orders > magento_order_id

{
  "items": [
    {
      "extension_attributes": {},
      "order_item_id": 0,
      "qty": 0
    }
  ],
  "notify": true,
  "appendComment": true,
  "comment": {
    "extension_attributes": {},
    "comment": "string",
    "is_visible_on_front": 0
  },
  "tracks": [
    {
      "extension_attributes": {},
      "track_number": "string",
      "title": "string",
      "carrier_code": "string"
    }
  ],
  "packages": [
    {
      "extension_attributes": {}
    }
  ],
  "arguments": {
    "extension_attributes": {}
  }
}

Sample Request:

POST "https://ccadmin-m2.stage.guidance.com/rest/all/V1/order/5696468/ship"
-H "accept: application/json"
-H "Content-Type: application/json"
-H "Authorization: Bearer sxlzmj98g2pph4mhy37hmfjnw8qgq9j0"
-d "{ \"items\": [ { \"extension_attributes\": {}, \"order_item_id\": 27057012, \"qty\": 1 } ], \"notify\": true, \"appendComment\": true, \"comment\": { \"extension_attributes\": {}, \"comment\": \"string\", \"is_visible_on_front\": 0 }, \"tracks\": [ { \"extension_attributes\": {}, \"track_number\": \"test\", \"title\": \"test\", \"carrier_code\": \"test\" } ], \"packages\": [ { \"extension_attributes\": {} } ], \"arguments\": { \"extension_attributes\": {} }}"

MAPPINGS

Magento Field Hemi Field Comment
items > extension_attributes empty
items > order_item_id order_item_magento > item_id
items > qty order_item > item_quantity
notify “true” If activated Sent Customer Notification magento2_seller
appendComment empty
comment >extension_attributes empty
comment >comment empty
comment > is_visible_on_front “0”
tracks >extension_attributes empty
tracks >track_number orders > shipping_track_num Required so if there is no tracking num we push “123456789“
tracks >title empty
tracks >carrier_code orders > shipping_carrier Required
packages>extension_attributes empty
arguments > extension_attributes empty

Response Body:

"5230108"

Response Headers:

200 Success.

Where you would just supply the order ID, the items shipped, and tracking info (if available). You can also specify here if you want Magento to send a shipment email to the customer or not

Create Shipments will work only if we have activated Create Shipments flag in magento2_seller table and Active = Yes in magento2_connector. Basically this flow is for Marketplaces which offers their fulfillment service and once the order is shipped on the Marketplace we need to update the order details on Magento as well. This flow will be triggered only when we have orders with status shipped and in Orders > Orders Magento > Create Shipment = false After successful Shipment Creation we mark the orders> orders_magento > create_shipment = true and add the shipment ID from the response in orders> orders_magento > shipment_id If error is returned we store it in orders > order_error

If we case when there are bundle skus we need to check if Check For Bundle = Yes and create shipment only for the components, we do not create returns for bundle SKUs.

We need to introduce a new field Magento 2 Seller > Use Default Refund Reason which need to be a text field and every time we download a new refund row from Magento 2 to add the default refund reason in the Order Payment > Reason field.


Get Shipment Updates

If you are wanting to get shipping updates from Magento using the API, you can use the following method https://ccadmin-m2.stage.guidance.com/swagger#/salesShipmentRepositoryV1/salesShipmentRepositoryV1GetListGet1

Where you can apply filters to check for shipments similar to orders.

Get Shipments will work only if we have activated Get Shipments flag in magento2_seller table and Active = Yes in magento2_connector. This cron will basically get the shipping details for the order and raise Update Shipping Pending = Yes which will trigger the shipping update to the Marketplace. For this cron we will store a new record in last_run_dateevery time we have a successful cron run. The search criteria will check for new created shipments from specific date. The first run of the cron by default will check for orders in the last 1 months and every successful run of the cron need to store a new record in last_run_date table. With every next run of the get orders we will need to check the latest record in last_run_date for that cron and overlap 15 mins from the latest date_created. Please note we update only Ready For Shipping orders. The search criteria will look like:

searchCriteria[filter_groups][0][filters][0][field]=created_at&
searchCriteria[filter_groups][0][filters][0][value]=2021-05-12 00:00:00&
searchCriteria[filter_groups][0][filters][0][condition_type]=from

If error is returned we store it in orders > order_error

Request: GET /V1/shipments

GET "https://ccadmin-m2.stage.guidance.com/rest/all/V1/shipments?
searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bfield%5D=store_id&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5Bvalue%5D=30&searchCriteria%5BfilterGroups%5D%5B0%5D%5Bfilters%5D%5B0%5D%5BconditionType%5D=eq"
-H "accept: application/json"
-H "Authorization: Bearer sxlzmj98g2pph4mhy37hmfjnw8qgq9j0"

Response:

{
  "billing_address_id": 0,
  "created_at": "string",
  "customer_id": 0,
  "email_sent": 0,
  "entity_id": 0,
  "increment_id": "string",
  "order_id": 0,
  "packages": [
    {
      "extension_attributes": {}
    }
  ],
  "shipment_status": 0,
  "shipping_address_id": 0,
  "shipping_label": "string",
  "store_id": 0,
  "total_qty": 0,
  "total_weight": 0,
  "updated_at": "string",
  "items": [
    {
      "additional_data": "string",
      "description": "string",
      "entity_id": 0,
      "name": "string",
      "parent_id": 0,
      "price": 0,
      "product_id": 0,
      "row_total": 0,
      "sku": "string",
      "weight": 0,
      "extension_attributes": {},
      "order_item_id": 0,
      "qty": 0
    }
  ],
  "tracks": [
    {
      "order_id": 0,
      "created_at": "string",
      "entity_id": 0,
      "parent_id": 0,
      "updated_at": "string",
      "weight": 0,
      "qty": 0,
      "description": "string",
      "extension_attributes": {},
      "track_number": "string",
      "title": "string",
      "carrier_code": "string"
    }
  ],
  "comments": [
    {
      "is_customer_notified": 0,
      "parent_id": 0,
      "extension_attributes": {},
      "comment": "string",
      "is_visible_on_front": 0,
      "created_at": "string",
      "entity_id": 0
    }
  ],
  "extension_attributes": {
    "pin": "string",
    "in_transit_email_sent": true,
    "delay_sorry_email_sent": true
  }
}

Sample Response:

{
  "billing_address_id": 11385354,
  "created_at": "2021-05-11 23:35:44",
  "email_sent": 1,
  "entity_id": 5230108,
  "increment_id": "18002488971",
  "order_id": 5696468,
  "packages": [],
  "shipping_address_id": 11385353,
  "store_id": 18,
  "total_qty": 1,
  "updated_at": "2021-05-11 23:35:45",
  "items": [
    {
      "entity_id": 15095495,
      "name": "Super Stretch Zip Pant Black - average\n",
      "parent_id": 5230108,
      "price": 32.99,
      "product_id": 359811,
      "sku": "9346637370996",
      "weight": 1,
      "order_item_id": 27057012,
      "qty": 1
    }
  ],
  "tracks": [
    {
      "order_id": 5696468,
      "created_at": "2021-05-11 23:35:44",
      "entity_id": 3262132,
      "parent_id": 5230108,
      "updated_at": "2021-05-11 23:35:44",
      "weight": null,
      "qty": null,
      "description": null,
      "track_number": "test",
      "title": "test",
      "carrier_code": "test"
    }
  ],
  "comments": [
    {
      "is_customer_notified": 1,
      "parent_id": 5230108,
      "comment": "string",
      "is_visible_on_front": 0,
      "created_at": "2021-05-11 23:35:44",
      "entity_id": 2323223
    }
  ],
  "extension_attributes": {
    "in_transit_email_sent": false,
    "delay_sorry_email_sent": false
  }
}

MAPPINGS

Magento Field Hemi Field Comment
tracks > track_number orders > shipping_track_num
tracks > order_id orders > magento_order_id We will need to map the order in our system using this id
tracks > carrier_code orders > shipping_carrier
tracks > parent_id orders_magento > shipment_id

Create Returns

Returns can be created in Magento if there is a need for this. It is very similar to creating a shipment; you specify the order ID and the items and quantities being returned

https://ccadmin-m2.stage.guidance.com/swagger#/salesRefundOrderV1/salesRefundOrderV1ExecutePost Create Returns will work only if we have activated Create Returns flag in magento2_seller table and Active = Yes in magento2_connector. If we have an order with orders>refunded = true and order_payment_magento2 > return_created = false we need to create the return in Magento which details we get from the order_payment (type refund). If we create the return successfully on Mangento order_payment_magento2 > return_created = true and the return id in order_payment_magento2 > return_id.

We need to get from the refund row the item SKU and from there to map it with the order_item and get the order_item > trans_id with the relevant refunded quantity then if the have refunded Shipping amount we again get it from order_refund_row

Please note if we would like to return only the order item we need to set the order_item_id and qty > 0. If we would like to refund only the shipping we need to set order_item_id , qty = 0 and the relevant shipping_amount.

If error is returned we store it in orders > order_error

If we case when there are bundle skus we need to check if Check For Bundle = Yes and create returns only for the components, we do not create returns for bundle SKUs.

Request: POST /V1/order/{orderId}/refund Parameters: orderID - get from orders > magento_order_id

{
  "items": [
    {
      "extension_attributes": {},
      "order_item_id": 0,
      "qty": 0
    }
  ],
  "notify": true,
  "appendComment": true,
  "comment": {
    "extension_attributes": {},
    "comment": "string",
    "is_visible_on_front": 0
  },
  "arguments": {
    "shipping_amount": 0,
    "adjustment_positive": 0,
    "adjustment_negative": 0,
    "extension_attributes": {
      "return_to_stock_items": [
        0
      ]
    }
  }
}

Sample Request:

https://ccadmin-m2.stage.guidance.com/rest/all/V1/order/5696467/refund"
-H "accept: application/json"
-H "Content-Type: application/json"
-H "Authorization: Bearer sxlzmj98g2pph4mhy37hmfjnw8qgq9j0"
-d "{ \"items\": [ { \"extension_attributes\": {}, \"order_item_id\": 27057010, \"qty\": 1 } ], \"notify\": true, \"appendComment\": true, \"comment\": { \"extension_attributes\": {}, \"comment\": \"string\", \"is_visible_on_front\": 0 }, \"arguments\": { \"shipping_amount\": 0, \"adjustment_positive\": 0, \"adjustment_negative\": 0, \"extension_attributes\": { \"return_to_stock_items\": [ ] } }}

Sample Response Body:

"1416535"

Sample Response Header:

cache-control: no-store
 connection: Upgrade, Keep-Alive
 content-length: 9
 content-type: application/json; charset=utf-8
 date: Wed, 12 May 2021 07:36:29 GMT
 expires: Thu, 19 Nov 1981 08:52:00 GMT
 keep-alive: timeout=5, max=100
 pragma: no-cache
 server: Apache/2.4.29 (Ubuntu)
 upgrade: h2
 x-frame-options: SAMEORIGIN
 x-ua-compatible: IE=edge

MAPPINGS

Magento Field Hemi Field Comment
items > order_item_id order_item_magento > item_id
items > qty Need to be calculated from the amount / Unit Price No sure if we need to calculate it from the refunded amount?
arguments > shipping_amount order_refund_row > amount for type Shipping
return it from the response order_payment_magento2 > return_id

cron_mag_202_send_order.php

shipping_assignments

Is this article helpful?
0 0 0