If you'd like to prevent against unauthorized or accidental purchases on your Mac, you can set it up to prompt for your password every time you buy content from the App Store. Click on Apple menu > System Preferences > App Store and then go to Password Settings. Click on the dropdown menu next to Purchases and in-app purchases and select between Always Require and Require After 15 Minutes.
The new setting will apply to both your in-store and in-app purchases.
Mac OS X El Capitan takes things a bit further and enables users to activate password verification for free downloads. To enable this feature, simply click on the dropdown menu next to Free Downloads and select Require Password.