0

I need to create the order id after checkout page using endpoints from Magento-2. As per my code, I am getting the following error.

{"message":"Please check the shipping address information. postcode is a required field."}

I am giving the user inputs for the end point below.

{"paymentMethod":{"method":"cashondelivery"},"billing_address":{"email":"raj@gmail.com","region":"Odisha","region_id":0,"region_code":"Odisha","country_id":"IN","street":["test"],"postcode":"751010","city":"Bhubaneswar","telephone":"7894498320","firstname":"Raj","lastname":"kumar"}}

As per this input I need to create order and my code is given below.

$quoteUrl ='http://example.com/index.php/rest/V1/carts/mine/payment-information';
    $chQuote = curl_init($quoteUrl);
    curl_setopt($chQuote, CURLOPT_CUSTOMREQUEST, "POST");
    curl_setopt($chQuote, CURLOPT_POSTFIELDS, $dat);
    curl_setopt($chQuote, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token1)));
    curl_setopt($chQuote, CURLOPT_RETURNTRANSFER, true);
    $quote = json_decode(curl_exec($chQuote));
    $array = json_decode(json_encode($quote), True);
    echo json_encode($array);exit;

Here my postcode is correct for the order deliver but still I am getting the error as postcode is required. I need to create the order as per this history.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.