What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hey all… When trying to use the checkout endpoint on Glue, I’m getting this error: ```Spryker\Shar

U02P7B6K2LC
U02P7B6K2LC Posts: 121 🧑🏻‍🚀 - Cadet
edited September 2022 in Help

Comments

  • U02P7B6K2LC
    U02P7B6K2LC Posts: 121 🧑🏻‍🚀 - Cadet

    This is the post request body:

    {
        "data": {
            "type": "checkout",
            "attributes": {
                "customer": {
                    "salutation": "Mr",
                    "email": "<mailto:spencor.hopkin@spryker.com|spencor.hopkin@spryker.com>",
                    "firstName": "Spencor",
                    "lastName": "Hopkin"
                },
                "idCart": "273d2ebb-965c-5ace-883a-fff2a9a7554f",
                "billingAddress": {
                    "salutation": "Mr",
                    "firstName": "Spencor",
                    "lastName": "Hopkin",
                    "address1": "Julie-Wolfthorn-Straße",
                    "address2": "1",
                    "address3": "new address",
                    "zipCode": "10115",
                    "city": "Berlin",
                    "iso2Code": "DE",
                    "company": "spryker",
                    "phone": "+49 (30) 2084 98350"
                },
                "payments": [
                    {
                        "paymentMethodName": "Credit Card",
                        "paymentProviderName": "DummyPayment"
                    }
                ],
                "shipments": [
                    {
                        "items": [
                            "1044"
                        ],
                        "shippingAddress": {
                            "id": null,
                            "salutation": "Mr",
                            "firstName": "Spencor",
                            "lastName": "Hopkin",
                            "address1": "Urbanstraße",
                            "address2": "119",
                            "address3": "Spencor's address",
                            "zipCode": "10967",
                            "city": "Berlin",
                            "iso2Code": "DE",
                            "company": "spryker",
                            "phone": "+49 (30) 2084 98350"
                        },
                        "idShipmentMethod": 1,
                        "requestedDeliveryDate": "2022-09-29"
                    }
                ]
            }
        }
    
  • U021QH3GDGV
    U021QH3GDGV Posts: 17 🧑🏻‍🚀 - Cadet

    Is that OOTB endpoint of spryker?
    In your error message it says: "Request URI: //checkout?include=orders"

    https://docs.spryker.com/docs/scos/dev/glue-api-guides/202204.0/rest-api-b2c-reference.html#/checkout/create-checkout

    In documentation is states that it is "POST" method so your endpoint can not include "?include=orders" part. IMO.

  • U02P7B6K2LC
    U02P7B6K2LC Posts: 121 🧑🏻‍🚀 - Cadet

    Yes… sorry … I’ve since removed that and we still get an error.

  • U02P7B6K2LC
    U02P7B6K2LC Posts: 121 🧑🏻‍🚀 - Cadet

    I’ll edit my post with the latest error… 👍👍👍

  • Alberto Reyer
    Alberto Reyer Posts: 690 🪐 - Explorer

    In documentation is states that it is "POST" method so your endpoint can not include "?include=orders" part. IMO.

    That's not true according to the HTTP 1.1 Specification. There is no part that prohibits sending query parameters and a body for any non idempotent HTTP method.
    In fact looking at the code of Symfony Request, it reads the query parameters all the time, independent of the http method.

    Sorry to take it a little bit off topic, just want to ensure no one remembers a false information here.

    Regarding the issuen, from the error it seems like the "method" is not added to quote.shipments.
    I would check in the \SprykerShop\Yves\CheckoutPage\Plugin\ShipmentHandlerPlugin if it is a) used and b) that \Spryker\Zed\Shipment\Business\Expander\QuoteShipmentExpander::expandQuoteWithShipmentGroups correctly hydrates the shipping method.
    This assumes you are running the most up to date version of those modules.

  • U02P7B6K2LC
    U02P7B6K2LC Posts: 121 🧑🏻‍🚀 - Cadet

    Thank you Alberto… I’ll check this now and FYI… yes we’re using the latest versions.

  • U02P7B6K2LC
    U02P7B6K2LC Posts: 121 🧑🏻‍🚀 - Cadet

    Ok so it turns out that any shipment method we create in the Backoffice… it works… but any that we import from the CSV are not working… so it looks like this is a data issue.

  • U02P7B6K2LC
    U02P7B6K2LC Posts: 121 🧑🏻‍🚀 - Cadet

    Ok I solved this… turns out that our CSVs weren’t importing the prices properly… 🙀