Guest customer /V1/guest-carts/:cartId/shipping-information REST API Magento 2.

Guest Quote REST API /V1/guest-carts/:cartId/shipping-information to fetch available payment method and cart totals related information.

When you work with the Guest Customer Order flow via API, you need given API details to fetch the payment method for the current quote.

Action: POST

URL: <WEBSITE_URL>/rest/<store_code>/V1/guest-carts/:cartId/shipping-information
(Example: https://magento.test/rest/default/V1/guest-carts/fQtl1bxLdxud1fFEP68znOAPnAFFpjVh/shipping-information)

Payload:

{
    "addressInformation": {
        "shipping_address": {
            "region": "California",
            "region_id": "12",
            "country_id": "US",
            "street": [
                "34 Royal Street"
            ],
            "postcode": "NG1 1NB",
            "city": "California",
            "firstname": "Rakesh",
            "lastname": "Patel",
            "email": "rakesh@jesadiya.com",
            "telephone": "4422531111"
        },
        "billing_address": {
            "region": "California",
            "region_id": "12",
            "country_id": "US",
            "street": [
                "34 Royal Street"
            ],
            "postcode": "NG1 1NB",
            "city": "California",
            "firstname": "Rakesh",
            "lastname": "Patel",
            "email": "rakesh@jesadiya.com",
            "telephone": "4422531111"
        },
        "shipping_carrier_code": "flatrate",
        "shipping_method_code": "flatrate"
    }
}

You must need to pass shipping_address and billing_address data with shipping_carrier_code and shipping_method_code for the current quote.

You can fetch the shipping carrier and method code from the Guest Estimate shipping method REST API.

Response:

{
    "payment_methods": [
        {
            "code": "checkmo",
            "title": "Check / Money order"
        },
        {
            "code": "paypal...",
            "title": "Credit / Debit card"
        }
    ],
    "totals": {
         .....
    }
}