cancel
Showing results for 
Search instead for 
Did you mean: 

cash on delivery getting Error occurred on the server Please try to place the order

cash on delivery getting Error occurred on the server Please try to place the order

I am using REST API to place order in Magento2.2.6. And getting error "An error occurred on the server. Please try to place the order again." i have updated Magento version recently from 2.2.4 to 2.2.6
what should i do to resolve this error.

4 REPLIES 4

Re: cash on delivery getting Error occurred on the server Please try to place the order

Hello @pratap_penmetsa,

 

Please try below steps to place an order

Get a single product

curl -g -X GET "$base_url/index.php/rest/V1/products/24-MB05/" \
-H "Authorization: Bearer $token" 


Create cart

curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/" \
-H "Authorization: Bearer $token" 


Get Cart

curl -g -X GET "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5" \
-H "Authorization: Bearer $token" 


Add Product To Cart

curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/items" \
-H "Authorization: Bearer $token" \
-H "Content-Type:application/json" \
 -d '{ "cartItem": { "quote_id": "56241bf6bc084cd7589426c8754fc9c5", "sku": "24-MB05", "qty": 1 } }'


Add shipping information

curl -g -X POST "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/shipping-information" \
    -H "Authorization: Bearer $token" \
    -H "Content-Type:application/json" \
     -d '
{
    "addressInformation": {
        "shippingAddress": {
            "region": "MH",
            "region_id": 0,
            "country_id": "IN",
            "street": [
                "Chakala,Kalyan (e)"
            ],
            "company": "abc",
            "telephone": "1111111",
            "postcode": "12223",
            "city": "Mumbai",
            "firstname": "Sameer",
            "lastname": "Sawant",
            "email": "paul@qooar.com",
            "prefix": "address_",
            "region_code": "MH",
            "sameAsBilling": 1
        },
        "billingAddress": {
            "region": "MH",
            "region_id": 0,
            "country_id": "IN",
            "street": [
                "Chakala,Kalyan (e)"
            ],
            "company": "abc",
            "telephone": "1111111",
            "postcode": "12223",
            "city": "Mumbai",
            "firstname": "Sameer",
            "lastname": "Sawant",
            "email": "paul@qooar.com",
            "prefix": "address_",
            "region_code": "MH"
        },
        "shipping_method_code": "flatrate",
        "shipping_carrier_code": "flatrate"
    }
}
 '


Get Payment Method

curl -g -X GET "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/payment-information" \
    -H "Authorization: Bearer $token" 


Place Order

curl -g -X PUT "$base_url/index.php/rest/V1/guest-carts/56241bf6bc084cd7589426c8754fc9c5/order" \
    -H "Authorization: Bearer $token" \
    -H "Content-Type:application/json" \
     -d '
{
    "paymentMethod": {
        "method": "checkmo"
    }
}'

--
If my answer is useful, please Accept as Solution & give Kudos

 

 

 

Re: cash on delivery getting Error occurred on the server Please try to place the order

i am not using guest user i am adding from registered user in magento. what should i do

 

Re: cash on delivery getting Error occurred on the server Please try to place the order

@pratap_penmetsa

 

Please check if below issues link if helps you:

 

https://github.com/magento/magento2/issues/5479

https://github.com/magento/magento2/issues/6929

 

Manish Mittal
https://www.manishmittal.com/

Re: cash on delivery getting Error occurred on the server Please try to place the order

Hello @pratap_penmetsa,

 

For login customer, You have to use below endpoint URL

POST   /V1/carts/:cartId/shipping-information

--
If my answer is useful, please Accept as Solution & give Kudos