TechStud’s Costco Receipt Downloader (TCRD)

TCRD is a client-side JavaScript utility designed to extract and archive your Costco in-warehouse receipts, saving the raw data in a standardized JSON format.
Running directly in your web browser, it will fetch up to 3 years of data-rich receipt history for the logged in Costco member and then intelligently export the history to a new JSON format file or merge any new receipt data with your existing archives (if you select an existing Costco Receipt file), ensuring a clean, duplicate-free record.
🌟 Features
- 📅 Historical Data: Fetches the maximum allowed history (rolling 3 years) from your Costco account.
- 🧠 Smart Merging: Capable of reading your previous download file and only fetching/adding new receipts.
- 👨👩👧👦 Multi-Member Support: Have a spouse or family member on a separate login? You can merge their receipts into your main file to create a single household archive.
- 💾 Data-Rich Export: Saves detailed transaction data (Items, Prices, Locations, Member IDs) in structured JSON format.
- 🛡️ Duplicate Protection: Automatically detects and removes duplicate entries based on Transaction Barcodes.
- 🔒 Privacy Focused: Runs entirely in your browser. No data is sent to the author or any third-party servers.
🚀 How to Use (Step-by-Step)
Prerequisites
- A desktop computer (Windows, Mac, or Linux).
- A modern web browser (Google Chrome, Microsoft Edge, Brave, etc.).
- An active Costco.com (or regional equivalent) account.
Instructions
1. Log In to your Costco Account
2. Navigate to Orders & Returns -> In-Warehouse
- Click on Orders & Returns in the top menu, then select the tab labeled In-Warehouse.
- Note: You must be on this specific page for the script to work.
3. Open the Developer Console
- This is the “Matrix” view of your browser. Don’t worry, it’s safe!
- Windows/Linux: Press
F12 or Ctrl + Shift + I
- Mac: Press
Cmd + Option + I
- Then, click on the tab at the top labeled “Console”.
4. Run the Script
5. Choose Your Action
📂 File Output & Naming
The script automatically generates filenames based on the data found:
- Single Account:
Costco_In-Warehouse_Receipts_123456789.json (Includes Member ID)
- Multiple Accounts:
Costco_In-Warehouse_Receipts_2-Members.json (If you merged data from two different cards).
Note on Saving:
- We try to active the Save As window, allowing you chose where to save the file, (or to overwrite your old existing file if you choose). If it doesn’t activate, the file will automatically download to your default downloads folder.
- 💡 TIP: All major browsers offer a setting to Ask where to save each file before downloading allowing you to choose the destination for every download instead of it automatically going to a default downloads folder.
Google Chrome: Settings > Downloads > Toggle Ask where to save each file before downloading.
Microsoft Edge: Settings > Downloads > Toggle Ask me what to do with each download or find the Location section to change settings.
Mozilla Firefox: Settings (General tab) > Downloads > Select Always ask you where to save files.
Safari (Mac): Safari > Settings > General > File download location > Select Ask for each download or choose a specific folder.
📸 Screenshots

- Click ‘Orders & Returns’ and then click ‘Warehouse’
- Open Developer Tools (F12 or Cmd/Ctrl + Shift + I) and click the ‘Console’ tab

- Paste in the entire TCRD script into the Browser Console and press Enter (or press Run)
-
Click one of the two on-screen buttons (lower-right corner of the webpage):
- ↳ If this is your first run, click the
Start Fresh (No File) button.
- ↳ If you’re re-running this script, click the
Load Existing Receipt File button.
- ↳ From here you can select your existing Costco Receipt file (eg:
Costco_In-Warehouse_Receipts_123456789.json)

* Console logging showing the output after clicking the **`Start Fresh (No File)`** button press

- Console logging showing the output after clicking the
Load Existing Receipt File button and selecting a JSON file with previous receipts.
⚠️ Privacy & Liability Disclaimer
- Sensitive Data: The downloaded JSON file contains your shopping history, partial payment information, and membership numbers. Keep this file secure. Do not share it publicly.
- Terms of Use: This script is an unofficial tool for personal archiving. It is not endorsed by Costco Wholesale Corporation.
-
Liability: The author (TechStud) is not responsible for any data discrepancies, missed receipts, or account limitations imposed by Costco. Use at your own risk.
🤓 For Advanced Users
The Merging Logic
The script uses a composite key of MembershipNumber + TransactionBarcode to identify unique receipts.
- Ingest: Loads the JSON provided by the user.
- Fetch: Scrapes the API for the last 3 years of data.
- Merge: Combines arrays.
- Dedupe: Iterates through the merged list. If a conflict is found, it prioritizes the existing local data (assuming you may have manually edited it), though usually, the data is identical.
JSON Structure
Reviewing the data, it appears;
Receipts Are Ledger Documents
- Item entries are ledger lines, not products
- A single purchase may span multiple lines
Multiple Economic Roles
- Item lines may represent: Products, Coupons, Environmental fees, Refund adjustments, etc.
- Roles are not explicitly typed.
Coupons Exist in Parallel Forms
- As item ledger lines
- As entries in couponArray
- Neither is canonical alone.
Item Numbers Are Contextual
- Item numbers identify ledger lines
- They do not represent stable product concepts
Quantity & Price Are Non‑Semantic
- Units may be negative or abstract
- Unit price may not match extended amounts
Refunds Are First‑Class Transactions
- Refunds are independent receipts
- They may include positive coupon lines
Below is an example of a single Sales Receipt (Refund Receipts have a similar layout):
Click to expand...
```json
[
{
"documentType": "WarehouseReceiptDetail",
"receiptType": "In-Warehouse",
"membershipNumber": "123456789012",
"transactionType": "Sales",
"transactionDateTime": "2023-10-25T14:30:00",
"transactionDate": "2023-10-25",
"warehouseShortName": "SEATTLE",
"warehouseNumber": 1,
"warehouseName": "SEATTLE",
"warehouseAddress1": "4401 4TH AVE S",
"warehouseAddress2": null,
"warehouseCity": "SEATTLE",
"warehouseState": "WA",
"warehouseCountry": "US",
"warehousePostalCode": "98134-2311",
"companyNumber": 4,
"transactionBarcode": "21000100602972310251430",
"totalItemCount": 10,
"instantSavings": 21,
"subTotal": 101.66,
"taxes": 3.77,
"total": 105.43,
"registerNumber": 6,
"transactionNumber": 297,
"operatorNumber": 601,
"itemArray": [
{
"itemNumber": "17120",
"itemUPCNumber": 0,
"itemDescription01": "GYRO KIT",
"itemDescription02": "GREEK STYLE",
"frenchItemDescription1": "PITA GYRO",
"frenchItemDescription2": "À LA GRECQUE",
"itemIdentifier": null,
"itemDepartmentNumber": 63,
"transDepartmentNumber": 63,
"itemUnitPriceAmount": 13.49,
"unit": 1,
"amount": 21.75,
"taxFlag": "N",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1715281",
"itemUPCNumber": 0,
"itemDescription01": "TPD/17120",
"itemDescription02": null,
"frenchItemDescription1": "PITA GYRO",
"frenchItemDescription2": null,
"itemIdentifier": null,
"itemDepartmentNumber": 63,
"transDepartmentNumber": 63,
"itemUnitPriceAmount": 0,
"unit": -1,
"amount": -3,
"taxFlag": null,
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": null,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1661969",
"itemUPCNumber": 0,
"itemDescription01": "BULGOGI BOWL",
"itemDescription02": null,
"frenchItemDescription1": "BOEUF BULGOGI 6X229G P99",
"frenchItemDescription2": null,
"itemIdentifier": null,
"itemDepartmentNumber": 13,
"transDepartmentNumber": 13,
"itemUnitPriceAmount": 16.99,
"unit": 1,
"amount": 16.99,
"taxFlag": "N",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1715228",
"itemUPCNumber": 0,
"itemDescription01": "TPD/1661969",
"itemDescription02": null,
"frenchItemDescription1": "BOEUF BULGOGI 6X229G P99",
"frenchItemDescription2": null,
"itemIdentifier": null,
"itemDepartmentNumber": 13,
"transDepartmentNumber": 13,
"itemUnitPriceAmount": 0,
"unit": -1,
"amount": -4,
"taxFlag": null,
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": null,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1363537",
"itemUPCNumber": 0,
"itemDescription01": "CREPES",
"itemDescription02": "20 COUNT P400 ECSL45",
"frenchItemDescription1": "LA BOULANGERE CREPES 640G",
"frenchItemDescription2": "COMPTE DE 20 P400 ECSL45",
"itemIdentifier": null,
"itemDepartmentNumber": 13,
"transDepartmentNumber": 13,
"itemUnitPriceAmount": 11.99,
"unit": 1,
"amount": 11.99,
"taxFlag": "N",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1716231",
"itemUPCNumber": 0,
"itemDescription01": "TPD/1363537",
"itemDescription02": null,
"frenchItemDescription1": "LA BOULANGERE CREPES 640G",
"frenchItemDescription2": null,
"itemIdentifier": null,
"itemDepartmentNumber": 13,
"transDepartmentNumber": 13,
"itemUnitPriceAmount": 0,
"unit": -1,
"amount": -3,
"taxFlag": null,
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": null,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1667742",
"itemUPCNumber": 0,
"itemDescription01": "RUFFLES KFC",
"itemDescription02": "525G P126",
"frenchItemDescription1": "RUFFLES CHIPS SAVEUR PFK",
"frenchItemDescription2": "525G P126",
"itemIdentifier": null,
"itemDepartmentNumber": 12,
"transDepartmentNumber": 12,
"itemUnitPriceAmount": 5.99,
"unit": 1,
"amount": 5.99,
"taxFlag": "Y",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1696237",
"itemUPCNumber": 0,
"itemDescription01": "RUFFLES REG",
"itemDescription02": "612 G P96",
"frenchItemDescription1": "RUFFLES NATURE",
"frenchItemDescription2": "612 G P96",
"itemIdentifier": null,
"itemDepartmentNumber": 12,
"transDepartmentNumber": 12,
"itemUnitPriceAmount": 5.99,
"unit": 1,
"amount": 5.99,
"taxFlag": "Y",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1448167",
"itemUPCNumber": 0,
"itemDescription01": "PUFF PASTRY",
"itemDescription02": "6T3H 216P 792G",
"frenchItemDescription1": "BOUCHES FEUILLETTEES",
"frenchItemDescription2": "6T3H 216P 792G",
"itemIdentifier": null,
"itemDepartmentNumber": 18,
"transDepartmentNumber": 18,
"itemUnitPriceAmount": 11.99,
"unit": 1,
"amount": 11.99,
"taxFlag": "N",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1714123",
"itemUPCNumber": 0,
"itemDescription01": "TPD/1448167",
"itemDescription02": null,
"frenchItemDescription1": "BOUCHES FEUILLETTEES",
"frenchItemDescription2": null,
"itemIdentifier": null,
"itemDepartmentNumber": 18,
"transDepartmentNumber": 18,
"itemUnitPriceAmount": 0,
"unit": -1,
"amount": -3,
"taxFlag": null,
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": null,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1076115",
"itemUPCNumber": 0,
"itemDescription01": "MINI BELLAS",
"itemDescription02": "680G / 1.5 LB",
"frenchItemDescription1": "CHAMPIGNONS MINI BELLA",
"frenchItemDescription2": "PRODUIT DU CANADA",
"itemIdentifier": null,
"itemDepartmentNumber": 65,
"transDepartmentNumber": 65,
"itemUnitPriceAmount": 5.99,
"unit": 1,
"amount": 5.99,
"taxFlag": "N",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "380444",
"itemUPCNumber": 0,
"itemDescription01": "SWIFFER DRY",
"itemDescription02": "T56H3 80207786 P168",
"frenchItemDescription1": "SWIFFER LINGES JETABLES",
"frenchItemDescription2": "80 PK P168",
"itemIdentifier": null,
"itemDepartmentNumber": 14,
"transDepartmentNumber": 14,
"itemUnitPriceAmount": 21.99,
"unit": 1,
"amount": 21.99,
"taxFlag": "Y",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1713164",
"itemUPCNumber": 0,
"itemDescription01": "TPD/SWIFFER",
"itemDescription02": null,
"frenchItemDescription1": "SWIFFER LINGES JETABLES",
"frenchItemDescription2": null,
"itemIdentifier": null,
"itemDepartmentNumber": 14,
"transDepartmentNumber": 14,
"itemUnitPriceAmount": 0,
"unit": -1,
"amount": -5,
"taxFlag": null,
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": null,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "357576",
"itemUPCNumber": 0,
"itemDescription01": "APPLE CIDER",
"itemDescription02": "ECSL35",
"frenchItemDescription1": "JUS DE POMME 3L C6",
"frenchItemDescription2": "ECSL35",
"itemIdentifier": null,
"itemDepartmentNumber": 17,
"transDepartmentNumber": 17,
"itemUnitPriceAmount": 4.99,
"unit": 1,
"amount": 4.99,
"taxFlag": "N",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1621817",
"itemUPCNumber": 0,
"itemDescription01": "GARDEN SOUP",
"itemDescription02": "SOUP 6X400ML P220",
"frenchItemDescription1": "ALLEN SUPER GARDENHARVEST",
"frenchItemDescription2": "SOUP 6X400ML P220",
"itemIdentifier": null,
"itemDepartmentNumber": 13,
"transDepartmentNumber": 13,
"itemUnitPriceAmount": 14.99,
"unit": 1,
"amount": 14.99,
"taxFlag": "N",
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": 10,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
},
{
"itemNumber": "1712143",
"itemUPCNumber": 0,
"itemDescription01": "TPD/1621817",
"itemDescription02": null,
"frenchItemDescription1": "ALLEN SUPER GARDENHARVEST",
"frenchItemDescription2": null,
"itemIdentifier": null,
"itemDepartmentNumber": 13,
"transDepartmentNumber": 13,
"itemUnitPriceAmount": 0,
"unit": -1,
"amount": -3,
"taxFlag": null,
"refundFlag": null,
"voidFlag": null,
"merchantID": null,
"entryMethod": null,
"fuelUnitQuantity": null,
"fuelUomCode": null,
"fuelUomDescription": null,
"fuelUomDescriptionFr": null,
"fuelGradeCode": null,
"fuelGradeDescription": null,
"fuelGradeDescriptionFr": null
}
],
"couponArray": [
{
"couponNumber": "1715228",
"upcnumberCoupon": "410099692305",
"associatedItemNumber": "0",
"unitCoupon": -1,
"amountCoupon": -4,
"taxflagCoupon": null,
"voidflagCoupon": null,
"refundflagCoupon": null
},
{
"couponNumber": "1714123",
"upcnumberCoupon": "410099695061",
"associatedItemNumber": "0",
"unitCoupon": -1,
"amountCoupon": -3,
"taxflagCoupon": null,
"voidflagCoupon": null,
"refundflagCoupon": null
},
{
"couponNumber": "1713164",
"upcnumberCoupon": "410099699236",
"associatedItemNumber": "0",
"unitCoupon": -1,
"amountCoupon": -5,
"taxflagCoupon": null,
"voidflagCoupon": null,
"refundflagCoupon": null
},
{
"couponNumber": "1716231",
"upcnumberCoupon": "410099689244",
"associatedItemNumber": "0",
"unitCoupon": -1,
"amountCoupon": -3,
"taxflagCoupon": null,
"voidflagCoupon": null,
"refundflagCoupon": null
},
{
"couponNumber": "1715281",
"upcnumberCoupon": "410099692114",
"associatedItemNumber": "0",
"unitCoupon": -1,
"amountCoupon": -3,
"taxflagCoupon": null,
"voidflagCoupon": null,
"refundflagCoupon": null
},
{
"couponNumber": "1712143",
"upcnumberCoupon": "410099702981",
"associatedItemNumber": "0",
"unitCoupon": -1,
"amountCoupon": -3,
"taxflagCoupon": null,
"voidflagCoupon": null,
"refundflagCoupon": null
}
],
"subTaxes": {
"tax1": null,
"tax2": null,
"tax3": null,
"tax4": null,
"aTaxPercent": 13,
"aTaxLegend": "HST",
"aTaxAmount": 3.77,
"aTaxPrintCode": null,
"aTaxPrintCodeFR": null,
"aTaxIdentifierCode": null,
"bTaxPercent": null,
"bTaxLegend": null,
"bTaxAmount": null,
"bTaxPrintCode": null,
"bTaxPrintCodeFR": null,
"bTaxIdentifierCode": null,
"cTaxPercent": null,
"cTaxLegend": null,
"cTaxAmount": null,
"cTaxIdentifierCode": null,
"dTaxPercent": null,
"dTaxLegend": null,
"dTaxAmount": null,
"dTaxPrintCode": null,
"dTaxPrintCodeFR": null,
"dTaxIdentifierCode": null,
"uTaxLegend": "GST/HST",
"uTaxAmount": null,
"uTaxableAmount": null
},
"tenderArray": [
{
"tenderTypeCode": "062",
"tenderSubTypeCode": null,
"tenderTypeName": "Master Card",
"tenderTypeNameFr": null,
"tenderDescription": "Master Card",
"amountTender": 105.43,
"displayAccountNumber": "1234",
"sequenceNumber": null,
"approvalNumber": null,
"responseCode": null,
"transactionID": null,
"merchantID": null,
"entryMethod": null,
"tenderAcctTxnNumber": null,
"tenderAuthorizationCode": null,
"tenderEntryMethodDescription": null,
"walletType": null,
"walletId": null
}
]
}
]
```
## 🤝 Contributing
Found a bug? Want to add new data fields?
- Fork this repository.
- Create a feature branch (git checkout -b feature/AmazingFeature).
- Commit your changes.
- Open a Pull Request.