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.
Below are the technical steps you will need to go through in order to get your integration configured and branded correctly:
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.
Generating the ClientID is a very simple process, it requires 6 simple steps:
This service is used to add products to cart to obtain the "transferURL" used for finishing the checkout.
Sandbox: https://services-qa.walgreens.com/api/cart/addToCart/v1
Production: https://services.walgreens.com/api/cart/addToCart/v1
Request format | JSON |
Response format | JSON |
Authentication? | Yes |
Rate limited? | Yes |
Requests Per Minute | 300 |
Name | Optionality | Description | Example |
---|---|---|---|
affId | required | Your AffiliateID. | "AAAAAAAAAA" |
clientId | required | The clientID security token for your integration. | "AAAAAA" |
apiKey | required | Your API Key. | "AbCdEfGhIjKlMnOpQrStUvWxYz" |
clientCartId | required | Your own unique ID generated for each cart you create. | "ABCDEF" |
products | required | Array of ProductInfo containing the customer selected products.. | [ProductInfo] |
curl --request POST \
--url https://services-qa.walgreens.com/api/cart/addToCart/v1 \
--header 'Content-Type: application/json' \
--data '{ \
"affId":"YOUR_AFFILIATE_ID", \
"apiKey":"YOUR_API_KEY", \
"clientId":"YOUR_GENERATED_CLIENT_ID", \
"clientCartId":"YOUR_GENERATED_CLIENT_CART_ID", \
"products":[ \
{
"skuId":"CUSTOMER_SELECTED_SKU_ID", \
"qty":"CUSTOMER_SELECTED_QUANTITY", \
"type":"SKU_PRODUCT_TYPE" \
},
//Repeated for each customer selection of products
]
}' \
{
"cartTransferReferenceId": "WALGREENS GENERATED CART ID"L",
"clientCartId": "YOUR GENERATED CART ID",
"statusCode": "WALGREENS CART LEVEL STATUS CODE",
"transferURL": "CART TRANSFER LANDING URL"
"items":[
{
"skuId": "CUSTOMER SELECTED SKU ID",
"qtyInCart": "QUANTITY ADDED TO CART",
"statusCode": "PRODUCT ADDED TO CART STATUS CODE"
},
//Repeated for each customer selection of products
]
}
This service is used to open the "transferURL" used for finish checkout.
Sandbox: [transferURL]
Production: [transferURL]
Request format | JSON |
Response format | JSON |
Authentication? | Yes |
Rate limited? | Yes |
Requests Per Minute | 300 |
{
"https://www.walgreens.com/store/checkout/cart_transfer.jsp?cartTransferReferenceId=YOUR_CART_REFRENCE_ID&action=transfer&ClientCode=YOUR_CLIENT_CODE"
}
{
"The walgreens.com checkout page..."
}
Contains the product information for each product that the customer wants to add to the cart:
Name | Optionality | Description | Example |
---|---|---|---|
skuId | required | The unique identifier value for each product. | "ABCDEF" |
qty | required | The quantity of the item the customer is attempting to transfer. | "1" |
type | required | The product type of the product. | "DL" |
Obviously we don't want any errors to happen, but sometimes they do and as a result we respond the following error codes. The table below helps explain why each of the error codes could occur:
Code | Level | Message |
---|---|---|
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 |
905 | Cart | Invalid affId, please verify the affId |
906 | Cart | Invalid clientId, please verify the clientId |