I accidentally used my upgrade code from PS3 to PS4 on while logged into someone else's playstation network.

The result means that the code is now worthless. I cannot play on their playstation network (I get an error every time I try to open it because the Square account isn't linked to that playstation network account.) I also cannot redownload it to the correct account because the code is only useable once.

I feel like this would be a fairly common problem as you can have multiple users on one playstation. Has anyone found a solution to this? Thanks.