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.

curl --location -g --request GET ' https://api.digitalriver.com/v1/shoppers/me/orders/{orderId}/billing-address' \
--header 'Authorization: Basic Basic {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.

curl --location -g --request GET 'https://api.digitalriver.com/v1/shoppers/me/carts/active/billing-address' \
--header 'Authorization: Basic {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:

curl --location -g --request PUT 'https://api.digitalriver.com/v1/shoppers/me/carts/active/billing-address' \
--header 'Authorization: Basic {Your_API_Key}' \
...
--data-raw '{
  "address": {
    "firstName": "John",
    "lastName": "Doe",
    "companyName": "Digital River",
    "line1": "10380 Bren Road West",
    "line2": "string",
    "line3": "string",
    "city": "Minnetonka",
    "countrySubdivision": "MN",
    "postalCode": "55343",
    "country": "US",
    "countryName": "United States",
    "countyName": "Hennepin",
    "phoneNumber": "555-253-1234",
    "emailAddress": "jdoe@digitalriver.com",
    "phoneticFirstName": "クリス",
    "phoneticLastName": "ミラー",
    "division": "製品開発",
    "title": "M"
  }
}'

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:

curl --location -g --request POST ' https://api.digitalriver.com/v1/shoppers/me/carts/active/apply-billing-address' \
--header 'Authorization: Basic {Your_API_Key}' \
...

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.

curl --location -g --request GET ' https://api.digitalriver.com/v1/shoppers/me/orders/{orderId}/shipping-address' \
--header 'Authorization: Basic {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.

curl --location -g --request GET ' https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address' \
--header 'Authorization: Basic {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.

curl --location -g --request PUT ' https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address' \
--header 'Authorization: Basic {Your_API_Key}' \
--data-raw '{
  "address": {
    "firstName": "John",
    "lastName": "Doe",
    "companyName": "Digital River",
    "line1": "10380 Bren Road West",
    "line2": "string",
    "line3": "string",
    "city": "Minnetonka",
    "countrySubdivision": "MN",
    "postalCode": "55343",
    "country": "US",
    "countryName": "United States",
    "countyName": "Hennepin",
    "phoneNumber": "555-253-1234",
    "emailAddress": "jdoe@digitalriver.com",
    "phoneticFirstName": "クリス",
    "phoneticLastName": "ミラー",
    "division": "製品開発"
  }
}'

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:

curl --location -g --request POST ' https://api.digitalriver.com/v1/shoppers/me/carts/active/apply-shipping-address' \
--header 'Authorization: Basic {Your_API_Key}' \
--data-raw '{
    "address": {
    "firstName": "John",
    "lastName": "Doe",
    "companyName": "Digital River",
    "line1": "10380 Bren Road West",
    "line2": "string",
    "line3": "string",
    "city": "Minnetonka",
    "countrySubdivision": "MN",
    "postalCode": "55343",
    "country": "US",
    "countryName": "United States",
    "countyName": "Hennepin",
    "phoneNumber": "555-253-1234",
    "emailAddress": "jdoe@digitalriver.com",
    "phoneticFirstName": "クリス",
    "phoneticLastName": "ミラー",
    "division": "製品開発"
  }
}'

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.

curl --location -g --request POST ' https://api.digitalriver.com/v1/shoppers/me/carts/active?expand=all' \
--header 'Authorization: Basic {Your_API_Key}' \
-data-raw '{
  "cart": {
    "ipAddress": "10.24.2.28",
    "customAttributes": {
      "attribute": [
        {
          "name": "name",
          "value": "string",
          "type": "string"
        }
      ]
    },
    "suppressOrderConfirmationEmail": true,
    "lineItems": {
      "lineItem": [
        {
          "quantity": "1",
          "product": {
            "id": 1234
          },
          "customAttributes": {
            "attribute": [
              {
                "name": "name",
                "value": "string",
                "type": "string"
              }
            ]
          }
        }
      ]
    },
    "billingAddress": {
      "uri": "https://api.digitalriver.com/v1/shoppers/me/address/47278020023",
      "relation": "https://developers.digitalriver.com/v1/shoppers/AddressesResource",
      "id": "billingAddress",
      "firstName": "Automation",
      "lastName": "Tester",
      "companyName": "Digital River",
      "line1": "PO BOX 6930",
      "line2": "123",
      "line3": "Suite Line 3",
      "city": "Waconia",
      "countrySubdivision": "MN",
      "postalCode": "5387.0",
      "country": "US",
      "countryName": "United States",
      "phoneNumber": "099-222-44454",
      "emailAddress": "automatedTester@digitalriver.com",
      "countyName": "Hennepin",
      "phoneticFirstName": "クリス",
      "phoneticLastName": "ミラー",
      "division": "製品開発",
      "title": "M"
    },
    "shippingAddress": {
      "uri": "https://api.digitalriver.com/v1/shoppers/me/address/47278020023",
      "relation": "https://developers.digitalriver.com/v1/shoppers/AddressesResource",
      "id": "shippingAddress",
      "firstName": "Automation",
      "lastName": "Tester",
      "companyName": "Digital River",
      "line1": "PO BOX 6930",
      "line2": "123",
      "line3": "Suite Line 3",
      "city": "Waconia",
      "countrySubdivision": "MN",
      "postalCode": "5387.0",
      "country": "US",
      "countryName": "United States",
      "phoneNumber": "099-222-44454",
      "countyName": "Hennepin",
      "emailAddress": "automatedTester@digitalriver.com",
      "phoneticFirstName": "クリス",
      "phoneticLastName": "ミラー",
      "division": "製品開発"
    },
    "termsOfSalesAcceptance": "true",
    "chargeType": "moto",
    "organizationId": "digitalriver12345"
  }
}'

You will get a 200 Successful response. See the Shipping address for more information.

Last updated