# Managing 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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/billing-address#v1-shoppers-me-orders-orderid-billing-address) request. Replace `{orderId}` with the actual product identifier and `{Your_API_Key}` with your API key.&#x20;

{% tabs %}
{% tab title="cURL" %}

```http
curl --location -g --request GET ' https://api.digitalriver.com/v1/shoppers/me/orders/{orderId}/billing-address' \
--header 'Authorization: Basic Basic {Your_API_Key}' \
..
```

{% endtab %}

{% tab title="200 OK response" %}
You will get a `200 Successful` response.

```json
{
  "uri": "https://api.digitalriver.com/v1/shoppers/me/address/47278020023",
  "relation": "https://developers.digitalriver.com/v1/shoppers/AddressesResource",
  "id": "billingAddress",
  "firstName": "John",
  "lastName": "Doe",
  "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": "555-222-44454",
  "emailAddress": "jdoe@digitalriver.com",
  "countyName": "Hennepin",
  "phoneticFirstName": "クリス",
  "phoneticLastName": "ミラー",
  "division": "製品開発",
  "title": "M"
}
```

{% endtab %}
{% endtabs %}

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 [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/billing-address#v1-shoppers-me-orders-orderid-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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/billing-address#v1-shoppers-me-carts-active-billing-address) request. Replace `{Your_API_Key}` with your API key.&#x20;

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="200 OK response" %}
You will get a `200 Successful` response.

```json
{
  "uri": "https://api.digitalriver.com/v1/shoppers/me/address/47278020023",
  "relation": "https://developers.digitalriver.com/v1/shoppers/AddressesResource",
  "id": "billingAddress",
  "firstName": "John",
  "lastName": "Doe",
  "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": "555-222-44454",
  "emailAddress": "jdoe@digitalriver.com",
  "countyName": "Hennepin",
  "phoneticFirstName": "クリス",
  "phoneticLastName": "ミラー",
  "division": "製品開発",
  "title": "M"
}
```

{% endtab %}
{% endtabs %}

A successful `200 OK` response will include the billing address details similar to the ones provided above in JSON format. See the [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/billing-address#v1-shoppers-me-carts-active-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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/billing-address#v1-shoppers-me-carts-active-billing-address-1) 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:

{% tabs %}
{% tab title="cURL" %}

```http
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"
  }
}'
```

{% endtab %}
{% endtabs %}

A successful `PUT` request will return a `204 No Content` response. See the [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/billing-address#v1-shoppers-me-carts-active-billing-address-1) 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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/billing-address#v1-shoppers-me-carts-active-apply-billing-address) request. Make sure to replace `{Your_API_Key}` with your actual API key.

Example using cURL:

{% tabs %}
{% tab title="cURL" %}

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

{% endtab %}

{% tab title="200 OK response" %}
You will get a `200 Successful` response.

```json
{
  "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active",
  "paymentMethods": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/payment-methods"
  },
  "applyPaymentMethod": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/apply-payment-method"
  },
  "submitCart": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/submit-cart"
  },
  "webCheckout": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/web-checkout"
  },
  "id": "47278010023",
  "lineItems": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items",
    "lineItem": [
      {
        "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/488822300023",
        "id": "488822300023",
        "quantity": "1",
        "product": {
          "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500",
          "parentProduct": {
            "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64358200"
          },
          "id": "64578500",
          "name": "Class I",
          "displayName": "Class I",
          "shortDescription": "Class I is the perfect GPS waypoint and route manager for the beginning or occasional GPS user.",
          "longDescription": "Class I is the fast and easy way to create, edit, and transfer waypoints and routes between your computer and your Garmin, Magellan, or Lowrance GPS. Using Class I, you can manage all of your waypoints and routes, and display them in lists sorted by name, elevation, or distance. Class I connects your GPS to the best mapping and information sites on the Internet, giving you one-click access to street and topo maps, aerial photos, weather forecasts, and nearby attractions.",
          "productType": "DOWNLOAD",
          "sku": "Class I",
          "externalReferenceId": "Test External Reference Number",
          "companyId": "demosft1",
          "displayableProduct": "true",
          "purchasable": "true",
          "manufacturerName": "Test Manufacturer Name",
          "manufacturerPartNumber": "Test Manufacturer Part Number",
          "thumbnailImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg",
          "productImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/detail/classIBox.jpg",
          "keywords": "testKeyword",
          "customAttributes": {
            "attribute": [
              {
                "name": "name",
                "value": "string",
                "type": "string"
              }
            ]
          }
        },
        "pricing": {
          "listPrice": {
            "currency": "USD",
            "value": 101
          },
          "listPriceWithQuantity": {
            "currency": "USD",
            "value": 1010
          },
          "salePriceWithQuantity": {
            "currency": "USD",
            "value": 959.5
          },
          "formattedListPrice": "101.00USD",
          "formattedListPriceWithQuantity": "1010.00USD",
          "formattedSalePriceWithQuantity": "959.50USD",
          "formattedCommitmentPrice": "$240.00",
          "commitmentPrice": {
            "currency": "USD",
            "value": "240.00"
          },
          "productTax": {
            "currency": "USD",
            "value": "1.35"
          },
          "shippingTax": {
            "currency": "USD",
            "value": "0.65"
          },
          "feeTax": {
            "currency": "USD",
            "value": "2.00"
          },
          "taxRate": "0.1111",
          "importTax": {
            "currency": "USD",
            "value": 0
          },
          "formattedImportTax": "0.00USD",
          "importDuty": {
            "currency": "USD",
            "value": 0
          },
          "formattedImportDuty": "0.00USD"
        }
      }
    ]
  },
  "totalItemsInCart": "1",
  "businessEntityCode": "DR_INC-ENTITY",
  "billingAddress": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/billing-address"
  },
  "shippingAddress": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address"
  },
  "paymentMethod": {
    "type": "creditCard",
    "sourceId": "a231f38d-3a07-4a13-96ed-89693ba7d56c",
    "sourceClientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
    "creditCard": {
      "expirationYear": "2030",
      "lastFourDigits": "0000",
      "clientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
      "expirationMonth": "08",
      "fundingSource": "debit",
      "brand": "Visa",
      "reusable": "true"
    },
    "amountContributed": {
      "currency": "USD",
      "value": 1059.5
    },
    "charges": [
      {
        "chargeId": "1cac37c0-98a7-46b2-b9ed-fbc615c9f18a",
        "amount": {
          "currency": "USD",
          "value": 1059.5
        },
        "status": "failed",
        "createdTime": "2021-12-06T09:03:46.877Z",
        "updatedTime": "2021-12-06T09:03:46.877Z"
      }
    ],
    "supplementaryPaymentMethods": [
      {
        "type": "customerCredit",
        "sourceId": "a231f38d-3a07-4a13-96ed-89693ba7d56c",
        "sourceClientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
        "customerCredit": {
          "flow": "standard",
          "reusable": "true"
        },
        "charges": [
          {
            "chargeId": "cf57f9c9-8b0d-4e64-998a-816499fefa01",
            "amount": {
              "currency": "USD",
              "value": 1059.5
            },
            "status": "failed",
            "createdTime": "2021-12-06T09:03:46.877Z",
            "updatedTime": "2021-12-06T09:03:46.877Z"
          }
        ],
        "amountContributed": {
          "currency": "USD",
          "value": 1059.5
        }
      }
    ]
  },
  "payment": {
    "name": "Discover",
    "displayableNumber": "************4321",
    "expirationMonth": 0,
    "expirationYear": 2030
  },
  "paymentSession": {
    "id": "string",
    "status": "string",
    "clientSecret": "string",
    "redirectUrl": "https://api.digitalriver.com:80/payments/redirects/12759bb0-xxxx-4bdb-bfeb-9095ba8059fc?apiKey=a88fxxxx1eef47eb95bc609c22e593c8",
    "amountContributed": {
      "currency": "USD",
      "value": 1059.5
    },
    "amountRemainingToBeContributed": {
      "currency": "USD",
      "value": 1059.5
    }
  },
  "shippingOptions": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-options"
  },
  "taxInclusive": true,
  "landedCostState": "NOT_ELIGIBLE",
  "pricing": {
    "subtotal": {
      "currency": "USD",
      "value": 1059.5
    },
    "discount": {
      "currency": "USD",
      "value": 0
    },
    "shippingAndHandling": {
      "currency": "USD",
      "value": 11.47
    },
    "importTaxAndDuty": {
      "currency": "USD",
      "value": 0
    },
    "tax": {
      "currency": "USD",
      "value": 178.49
    },
    "orderTotal": {
      "currency": "USD",
      "value": 1070.97
    },
    "formattedSubtotal": "1,059.50GBP",
    "formattedDiscount": "0.00USB",
    "formattedShippingAndHandling": "11.47USD",
    "formattedImportTaxAndDuty": "0.00USD",
    "formattedTax": "178.49USD",
    "formattedOrderTotal": "1,070.97USD"
  },
  "termsOfSalesAcceptance": "true",
  "chargeType": "moto",
  "customerType": "B",
  "taxRegistrations": [
    {
      "key": "UK_VAT",
      "value": "GB698588737"
    }
  ],
  "organizationId": "digitalriver12345"
}
```

{% endtab %}
{% endtabs %}

A successful `POST` request will return a `200 OK` response indicating that the billing address was successfully applied to the cart. See the [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/billing-address#v1-shoppers-me-carts-active-apply-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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/shipping-address#v1-shoppers-me-orders-orderid-shipping-address) request. Replace `{orderId}` with the actual product identifier and `{Your_API_Key}` with your API key.&#x20;

{% tabs %}
{% tab title="cURL" %}

```http
curl --location -g --request GET ' https://api.digitalriver.com/v1/shoppers/me/orders/{orderId}/shipping-address' \
--header 'Authorization: Basic {Your_API_Key}' \
...
```

{% endtab %}

{% tab title="200 OK response" %}
You will get a `200 Successful` response.

```json
{
  "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": "555-222-4445",
  "countyName": "Hennepin",
  "emailAddress": "automatedTester@digitalriver.com",
  "phoneticFirstName": "クリス",
  "phoneticLastName": "ミラー",
  "division": "製品開発"
}
```

{% endtab %}
{% endtabs %}

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 [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/shipping-address#v1-shoppers-me-orders-orderid-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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/shipping-address#v1-shoppers-me-carts-active-shipping-address) request. Replace `{Your_API_Key}` with your API key.&#x20;

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```http
curl --location -g --request GET ' https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address' \
--header 'Authorization: Basic {Your_API_Key}' \
...
```

{% endcode %}
{% endtab %}

{% tab title="200 OK response" %}
You will get a `200 Successful` response.

{% code overflow="wrap" %}

```json
{
  "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": "製品開発"
}
```

{% endcode %}
{% endtab %}
{% endtabs %}

A successful `200 OK` response will include the billing address details similar to the ones provided above in JSON format. See [Shipping address](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/shipping-address#v1-shoppers-me-carts-active-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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/shipping-address#v1-shoppers-me-carts-active-shipping-address-1) 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:

{% tabs %}
{% tab title="cURL" %}
You will get a `200 Successful` response.

```http
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": "製品開発"
  }
}'
```

{% endtab %}
{% endtabs %}

A successful `PUT` request will return a `204 No Content` response. See the [query parameters ](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/shipping-address#v1-shoppers-me-carts-active-shipping-address-1)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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/shipping-address#v1-shoppers-me-carts-active-apply-shipping-address) request. Make sure to replace `{Your_API_Key}` with your actual API key.

Example using cURL:

{% tabs %}
{% tab title="cURL" %}

```http
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": "製品開発"
  }
}'
```

{% endtab %}

{% tab title="200 OK response" %}
You will get a `200 Successful` response.

```json
{
  "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active",
  "paymentMethods": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/payment-methods"
  },
  "applyPaymentMethod": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/apply-payment-method"
  },
  "submitCart": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/submit-cart"
  },
  "webCheckout": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/web-checkout"
  },
  "id": "47278010023",
  "lineItems": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items",
    "lineItem": [
      {
        "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/488822300023",
        "id": "488822300023",
        "quantity": "1",
        "product": {
          "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500",
          "parentProduct": {
            "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64358200"
          },
          "id": "64578500",
          "name": "Class I",
          "displayName": "Class I",
          "shortDescription": "Class I is the perfect GPS waypoint and route manager for the beginning or occasional GPS user.",
          "longDescription": "Class I is the fast and easy way to create, edit, and transfer waypoints and routes between your computer and your Garmin, Magellan, or Lowrance GPS. Using Class I, you can manage all of your waypoints and routes, and display them in lists sorted by name, elevation, or distance. Class I connects your GPS to the best mapping and information sites on the Internet, giving you one-click access to street and topo maps, aerial photos, weather forecasts, and nearby attractions.",
          "productType": "DOWNLOAD",
          "sku": "Class I",
          "externalReferenceId": "Test External Reference Number",
          "companyId": "demosft1",
          "displayableProduct": "true",
          "purchasable": "true",
          "manufacturerName": "Test Manufacturer Name",
          "manufacturerPartNumber": "Test Manufacturer Part Number",
          "thumbnailImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg",
          "productImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/detail/classIBox.jpg",
          "keywords": "testKeyword",
          "customAttributes": {
            "attribute": [
              {
                "name": "name",
                "value": "string",
                "type": "string"
              }
            ]
          }
        },
        "pricing": {
          "listPrice": {
            "currency": "USD",
            "value": 101
          },
          "listPriceWithQuantity": {
            "currency": "USD",
            "value": 1010
          },
          "salePriceWithQuantity": {
            "currency": "USD",
            "value": 959.5
          },
          "formattedListPrice": "101.00USD",
          "formattedListPriceWithQuantity": "1010.00USD",
          "formattedSalePriceWithQuantity": "959.50USD",
          "formattedCommitmentPrice": "$240.00",
          "commitmentPrice": {
            "currency": "USD",
            "value": "240.00"
          },
          "productTax": {
            "currency": "USD",
            "value": "1.35"
          },
          "shippingTax": {
            "currency": "USD",
            "value": "0.65"
          },
          "feeTax": {
            "currency": "USD",
            "value": "2.00"
          },
          "taxRate": "0.1111",
          "importTax": {
            "currency": "USD",
            "value": 0
          },
          "formattedImportTax": "0.00USD",
          "importDuty": {
            "currency": "USD",
            "value": 0
          },
          "formattedImportDuty": "0.00USD"
        }
      }
    ]
  },
  "totalItemsInCart": "1",
  "businessEntityCode": "DR_INC-ENTITY",
  "billingAddress": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/billing-address"
  },
  "shippingAddress": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address"
  },
  "paymentMethod": {
    "type": "creditCard",
    "sourceId": "a231f38d-3a07-4a13-96ed-89693ba7d56c",
    "sourceClientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
    "creditCard": {
      "expirationYear": "2030",
      "lastFourDigits": "0000",
      "clientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
      "expirationMonth": "08",
      "fundingSource": "debit",
      "brand": "Visa",
      "reusable": "true"
    },
    "amountContributed": {
      "currency": "USD",
      "value": 1059.5
    },
    "charges": [
      {
        "chargeId": "1cac37c0-98a7-46b2-b9ed-fbc615c9f18a",
        "amount": {
          "currency": "USD",
          "value": 1059.5
        },
        "status": "failed",
        "createdTime": "2021-12-06T09:03:46.877Z",
        "updatedTime": "2021-12-06T09:03:46.877Z"
      }
    ],
    "supplementaryPaymentMethods": [
      {
        "type": "customerCredit",
        "sourceId": "a231f38d-3a07-4a13-96ed-89693ba7d56c",
        "sourceClientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
        "customerCredit": {
          "flow": "standard",
          "reusable": "true"
        },
        "charges": [
          {
            "chargeId": "cf57f9c9-8b0d-4e64-998a-816499fefa01",
            "amount": {
              "currency": "USD",
              "value": 1059.5
            },
            "status": "failed",
            "createdTime": "2021-12-06T09:03:46.877Z",
            "updatedTime": "2021-12-06T09:03:46.877Z"
          }
        ],
        "amountContributed": {
          "currency": "USD",
          "value": 1059.5
        }
      }
    ]
  },
  "payment": {
    "name": "Discover",
    "displayableNumber": "************4321",
    "expirationMonth": 0,
    "expirationYear": 2030
  },
  "paymentSession": {
    "id": "string",
    "status": "string",
    "clientSecret": "string",
    "redirectUrl": "https://api.digitalriver.com:80/payments/redirects/12759bb0-xxxx-4bdb-bfeb-9095ba8059fc?apiKey=a88fxxxx1eef47eb95bc609c22e593c8",
    "amountContributed": {
      "currency": "USD",
      "value": 1059.5
    },
    "amountRemainingToBeContributed": {
      "currency": "USD",
      "value": 1059.5
    }
  },
  "shippingOptions": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-options"
  },
  "taxInclusive": true,
  "landedCostState": "NOT_ELIGIBLE",
  "pricing": {
    "subtotal": {
      "currency": "USD",
      "value": 1059.5
    },
    "discount": {
      "currency": "USD",
      "value": 0
    },
    "shippingAndHandling": {
      "currency": "USD",
      "value": 11.47
    },
    "importTaxAndDuty": {
      "currency": "USD",
      "value": 0
    },
    "tax": {
      "currency": "USD",
      "value": 178.49
    },
    "orderTotal": {
      "currency": "USD",
      "value": 1070.97
    },
    "formattedSubtotal": "1,059.50GBP",
    "formattedDiscount": "0.00USB",
    "formattedShippingAndHandling": "11.47USD",
    "formattedImportTaxAndDuty": "0.00USD",
    "formattedTax": "178.49USD",
    "formattedOrderTotal": "1,070.97USD"
  },
  "termsOfSalesAcceptance": "true",
  "chargeType": "moto",
  "customerType": "B",
  "taxRegistrations": [
    {
      "key": "UK_VAT",
      "value": "GB698588737"
    }
  ],
  "organizationId": "digitalriver12345"
}
```

{% endtab %}
{% endtabs %}

A successful `POST` request will return a `200 OK` response indicating that the billing address was successfully applied to the cart. See the [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/shipping-address#v1-shoppers-me-carts-active-apply-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`](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/carts#v1-shoppers-me-carts-active-1) 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.

{% tabs %}
{% tab title="cURL" %}

```http
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"
  }
}'
```

{% endtab %}

{% tab title="200 OK response" %}

```json
{
  "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active",
  "paymentMethods": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/payment-methods"
  },
  "applyPaymentMethod": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/apply-payment-method"
  },
  "submitCart": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/submit-cart"
  },
  "webCheckout": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/web-checkout"
  },
  "id": "47278010023",
  "lineItems": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items",
    "lineItem": [
      {
        "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/line-items/488822300023",
        "id": "488822300023",
        "quantity": "1",
        "product": {
          "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500",
          "parentProduct": {
            "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64358200"
          },
          "id": "64578500",
          "name": "Class I",
          "displayName": "Class I",
          "shortDescription": "Class I is the perfect GPS waypoint and route manager for the beginning or occasional GPS user.",
          "longDescription": "Class I is the fast and easy way to create, edit, and transfer waypoints and routes between your computer and your Garmin, Magellan, or Lowrance GPS. Using Class I, you can manage all of your waypoints and routes, and display them in lists sorted by name, elevation, or distance. Class I connects your GPS to the best mapping and information sites on the Internet, giving you one-click access to street and topo maps, aerial photos, weather forecasts, and nearby attractions.",
          "productType": "DOWNLOAD",
          "sku": "Class I",
          "externalReferenceId": "Test External Reference Number",
          "companyId": "demosft1",
          "displayableProduct": "true",
          "purchasable": "true",
          "manufacturerName": "Test Manufacturer Name",
          "manufacturerPartNumber": "Test Manufacturer Part Number",
          "thumbnailImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg",
          "productImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/detail/classIBox.jpg",
          "keywords": "testKeyword",
          "customAttributes": {
            "attribute": [
              {
                "name": "name",
                "value": "string",
                "type": "string"
              }
            ]
          }
        },
        "pricing": {
          "listPrice": {
            "currency": "USD",
            "value": 101
          },
          "listPriceWithQuantity": {
            "currency": "USD",
            "value": 1010
          },
          "salePriceWithQuantity": {
            "currency": "USD",
            "value": 959.5
          },
          "formattedListPrice": "101.00USD",
          "formattedListPriceWithQuantity": "1010.00USD",
          "formattedSalePriceWithQuantity": "959.50USD",
          "formattedCommitmentPrice": "$240.00",
          "commitmentPrice": {
            "currency": "USD",
            "value": "240.00"
          },
          "productTax": {
            "currency": "USD",
            "value": "1.35"
          },
          "shippingTax": {
            "currency": "USD",
            "value": "0.65"
          },
          "feeTax": {
            "currency": "USD",
            "value": "2.00"
          },
          "taxRate": "0.1111",
          "importTax": {
            "currency": "USD",
            "value": 0
          },
          "formattedImportTax": "0.00USD",
          "importDuty": {
            "currency": "USD",
            "value": 0
          },
          "formattedImportDuty": "0.00USD"
        },
        "components": {
          "lineItem": [
            {
              "id": "488822390023",
              "quantity": "1",
              "product": {
                "uri": "https://api.digitalriver.com/v1/shoppers/me/products/64578500",
                "displayName": "Combination product - Component-1",
                "thumbnailImage": "https://drh-int-ora.img.digitalriver.com/Storefront/Company/demosft1/images/product/thumbnail/classIThumb.jpg"
              },
              "pricing": {
                "listPrice": {
                  "currency": "USD",
                  "value": 101
                },
                "listPriceWithQuantity": {
                  "currency": "USD",
                  "value": 1010
                },
                "salePrice": {
                  "currency": "USD",
                  "value": 95.95
                },
                "salePriceWithQuantity": {
                  "currency": "USD",
                  "value": 959.5
                },
                "formattedListPrice": "101.00USD",
                "formattedListPriceWithQuantity": "1010.00USD",
                "formattedSalePrice": "95.95USD",
                "formattedSalePriceWithQuantity": "959.50USD",
                "totalDiscountWithQuantity": {
                  "currency": "USD",
                  "value": 50.5
                },
                "formattedTotalDiscountWithQuantity": "50.50USD",
                "formattedCommitmentPrice": "$240.00",
                "commitmentPrice": {
                  "currency": "USD",
                  "value": "240.00"
                },
                "productTax": {
                  "currency": "USD",
                  "value": "158.33"
                },
                "shippingTax": {
                  "currency": "USD",
                  "value": "1.91"
                },
                "feeTax": {
                  "currency": "USD",
                  "value": "18.25"
                },
                "taxRate": "0.1111",
                "discountDescription": "$10.00",
                "importTax": {
                  "currency": "USD",
                  "value": 0
                },
                "formattedImportTax": "0.00USD",
                "importDuty": {
                  "currency": "USD",
                  "value": 0
                },
                "formattedImportDuty": "0.00USD",
                "feePricing": {
                  "fee": [
                    null
                  ]
                }
              }
            }
          ]
        },
        "groups": [
          {
            "group": [
              {
                "id": "100100100",
                "relationType": "child",
                "offer": {
                  "uri": "https://api.digitalriver.com/v1/shoppers/me/offers/63018095810"
                }
              }
            ]
          }
        ]
      }
    ]
  },
  "totalItemsInCart": "1",
  "businessEntityCode": "DR_INC-ENTITY",
  "billingAddress": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/billing-address"
  },
  "shippingAddress": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-address"
  },
  "paymentMethod": {
    "type": "creditCard",
    "sourceId": "a231f38d-3a07-4a13-96ed-89693ba7d56c",
    "sourceClientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
    "creditCard": {
      "expirationYear": "2030",
      "lastFourDigits": "0000",
      "clientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
      "expirationMonth": "08",
      "fundingSource": "debit",
      "brand": "Visa",
      "reusable": "true"
    },
    "amountContributed": {
      "currency": "USD",
      "value": 1059.5
    },
    "charges": [
      {
        "chargeId": "1cac37c0-98a7-46b2-b9ed-fbc615c9f18a",
        "amount": {
          "currency": "USD",
          "value": 1059.5
        },
        "status": "failed",
        "createdTime": "2021-12-06T09:03:46.877Z",
        "updatedTime": "2021-12-06T09:03:46.877Z"
      }
    ],
    "supplementaryPaymentMethods": [
      {
        "type": "customerCredit",
        "sourceId": "a231f38d-3a07-4a13-96ed-89693ba7d56c",
        "sourceClientSecret": "a231f38d-3a07-4a13-96ed-89693ba7d56c_f6d8c951-59c9-4ef3-ac45-9f33c77d2f46",
        "customerCredit": {
          "flow": "standard",
          "reusable": "true"
        },
        "charges": [
          {
            "chargeId": "cf57f9c9-8b0d-4e64-998a-816499fefa01",
            "amount": {
              "currency": "USD",
              "value": 1059.5
            },
            "status": "failed",
            "createdTime": "2021-12-06T09:03:46.877Z",
            "updatedTime": "2021-12-06T09:03:46.877Z"
          }
        ],
        "amountContributed": {
          "currency": "USD",
          "value": 1059.5
        }
      }
    ]
  },
  "payment": {
    "name": "Discover",
    "displayableNumber": "************4321",
    "expirationMonth": 0,
    "expirationYear": 2030
  },
  "paymentSession": {
    "id": "string",
    "status": "string",
    "clientSecret": "string",
    "redirectUrl": "https://api.digitalriver.com:80/payments/redirects/12759bb0-xxxx-4bdb-bfeb-9095ba8059fc?apiKey=a88fxxxx1eef47eb95bc609c22e593c8",
    "amountContributed": {
      "currency": "USD",
      "value": 1059.5
    },
    "amountRemainingToBeContributed": {
      "currency": "USD",
      "value": 1059.5
    }
  },
  "shippingOptions": {
    "uri": "https://api.digitalriver.com/v1/shoppers/me/carts/active/shipping-options"
  },
  "taxInclusive": true,
  "landedCostState": "NOT_ELIGIBLE",
  "pricing": {
    "subtotal": {
      "currency": "USD",
      "value": 1059.5
    },
    "discount": {
      "currency": "USD",
      "value": 0
    },
    "shippingAndHandling": {
      "currency": "USD",
      "value": 11.47
    },
    "importTaxAndDuty": {
      "currency": "USD",
      "value": 0
    },
    "tax": {
      "currency": "USD",
      "value": 178.49
    },
    "orderTotal": {
      "currency": "USD",
      "value": 1070.97
    },
    "formattedSubtotal": "1,059.50GBP",
    "formattedDiscount": "0.00USB",
    "formattedShippingAndHandling": "11.47USD",
    "formattedImportTaxAndDuty": "0.00USD",
    "formattedTax": "178.49USD",
    "formattedOrderTotal": "1,070.97USD"
  },
  "termsOfSalesAcceptance": "true",
  "chargeType": "moto",
  "customerType": "B",
  "taxRegistrations": [
    {
      "key": "UK_VAT",
      "value": "GB698588737"
    }
  ],
  "organizationId": "digitalriver12345",
  "warnings": {
    "errors": {
      "warning": [
        {
          "code": "couponcode_not_eligible",
          "description": "The relevant discount triggered by {coupon code} will be applied to the cart once it meets the offer criteria..."
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

You will get a `200 Successful` response. See the [query parameters](https://app.gitbook.com/s/X2fWaY1Kp5sXA1fmOL7z/cart/carts#v1-shoppers-me-carts-active-1) for more information.
