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 billing 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 billing Address

This step will teach you how to add neccessary billing information to your basket with our headless API.

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 Add Billing Address request.

Here you will enter the countryId you copied into the body of the request. For the path variable BasketID, you simply have to copy the basketId from the basket you have created via the Create Basket Request. If you have not created a basket, see Creating a basket

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

If you haven't attached your accessToken, an Error 400 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 billing address was successfully added to the order."
    }
    

After these steps, your billing information should now be added to the basket.