Skip to content

Instantly share code, notes, and snippets.

View ashkulz's full-sized avatar

Ashish Kulkarni ashkulz

View GitHub Profile
@ashkulz
ashkulz / amazon_pay.py
Created November 8, 2025 11:32
Download transactions from Amazon Pay India
# Works as of Nov 2025
import csv, lxml.etree, requests
# These headers have to match what the browser sends, there's some checksum as otherwise you get a 503:
def get_amazon_pay_chunk(cookie, start, end):
url = f"https://www.amazon.in/pay/history/ajax?requestParams=%7B%22indexParams%22%3A%22%7B%5C%22P3_TH%5C%22%3A%7B%5C%22startKey%5C%22%3A{start}%2C%5C%22lastKey%5C%22%3A{end}%7D%7D%22%2C%22queryFilters%22%3A%7B%22transactionTypes%22%3A%5B%5D%7D%7D"
return requests.get(url, headers={
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:144.0) Gecko/20100101 Firefox/144.0",
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Language": "en-US,en;q=0.5",