Apply Shipping Option 

Use the Apply Shipping Option API to select the shipping method for a cart from a set of known shipping options. Use the Shipping Options API to retrieve the shipping option. This API is only available to shoppers. Shoppers can only use this API when there is a physical product in a cart.

Methods


					Host: api.digitalriver.com
User-Agent: API Client/1.0
Accept: */*
Authorization: bearer your_access_token
			
					The request body should be empty.
			
					HTTP/1.1 200 OK
			
					<cart uri="https://api.digitalriver.com/v1/shoppers/me/carts/active">
   <id>99999999999</id>
   <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/line-item_ID">
         <id>line-item_ID</id>
         <quantity>1</quantity>
         <product uri="https://api.digitalriver.com/v1/shoppers/me/products/product_ID">
            <displayName>Displayable Product name</displayName>
            <thumbnailImage>http://drh1.img.digitalriver.com/DRHM/Storefront/images/product/thumbnail/small-product-image.jpg</thumbnailImage>
         </product>
         <pricing>
            <listPrice currency="CAD">59.92</listPrice>
            <listPriceWithQuantity currency="CAD">59.92</listPriceWithQuantity>
            <salePriceWithQuantity currency="CAD">59.92</salePriceWithQuantity>
            <formattedListPrice>$59.92</formattedListPrice>
            <formattedListPriceWithQuantity>$59.92</formattedListPriceWithQuantity>
            <formattedSalePriceWithQuantity>$59.92</formattedSalePriceWithQuantity>
         </pricing>
      </lineItem>
   </lineItems>
   <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"/>
   <payment>
      <name/>
      <displayableNumber/>
      <expirationMonth/>
      <expirationYear/>
   </payment>
   <shippingMethod>
      <code>1234567890</code>
      <description>USPS - Priority Mail</description>
   </shippingMethod>
   <shippingOptions uri="https://api.digitalriver.com/v1/shoppers/me/shipping-options"/>
   <pricing>
      <subtotal currency="CAD">59.92</subtotal>
      <discount currency="CAD">0.00</discount>
      <shippingAndHandling currency="CAD">0.00</shippingAndHandling>
      <tax currency="CAD">4.36</tax>
      <orderTotal currency="CAD">64.28</orderTotal>
      <formattedSubtotal>$59.92</formattedSubtotal>
      <formattedDiscount>$0.00</formattedDiscount>
      <formattedShippingAndHandling>$0.00</formattedShippingAndHandling>
      <formattedTax>$4.36</formattedTax>
      <formattedOrderTotal>$64.28</formattedOrderTotal>
   </pricing>
</cart>
			

Response Body Parameters

Field
Data Type
Visibility
Description
billingAddress
link
default
The billing address for the order. See the Addresses API and Fields Used as Keys for more information.
cart
structured
default
The cart information associated with this apply shipping option. See the Cart API for more information.
id string default The cart ID. The ID is assigned automatically when you create a cart.
lineItems
collection default List the items in a cart. See the Line Items API for more information.
payment
structured
default
The payment information for an order. 
payment.displayableNumber
string
default
The credit card number of the payment that is safe to display to the shopper. 
payment.expirationMonth
string
default
The month when a credit card expires. A numeric value that represents the month. Possible values: 1 = January, .... 12 = December.
payment.expirationYear
string
default
The four-digit year when a credit card expires (for example, 201).
payment.name
string
default
The type of payment to display to the shopper, such as the name of the credit card used (Visa, Mastercard, and so forth).
pricing
structured
default
The pricing information for the cart. See the Pricing API for more information.
pricing.discount
decimal
default
The total discount with tax. 
shippingAddress
link
default
The shipping address for the order. See the Addresses API and Fields Used as Keys for more information.
shippingMethod
structured
default
The shipping method information for the cart.
shippingMethod.code
string
default
The code of the shipping method.
shippingMetthod.description
string
default
The description of the shipping method
shippingOptions
link
default
The shipping options available to apply to a cart. See the Shipping Options API for more information.