Magento 2 Rest API创建订单而不添加送货地址 [英] Magento 2 Rest api to create order not adding shipping address

查看:87
本文介绍了Magento 2 Rest API创建订单而不添加送货地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用magento 2 rest api创建订单.但是收货地址未添加订单详细信息.由于没有收货地址,因此订单格式不完整

I am trying to create an order using magento 2 rest api.But the shipping address is not adding with order details.Because of no shipping address the order is in incomplete format

http://127.0.0.1/netmeds_mage/rest/V1/orders/create

Method : PUT

这是json请求:

{实体":{"base_currency_code":"INR","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":38,"base_to_global_rate":1,"base_to_order_rate":1,"discount_tax_compensation_amount":0,"base_discount_tax_compensation_amount":0,","customer_is_guest":0,"customer_dob":"Jan 18岁 1987," customer_email:" sharvesh@gmail.com," customer_firstname:" Sharvesh," customer_gender:1," customer_group_id:1," customer_id:4," customer_lastname:" CP," customer_note_notify:1,"折扣金额:0,"电子邮件发送:1," global_currency_code:" INR," grand_total:38," order_currency_code:" INR," remote_ip:" 127.0.0.1," shipping_amount:5," shipping_tax_amount:0," shipping_description:"平 速度 - 固定的," shipping_discount_amount:0," shipping_incl_tax:5," state:"待处理," status:"待处理," store_currency_code:" INR," store_to_base_rate:0," store_to_order_rate:0 ,"store_id":1,小计":33,小计含税":33,总欠款":38,总计项数":1,按数量总计":1,税额":0,重量":1,"items:[{" base_original_price:33," base_price:33," base_price_incl_tax:33," base_row_total:33," base_row_total_incl_tax:33," name:" Endeavor 一日游 背包,"原始价格:33,"价格:33,"价格含税:33,"产品编号:11,"产品类型:"简单,"数量订购:1,"行总计:33,"行总计":33,"sku":"24-WB06","store_id":1,重量":1}],"billing_address":{"address_type":"billing","city":"Chennai",公司:" Netmeds," country_id:" IN," customer_address_id:4," email:" sharvesh@gmail.com," firstname:" Sharvesh," lastname:" C,"邮政编码:" 600117,"地区:"泰米尔纳德邦,"街道:[" 6A,4th street,Keelkattalai],"电话:" 9840626148},"付款:{" aorder_ordered:38," base_amount_ordered:38," base_shipping_amount:5," method:" checkmo," shipping_amount: 5},状态历史":[],扩展属性":{"shipping_assignments":[{"shipping":{"address":{"address_type":"shipping","city":"Chennai",公司" :"Netmeds","country_id":"IN","customer_address_id":4,"email":"sharvesh@gmail.com","firstname":"Sharvesh","lastname":"C","postcode" :"600117",地区":泰米尔纳德邦",街道":["6A,4th street,Keelkattalai],"电话:" 9840626148},"方法:" flatrate_flatrate,"总计:{" 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,"name":"Endeavor 一日游 背包,"原始价格:33,"价格:33,"价格含税:33,"产品编号:11,"产品类型:"简单,"数量订购:1,"行总计:33,"行总计":33,"sku":"24-WB06","store_id":1,"weight":1}],"extension_attributes":[]}],"applied_taxes":[],"item_applied_taxes":[], "converting_from_quote":true}}}

{"entity":{"base_currency_code":"INR","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":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":0,"customer_dob":"Jan 18, 1987","customer_email":"sharvesh@gmail.com","customer_firstname":"Sharvesh","customer_gender":1,"customer_group_id":1,"customer_id":4,"customer_lastname":"CP","customer_note_notify":1,"discount_amount":0,"email_sent":1,"global_currency_code":"INR","grand_total":38,"order_currency_code":"INR","remote_ip":"127.0.0.1","shipping_amount":5,"shipping_tax_amount":0,"shipping_description":"Flat Rate - Fixed","shipping_discount_amount":0,"shipping_incl_tax":5,"state":"pending","status":"pending","store_currency_code":"INR","store_to_base_rate":0,"store_to_order_rate":0,"store_id":1,"subtotal":33,"subtotal_incl_tax":33,"total_due":38,"total_item_count":1,"total_qty_ordered":1,"tax_amount":0,"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,"name":"Endeavor Daytrip Backpack","original_price":33,"price":33,"price_incl_tax":33,"product_id":11,"product_type":"simple","qty_ordered":1,"row_total":33,"row_total_incl_tax":33,"sku":"24-WB06","store_id":1,"weight":1}],"billing_address":{"address_type":"billing","city":"Chennai","company":"Netmeds","country_id":"IN","customer_address_id":4,"email":"sharvesh@gmail.com","firstname":"Sharvesh","lastname":"C","postcode":"600117","region":"Tamilnadu","street":["6A,4th street,Keelkattalai"],"telephone":"9840626148"},"payment":{"amount_ordered":38,"base_amount_ordered":38,"base_shipping_amount":5,"method":"checkmo","shipping_amount":5},"status_histories":[],"extension_attributes":{"shipping_assignments":[{"shipping":{"address":{"address_type":"shipping","city":"Chennai","company":"Netmeds","country_id":"IN","customer_address_id":4,"email":"sharvesh@gmail.com","firstname":"Sharvesh","lastname":"C","postcode":"600117","region":"Tamilnadu","street":["6A,4th street,Keelkattalai"],"telephone":"9840626148"},"method":"flatrate_flatrate","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,"name":"Endeavor Daytrip Backpack","original_price":33,"price":33,"price_incl_tax":33,"product_id":11,"product_type":"simple","qty_ordered":1,"row_total":33,"row_total_incl_tax":33,"sku":"24-WB06","store_id":1,"weight":1}],"extension_attributes":[]}],"applied_taxes":[],"item_applied_taxes":[],"converting_from_quote":true}}}

告诉我是否遗漏任何东西,或者我需要添加任何东西.

Tell me whether am missing anything or i need to add anything.

推荐答案

根据模型方案( http://devdocs.magento.com/swagger/)您确实错过了一些参数,我会尝试从此开始:

according the model scheme (http://devdocs.magento.com/swagger/) you do miss some parameters, I would try to start with this :

"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": {}
  },

这篇关于Magento 2 Rest API创建订单而不添加送货地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆