Another ID was used to download a game and now I want to do an in-app purchase with my ID
This has already been answered and unfortunately you'll have to delete and reinstall, but you can backup the settings first and most likely maintain your game state:

How can I make in-app purchases with a different Apple ID than the app was purchased with?