Reputation: 855
Does Amazon provide any API to get my cart items and order details, this is for my personal use. I tried searching but found only seller account API's. I'm not a amazon seller, so my question is does amazon provide API for customers? And is consuming seller account API free of cost and does it have end points to get my cart items and orders?
Upvotes: 1
Views: 2373
Reputation: 537
You can make a GET request to https://www.amazon.com/cart
From that page's source, each cart item is contained in a div with a data-asin
attribute. The value of the data-asin
is the ASIN, which is a unique number assigned to every product on Amazon. That div tag also has attributes like data-price
and data-quantity
(which are equal to price and quantity, respectively).
This jQuery code will get all the divs with the data-asin
attribute:
$('div[data-asin]')
Here's some example code that prints the price of each item in the console:
$('div[data-asin]').each(function(){
var price = $(this).attr("data-price");
console.log("Price: $" + price);
});
If you need more information like the title, that's a child of the div. You can get that with a selector or XPath, etc.
Upvotes: 1
Reputation: 319
There's no API to retrieve your personal -customer- shopping cart contents or orders. There isn't any seller/associate API that grants access to carts/orders either.
You could scrape your cart page's HTML to get around it.
Upvotes: 1