How to use the default address when post checkout data via glue

Robson
Robson Posts: 15 🧑🏻‍🚀 - Cadet

Hey spryker,

Your example "Request sample: submit checkout data with a split shipment and addresses passed as IDs". Does not work.

The Response ist always:

{
"errors": [
{
"code": "901",
"status": 422,
"detail": "shipments.0.items => This field is missing."
},
{
"code": "901",
"status": 422,
"detail": "billingAddress.salutation => This field is missing."
},
{
"code": "901",
"status": 422,
"detail": "billingAddress.firstName => This field is missing."
},
{
"code": "901",
"status": 422,
"detail": "billingAddress.lastName => This field is missing."
},
{
"code": "901",
"status": 422,
"detail": "billingAddress.address1 => This field is missing."
},
{
"code": "901",
"status": 422,
"detail": "billingAddress.address2 => This field is missing."
},
{
"code": "901",
"status": 422,
"detail": "billingAddress.zipCode => This field is missing."
},
{
"code": "901",
"status": 422,
"detail": "billingAddress.city => This field is missing."
},
{
"code": "901",
"status": 422,
"detail": "billingAddress.iso2Code => This field is missing."
}
]
}

Answers

  • victor.vanherpt
    victor.vanherpt Spryker Solution Partner Posts: 55 🪐 - Explorer

    Hi @Robson ! For such question it would really help if you provide more information, like the payload you are sending to the api which shop setup you're testing this against (custom local, based on template, online demo shop?) etc.

    Did you try with the public b2b demo shop?

  • Robson
    Robson Posts: 15 🧑🏻‍🚀 - Cadet

    Hi @victor.vanherpt ,

    I'm using my local development which based on the spryker b2b shop.
    I've tried to checkout with the given spryker example.

    See here:

    Request sample: submit checkout data with the logged-in customer's cart data.

    https://docs.spryker.com/docs/pbc/all/cart-and-checkout/202404.0/base-shop/manage-using-glue-api/check-out/glue-api-submit-checkout-data.html#request

    But its leading to the error message that I've already posted.

  • fsmeier
    fsmeier Senior Software Engineer & Developer Enablement Advocate Sprykee Posts: 1,051 ⚖️ - Guardians (admin)

    Heyhey @Robson ,

    I tried to reproduce it on the 202404.0 b2b-demo-shop and for me the behaviour looks expected:

    I am using an auth-token for the customer sonia@spryker.com and I am doing the following request (fetched the carts before to get the proper cart-uuid):

    POST /checkout-data?include=carts HTTP/1.1
    Host: glue.de.spryker.local
    Content-Type: application/json
    Authorization: Bearer ************
    Content-Length: 230 {
    "data": {
    "type": "checkout-data",
    "attributes": {
    "idCart": "9b18aeaf-4625-5f64-8b3a-c82cda1ba27d",
    "shipment": {
    "idShipmentMethod": 1
    }
    }
    }
    }

    And with this I get the response:

    {
        "data": {
            "type": "checkout-data",
            "id": null,
            "attributes": {
                "addresses": [],
                "paymentProviders": [],
                "shipmentMethods": [],
                "selectedShipmentMethods": [
                    {
                        "id": 1,
                        "name": "Standard",
                        "carrierName": "DHL",
                        "price": 490,
                        "taxRate": null,
                        "deliveryTime": null,
                        "currencyIsoCode": "EUR"
                    }
                ],
                "selectedPaymentMethods": []
            },
            "links": {
                "self": "http://glue.de.spryker.local/checkout-data?include=carts"
            },
            "relationships": {
                "carts": {
                    "data": [
                        {
                            "type": "carts",
                            "id": "9b18aeaf-4625-5f64-8b3a-c82cda1ba27d"
                        }
                    ]
                }
            }
        },
        "included": [
            {
                "type": "carts",
                "id": "9b18aeaf-4625-5f64-8b3a-c82cda1ba27d",
                "attributes": {
                    "priceMode": "GROSS_MODE",
                    "currency": "EUR",
                    "store": "DE",
                    "name": "Dmexco event",
                    "isDefault": false,
                    "totals": {
                        "expenseTotal": 490,
                        "discountTotal": 17983,
                        "taxTotal": 15057,
                        "subtotal": 111799,
                        "grandTotal": 94306,
                        "priceToPay": 94306,
                        "shipmentTotal": 490
                    },
                    "discounts": [
                        {
                            "displayName": "20% off storage",
                            "amount": 7014,
                            "code": null
                        },
                        {
                            "displayName": "10% off minimum order",
                            "amount": 10479,
                            "code": null
                        },
                        {
                            "displayName": "Free standard delivery",
                            "amount": 490,
                            "code": null
                        }
                    ],
                    "thresholds": []
                },
                "links": {
                    "self": "http://glue.de.spryker.local/carts/9b18aeaf-4625-5f64-8b3a-c82cda1ba27d"
                }
            }
        ]
    }
    

    Should I try something else to reproduce your case?

    All the best,

    Florian

  • Robson
    Robson Posts: 15 🧑🏻‍🚀 - Cadet

    Hey @fsmeier,

    thanks for the reply. I'll try this again!