amazon-ynab-sync icon indicating copy to clipboard operation
amazon-ynab-sync copied to clipboard

How to handle multiple Amazon accounts?

Open otherjoel opened this issue 3 years ago • 1 comments

My spouse and I have separate Amazon accounts, but all purchases for both accounts are charged to the same credit card account.

It looks like in order to use this tool I would need to run it twice, once for my Amazon account and once for hers. Are there any gotchas I should look out for?

otherjoel avatar May 12 '21 16:05 otherjoel

In case anyone comes across this issue:

I use this tool with two Amazon accounts by setting different ---cache-dir values for each Amazon account.

Additionally, I choose to use two YNAB accounts for easier review and decreased chance of dropping duplicate transactions (which could otherwise occur if both Amazon accounts order the same product on the same day).

Following here is a basic shell script (Bash) that I use, with no external configuration file

note: You may need to change the --cache-dir value depending on how you have the utility installed. (I have amazon-ynab-sync installed locally via NPM)

runSync(){
  local accountNameBase="Amazon Sync"
  local ynabAccessToken="__________"
  local ynabBudgetName="Main Budget"
  npx amazon-ynab-sync \
    --cache-dir "./cache/${user}" \
    --ynab-access-token "${ynabAccessToken}" \
    --ynab-budget-name "${ynabBudgetName}" \
    --ynab-account-name "${accountNameBase} ${accountNameLetter}" \
    --amazon-username $user \
    --amazon-password  $pass \
    ${cliOptions} \
    ; 
}

# cliOptions="--log-level silly --debug-mode"

user="[email protected]"
pass="XXXXXXXX"
accountNameLetter="A"
runSync

user="[email protected]"
pass="YYYYYYYY"
accountNameLetter="B"
runSync

For the passwords, I recommend following the instructions provided in the README: https://github.com/starsprung/amazon-ynab-sync#providing-login-credentials-non-interactively

If you are using LastPass and have multiple entries under 'amazon.com': You can either rename them, or use $( lpass show --password <UNIQUEID> ) which specifies a UNIQUEID (see man lpass) which can be found using lpass show amazon.com and repeated lpass show --username <id> )

vjjft avatar May 20 '22 18:05 vjjft