cancel
Showing results for 
Search instead for 
Did you mean: 

Problem setting shipping information to a guest order through web API

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Problem setting shipping information to a guest order through web API

Hi

 

I am developing a webapp that will perform checkout using Magentos web api.

So far I am able to create a guest cart, add items to it, estimate shipping costs, but when I try to apply shipping-information to the order, I keep getting an error.

 

I post my address information and carrier-code and shipping method code to:

/rest/V1/guest-carts/Tmoy3t5NW70ORzYnDFCr4pFo2kgUQQdE/shipping-information

Here is the body I send to this endpoint:

{
"addressInformation": {
"**bleep**": "0776",
"city": "Oslo",
"email": "jens@nowaynorway.no",
"firstname": "Jens",
"lastname": "Hansen",
"telephone": "12332122",
"save_in_address_book": 0,
"same_as_billing": 0
}
}, "shipping_carrier_code": "flatrate", "shipping_method_code": "flatrate"
};

The carrier code and shipping_method_code are both extracted from the result I get when calling the "estimate shipping costs" API endpoint.

I am not including region, region_id and region_code in my request, because it seems like Norway is not separated into regions.

 

It responds with a 404 error stating: 

message: "Carrier with such method not found: %1, %2","parameters":[null,null]

 

I am running magento CE 2.3.0 in a docker container on a macbook pro.

 

Guest checkouts using flatrate as shipping method works as expected in the magento storefront.

 

I have been stuck on this problem for a few days, any help would be greatly appreciated. Smiley Happy

 

 

1 REPLY 1

Re: Problem setting shipping information to a guest order through web API

In case anyone finds this, the documentation is wrong.

Worked for me using lower camel case for the shipping details.

 

 

"shippingCarrierCode": "flatrate", "shippingMethodCode": "flatrate"

The clue was the addressInformation key at the top.

 

The random mix of camel case & snake case, lazy documentation and woeful error messages really makes you glad you picked magento!