Managing the shipping or billing address
Learn how to manage the shipping or billing address.
Managing shipping and billing addresses is crucial for the seamless operation of eCommerce platforms. Accurate address information ensures that products are delivered to the correct location and that payment processes are smoothly handled. This guide will help you manage shipping and billing addresses within the Commerce API, detailing how to retrieve, update, and validate address information to enhance your transaction processes.
Billing addresses
Billing addresses are essential components in eCommerce transactions. They represent the address associated with the customer's payment method. Accurate billing address information is crucial for processing payments, fraud prevention, and ensuring that customers' payment details are correctly verified. This section will guide you on managing billing addresses within the Commerce API, retrieving billing address details, and ensuring compliance with billing standards.
Getting the billing address for an order
You can send the following request to retrieve the billing address associated with a specific order. This request will return detailed billing address information for the order, allowing you to access essential details like the address lines, city, postal code, and more. Follow the instructions below to format and send your request correctly.
To get the billing address for an order, send a GET /v1/shoppers/me/orders/{orderId}/billing-address
request. Replace {orderId}
with the actual product identifier and {Your_API_Key}
with your API key.
A successful response will include the billing address details, such as firstName
, lastName
, companyName
, line1
, city
, country
, postalCode
, and more in JSON format. See the Billing address for more information.
Getting the billing address for a cart
Follow the instructions below to retrieve the billing address associated with an active cart. This allows you to access and verify billing information before finalizing the checkout process.
To get the billing address for a cart, send a GET /v1/shoppers/me/carts/active/billing-address
request. Replace {Your_API_Key}
with your API key.
A successful 200 OK
response will include the billing address details similar to the ones provided above in JSON format. See the Billing address for more information.
Adding or updating the cart's billing address
Use the PUT
method to add or update the billing address of an active cart. This process enables you to include or modify the billing information for a customer's cart by providing the relevant address details. Follow the instructions below to send the request with the necessary payload.
Send a PUT /v1/shoppers/me/carts/active/billing-address
request with your API key Tto add or update the cart's billing address. Include the billing address details in the payload. You can add or update a customer's billing address by including the billing address (billingAddress
) object in the payload.
Example using cURL:
A successful PUT
request will return a 204 No Content
response. See the Billing address for more information.
Applying a billing address to a cart
To apply a billing address to a cart, you must send a POST
request to the Commerce API. This will ensure the billing information is correctly associated with the active cart. Applying the billing address is crucial for completing transactions and ensuring accurate billing details. Follow the instructions below to send the request.
To apply a billing address to a cart, send a POST /v1/shoppers/me/carts/active/apply-billing-address
request. Make sure to replace {Your_API_Key}
with your actual API key.
Example using cURL:
A successful POST
request will return a 200 OK
response indicating that the billing address was successfully applied to the cart. See the Billing address for more information.
Shipping addresses
Shipping addresses are crucial for ensuring that products reach the correct destination promptly. Managing shipping addresses involves retrieving, updating, and validating address details. This section will guide handling shipping addresses within the Commerce API to ensure accurate and efficient delivery of products.
Getting the shipping address for an order
You can send the following request to retrieve the shipping address associated with a specific order. This request will return detailed shipping address information for the order, allowing you to access essential details like the address lines, city, postal code, and more. Follow the instructions below to format and send your request correctly.
To get the shipping address for an order, send a GET /v1/shoppers/me/orders/{orderId}/shipping-address
request. Replace {orderId}
with the actual product identifier and {Your_API_Key}
with your API key.
A successful response will include the billing address details, such as firstName
, lastName
, companyName
, line1
, city
, country
, postalCode
, and more in JSON format. See the Shipping address for more information.
Getting the shipping address for a cart
Follow the instructions below to retrieve the shipping address associated with an active cart. This allows you to access and verify shipping information before finalizing the checkout process.
To get the shipping address for a cart, send a GET /v1/shoppers/me/carts/active/shipping-address
request. Replace {Your_API_Key}
with your API key.
A successful 200 OK
response will include the billing address details similar to the ones provided above in JSON format. See the Shipping address for more information.
Adding or updating the cart's shipping address
Use the PUT
method to add or update the shipping address of an active cart. This process enables you to include or modify the billing information for a customer's cart by providing the relevant address details. Follow the instructions below to send the request with the necessary payload.
Send a PUT /v1/shoppers/me/carts/active/shipping-address
request with your API key to add or update the cart's shipping address. Include the shipping address details in the payload. You can add or update a customer's shipping address by including the shipping address (shippingAddress
) object in the payload.
Example using cURL:
You will get a 200 Successful
response.
A successful PUT
request will return a 204 No Content
response. See the Shipping address for more information.
Applying a shipping address to a cart
To apply a shipping address to a cart, you must send a POST
request to the Commerce API. This will ensure the shipping information is correctly associated with the active cart. Applying the shipping address is crucial for completing transactions and ensuring accurate billing details. Follow the instructions below to send the request.
To apply a shipping address to a cart, send a POST /v1/shoppers/me/carts/active/apply-shipping-address
request. Make sure to replace {Your_API_Key}
with your actual API key.
Example using cURL:
A successful POST
request will return a 200 OK
response indicating that the billing address was successfully applied to the cart. See the Shipping address for more information.
Updating the shipping or billing address in the cart
Updating the shipping or billing address in the cart allows for modifications to ensure accurate and up-to-date information. This can be useful for correcting details, changing destinations, or updating billing information. This guide will show you how to send a POST request to update a cart's shipping or billing address.
To update the shipping or billing address in the cart, send a POST /v1/shoppers/me/carts/active
request. Make sure to replace {Your_API_Key}
with your actual API key. You can add or update a customer's shipping or billing address by including the shipping address (shippingAddress
) object and billing address (billingAddress
) object in the payload.
You will get a 200 Successful
response. See the Shipping address for more information.
Last updated