Adding billing to a basket
This article will guide you through how to add necessary billing information to your basket with our headless API. The Postman collection will be used for all examples.
Prerequisites
accessToken
from Connect flow.basketId
from Creating a basket.countryId
from Get countries.
Add billing address
Open the Add Billing Address
request.
Provide the basketId
property for the path variable and enter the countryId
property in appropriate place in the request body.
Request:
curl -D- -X POST {base_url}/api/v1/baskets/{basketId}/billing-address \ -H 'Authorization: Bearer <ACCESS_TOKEN>' -H 'Content-Type: application/json' \ -d '{ "City": "{City}", "firstName": "{firstName}", "lastName": "{lastName}", "postalCode": "{postalCode}", "line1": "{addressLine1}", "line2": "{addressLine2}", "countryId": "{countryId}", "email":"{email}", "state":"{state}", "mobileNumber":"{mobileNumber}", "attention":"{attention}", "companyName":"{companyName}" }'
Response:
{ "success": "true" }
Possible errors that may occur
Error | Description |
---|---|
BadRequest (400) | Missing or incorrect access token; Country not found; 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. |
{ "errors": [ { "error-description": "AccessToken not found, access denied.", "error": "BadRequest" } ] }
See Handling failures for more info.