Documentation

Ucommerce includes full API reference documentation and lots of helpful articles to help you build your e-commerce site as effortlessly as possible.

Topics Payment Providers
v7.18

Adding shipping information to your basket

The first thing you need to do is to attach your accessToken to the request's header. See Quick Start if you are not sure how to do that.

Before you begin

Before starting this step, make sure you have done the prerequisites. Which are to do the Get countries step, where you need the countryId. As well as the Creating a basket step, where you will need the basketId.

Add shipping information

This step will teach you how to add shipping information to your basket.

First you must go to the Get Countries endpoint, select a country and then copy it's countryId. See Get countries if you are not sure how to do that.

Then you must go to the Get Shipping Methods request and call it to select one of the returned shipping methods. If you are unsure of how to do that, see the Get shipping methods step.

The next step is to navigate to the Add Shipping Information request. Here you will need to insert the basketId in your path variables. If you have not created a basket, see Creating a basket In the body you will need to insert the shippingMethodId, priceGroupId and countryId that you previously copied.

    
    curl -D- -X POST https://ucommerce-headless-backend.azurewebsites.net/api/v1/baskets/{basketId}/shipping \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
    -d '{
    
                    "attention":"Warning, warning",
                    "City": "Aalborg",
                    "companyName":"Vrooms",
                    "countryId": "en-US",
                    "email":"[email protected]",
                    "firstName": "John",
                    "lastName": "Doe",
                    "line1": "Klostergade 65",
                    "line2": "",
                    "mobileNumber":"",
                    "phoneNumber":"",
                    "postalCode": "9000",
                    "state":"javescript",
                }'
    

If you haven't attached your accessToken, an Error 401 will be returned to you. Example:

    
    {
    "description": "AccesToken not found, access denied."
    }
    

If you entered an incorrect basketId, an Error 404 will be returned to you. Example:

    
    {
    "description": "Basket with the supplied id basketId was not found."
    }
    

If you entered information in the incorrect format, wou will get an Error 400. Example:

    
    {
    "description": "Bad request. postalCode must be a string longer than 0"
    }
    

If you get a successful response, you will get a message like this. Example:

    
    {
    "description": "The shipping address was successfully added to the order."
    }
    

After these steps, your basket should have shipping information