API Version: 
Version 1.0 - December 11, 2017

Introduction:

The Walgreens Add to Cart API allows users of third-party applications and websites to quickly add products to a cart on Walgreens.com and then transfer that customer to checkout that cart.
This retail focused Add to Cart API is designed to increase customer interaction inside of your third-party retail shopping experience. By combining this API with our Digital Offers API you can allow customers to clip coupons for, and add products to a cart on walgreens.com to complete their checkout.

Documentation/Services Highlights:

  • First version of the documentation, let us know if we need to add anything!

Technical Information:

  • Request an API Key
  • Sample Product Numbers
  • Sample Application COMING SOON
  • "QA" Observe the badge on the right, this also known as "Staging" or "Test" - use this for testing purposes
  • "PR" Observe the badge on the right, this also known as "Production" of "Prod" - only use this when the application is released publicly

Add To Cart Flow:

The services listed below make up the complete list of services that are required in order to complete all phases of the Add to Cart experience. Please note that all of the service endpoints documented below are brand new for this version of the API.

 

In order to ensure your integration is both future and backwards compatible, please make sure that the integration is only reading the parameters which will display in the app UI and do not impose strict parsing or typecasting logic for any of the API response parameters. We may add new request and response parameters to our APIs in order to offer enhanced functionality and to support multiple products changes in a contiguous way.

Client ID Generation:

Sample code can be provided upon request. This process is different depending on your environment and domain.

Generating the ClientID is a very simple process, it requires 6 simple steps:

  1. Load the SSL certificate file that you will receive from the Walgreens API team
  2. Read the Public Key from the certificate file
  3. Concatenate your clientKey+":"+FIRST_SKUID+":"+ClientCartId
  4. Convert the string from step 3 to UTF-8 bytes
  5. Encrypt the UTF-8 bytes using the X509 public certificate provided by the Walgreens API team using the RSA cipher algorithm
  6. Encode the encrypted UTF-8 bytes using a Base64 encoding.

Create New Cart:

Description: This service is used to add products to cart to obtain the "transferURL" used for finishing the checkout. Request Content-type is application/json. The request should be a HTTPS POST.

 

Property Name Data Type Required Description Max Length
affId String Yes The AffiliateID that you was given in your application email. 10
clientId String Yes The clientID security token for your integration. See above section Explaining clientId Info 500
apiKey String Yes The API Key that you have been approved for. Can be found here. 32
clientCartId String Yes Your own unique ID generated for each cart you create. 40
products [ProductInfo] Yes Array of ProductInfo containing the customer selected products. See below section Explaining ProductInfo 100
 
 

Open Checkout URL:

Description: This service is used to open the "transferURL" used to finish the checkout. Basically open the url in a web browser.

Important:

You will need open the checkout within 15 minutes of creating the cart. Otherwise, you will need to create a new cart.

 

 
 

ProductInfo Object:

Contains the product information for each product that the customer wants to add to the cart:

Property Name Data Type Required Description Max Length
skuId String Yes The unique identifier value for each product. 40
qty String Yes The quantity of the item the customer is attempting to transfer. Example: "1" 3
type String Yes The product type of the product. Example: "DL" 20

Status Codes:

Success and Error Status Codes & Messages for the Add to Cart API:

Status Code Level Description
000 Product Item added to cart with requested quantity
001 Product Item is out of stock
002 Product Quantity adjusted, please compare with requested
003 Product Invalid ProductInfo object
004 Product Item is a store only item, not able to add to online cart
901 Cart Cart transfer successful, all items and requested quantities added to cart
902 Cart Cart transfer partially successful, some items added to cart, not all items
903 Cart Cart transfer failure, no products added to cart
904 Cart Invalid request, please check the JSON formatting

Disclaimer:

Consistent with the Terms of Use, your ability to launch a production integration of an Application is subject to approval by Walgreens.