Magento2: Magento 2 Rest Api Payment Information Webservice - "Shipping address is not set" ISSUE

Created on 12 Sep 2016  ·  7Comments  ·  Source: magento/magento2

We are getting this error "Shipping address is not set" when we are posting to /rest/V1/carts/mine/payment-information

Preconditions

  1. Magento 2.0.5
  2. PHP 5.6.19
  3. MySql 5

Steps to reproduce

  1. First post data to the following rest api url /rest/V1/carts/mine/shipping-information

REQUEST -

{"addressInformation":{"shippingAddress":{"id":54,"customer_id":4,"region":"MH","region_id":0,"country_id":"IN","street":["Chakala,Kalyan (e)"],"company":"abc","telephone":"1111111","postcode":"12223","city":"Mumbai","firstname":"Sameer","lastname":"Sawant","prefix":"address_","region_code":"MH","sameAsBilling":1},"billingAddress":{"id":54,"customer_id":4,"region":"MH","region_id":0,"country_id":"IN","street":["Chakala,Kalyan (e)"],"company":"abc","telephone":"1111111","postcode":"12223","city":"Mumbai","firstname":"Sameer","lastname":"Sawant","prefix":"address_","region_code":"MH"},"shipping_method_code":"flatrate","shipping_carrier_code":"flatrate"}}

Response -

{
"payment_methods": [
{
"code": "cashondelivery",
"title": "Cash On Delivery"
},
{
"code": "checkmo",
"title": "Check / Money order"
},
{
"code": "free",
"title": "No Payment Information Required"
}
],
"totals": {
"grand_total": 14.55,
"base_grand_total": 14.55,
"subtotal": 14.55,
"base_subtotal": 14.55,
"discount_amount": 0,
"base_discount_amount": 0,
"subtotal_with_discount": 14.55,
"base_subtotal_with_discount": 14.55,
"shipping_amount": 0,
"base_shipping_amount": 0,
"shipping_discount_amount": 0,
"base_shipping_discount_amount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"weee_tax_applied_amount": null,
"shipping_tax_amount": 0,
"base_shipping_tax_amount": 0,
"subtotal_incl_tax": 14.55,
"shipping_incl_tax": 0,
"base_shipping_incl_tax": 0,
"base_currency_code": "AED",
"quote_currency_code": "AED",
"items_qty": 1,
"items": [
{
"item_id": 82,
"price": 14.55,
"base_price": 14.55,
"qty": 1,
"row_total": 14.55,
"base_row_total": 14.55,
"row_total_with_discount": 0,
"tax_amount": 0,
"base_tax_amount": 0,
"tax_percent": 0,
"discount_amount": 0,
"base_discount_amount": 0,
"discount_percent": 0,
"price_incl_tax": 14.55,
"base_price_incl_tax": 14.55,
"row_total_incl_tax": 14.55,
"base_row_total_incl_tax": 14.55,
"options": "[]",
"weee_tax_applied_amount": null,
"weee_tax_applied": null,
"name": "Keratin"
}
],
"total_segments": [
{
"code": "subtotal",
"title": "Subtotal",
"value": 14.55
},
{
"code": "shipping",
"title": "Shipping & Handling",
"value": 0
},
{
"code": "tax",
"title": "Tax",
"value": 0,
"extension_attributes": {
"tax_grandtotal_details": []
}
},
{
"code": "grand_total",
"title": "Grand Total",
"value": 14.55,
"area": "footer"
}
]
}
}

  1. Afterwards POST data to /rest/V1/carts/mine/set-payment-information

REQUEST -

{"paymentMethod":{"po_number":32,"method":"cashondelivery"},"billingAddress":{"id":54,"customer_id":4,"region":"MH","region_id":0,"country_id":"IN","street":["Chakala,Kalyan (e)"],"company":"abc","telephone":"1111111","postcode":"400059","city":"Mumbai","firstname":"Sameer","lastname":"Sawant","prefix":"address_","region_code":"MH"}}

RESPONSE -

{
"message": "Shipping address is not set"
}

Please let us know where are we going wrong.

Can you kindly tell us the rest api checkout process steps. It might be we must be missing something due to which we are getting the above error.

Expected result

  1. Order must be created from cart and get ID in response

Actual result

  1. [Screenshot, logs]

{
"message": "Shipping address is not set"
}

Checkout FrameworWebapi bug report

All 7 comments

@omkarambre thank you for reporting!
Is this issue reproducible for you on the latest develop branch or 2.1.1 release?
I've checked on develop with a bit modified your payload

{
"paymentMethod":{"po_number":32,"method":"cashondelivery"},
"billingAddress":{"region":"MH","country_id":"IN","street":["Chakala,Kalyan (e)"],"company":"abc","telephone":"1111111","postcode":"400059","city":"Mumbai","firstname":"Sameer","lastname":"Sawant","prefix":"address_","region_code":"MH"}
}

and got a response "true".

This method /rest/V1/carts/mine/set-payment-information doesn't accept the parameter suggested: "billingAddress".

but these parameters:

    $requestData = [
        "cartId" => $cartId,
        "method" => [
            'method' => 'checkmo',
            'po_number' => '200'
        ],
    ];

@omkarambre rechecked on 2.0.9
to service rest/V1/carts/mine/shipping-information POSTed

{"addressInformation":{"shippingAddress":{"customer_id":2,"region":"MH","country_id":"IN","street":["Chakala,Kalyan (e)"],"company":"abc","telephone":"1111111","postcode":"12223","city":"Mumbai","firstname":"Sameer","lastname":"Sawant","prefix":"address_","region_code":"MH","sameAsBilling":1},"billingAddress":{"customer_id":2,"region":"MH","country_id":"IN","street":["Chakala,Kalyan (e)"],"company":"abc","telephone":"1111111","postcode":"12223","city":"Mumbai","firstname":"Sameer","lastname":"Sawant","prefix":"address_","region_code":"MH"},"shipping_method_code":"flatrate","shipping_carrier_code":"flatrate"}}

then POSTed to rest/V1/carts/mine/set-payment-information

{"paymentMethod":{"po_number":32,"method":"cashondelivery"},"billingAddress":{"customer_id":2,"region":"MH","country_id":"IN","street":["Chakala,Kalyan (e)"],"company":"abc","telephone":"1111111","postcode":"400059","city":"Mumbai","firstname":"Sameer","lastname":"Sawant","prefix":"address_","region_code":"MH"}}

and everything worked fine.

Closing the issue as we didn't find steps to reproduce. Please feel free to create new issue when you find them.

I am facing this issue after upgrade 2.1.2 to 2.1.7.

I am getting below error on browser console
"NetworkError: 400 Bad Request - https://yourdomain.com/rest/uk/V1/guest-carts/046f57dc5db1cfb2c685c3004fb2560b/payment-information"

and showing "Shipping address is not set" error in payment section when click on place order button.
Please suggest.

I am getting below error on browser console
"NetworkError: 400 Bad Request - https://yourdomain.com/rest/default/V1/carts/mine/payment-information"

and showing "Please specify the shipping method" error in payment section when clicking on place order button for login customer

Hello,
Kindly go through my blog to fix this error.

http://magento2restapi.blogspot.com

Was this page helpful?
0 / 5 - 0 ratings