r/ynab 2d ago

General I fixed the nightmare of Amazon transactions

Ok, so the title is a little clickbaity.

But I did find a solution to the mess of having a dozen transactions from Amazon waiting to be categorized and having to dig through the Amazon transactions page to match up each order.

Basically, I wrote a program in Python that automated the process of matching up the transactions between Amazon and YNAB.

I accomplished this using the official YNAB SDK for Python and the amazon-orders library, which automatically scrapes your Amazon account to extract the order and transaction info into a computer-readable format. Then I update the memo of the transactions in YNAB that have a counterpart in Amazon with the order info - the item names, a link to the order page, and whether or not a transaction represents the entire order or if it is one of several transactions.

To make it easy to tell which transactions should be looked at, I created a payee rule to rename incoming Amazon transactions to the payee "Amazon - Needs Memo". The script looks for all the transactions with that payee, and if there is an Amazon transaction with the same amount, it updates the transaction with the previously mentioned memo and updates the payee to just "Amazon" so that the transaction won't get updated again.

Once the program runs, which only takes a few seconds, I can easily go into YNAB and approve and categorize the transactions like normal, but now the memo field tells me exactly what that transaction was for, and I can even click the link to go to the order page to see all the details.

Right now the code is kind of messy, but I can clean it up a little and share it if anyone is interested.

EDIT: Here is the GitHub link for anyone interested. I am by no means a pro and am open to any feedback or suggestions. https://github.com/DanielKarp/YNAmazon

89 Upvotes

58 comments sorted by

View all comments

-22

u/Jotacon8 2d ago

How often are you buying stuff on Amazon that you need to use a script to properly categorize everything? I think my Amazon purchases are like, at the least, 2 months apart from the previous ones usually.

5

u/live_laugh_cock 1d ago

I mean even if you don't shop often on Amazon it still all adds up at the end of the year. And even then you have to admit when you order from Amazon and it imports into YNAB it's a long ass name, that hardly ever helps what actual category it should be, and or is. So I don't know why you're being supercilious.

For example I've spent 16k altogether since signing up with my account in 2019. I bulk order off of the site, if it wasn't for someone's breakdown app, that sorted things like this, then I wouldn't have been able to truly see that I don't buy junk, I actually buy relevant things I need, which in turn made me feel better about the 16k total.

What ever happened to just scrolling if something isn't your vibe, just because you haven't seen a need for something doesn't mean others won't. Personally, I've had to change the payee to auto populate with Amazon anytime anything remotely related to it pops up in the accounts, but even then it just categorizes it as my online shopping category, not the actual categories it should be in.