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 to a basket

This article will guide you through how to add shipping information to your basket. The Postman collection will be used for all examples.

Prerequisites

Add shipping information

Open the Add Shipping Information request.

Provide the basketId for the path variable and enter the countryId, shippingMethodId and priceGroupId in their respective places in the request body.

In order to show changes to the basket immediately, you have the option of enabling a mini basket view in all of the following requests. Find out more in the Available views section.

Request:

    
    
    curl -D- -X POST {base_url}/api/v1/baskets/{basketId}/shipping \
    -H 'Authorization: Bearer <ACCESS_TOKEN>'
    -H 'Content-Type: application/json' \
    -d '{
        "priceGroupId": "{priceGroupId}",
        "shippingMethodId": "{shippingMethodId}",
        "shippingAddress": {
                "attention":"{attention}",
                "City": "{city}",
                "companyName":"{companyName}",
                "countryId": "{countryId}",
                "email":"{email}",
                "firstName": "{firstName}",
                "lastName": "{lastName}",
                "line1": "{addressLine1}",
                "line2": "{addressLine2}",
                "mobileNumber":"{mobileNumber}",
                "phoneNumber":"{phoneNumber}",
                "postalCode": "{postalCode}",
                "state":"{state}",
            },
        }'
    
    

Response:

    
    
    {
    "success": "true"
    }
    
    

Possible errors that may occur:

Error Description
BadRequest (400) Missing or incorrect access token; Bad or missing request data; Execution of the pipeline fails; etc.
Unauthorized (401) The token is expired.
Forbidden (403) The token does not have access to this endpoint.
Not Found (404) Basket not found; Country not found; Price group not found.
    
    
    {
        "errors":
            [
                {
                "error-description": "AccessToken not found, access denied.",
                "error": "BadRequest"
                }
            ]
    }
    
    

See Handling failures for more info.