That is rather complex and the exact steps differ depending on the payment gateway you use.
you would need to have an inventory column to your products table.
then on the page that processes the transaction, you would need to add code to loop through the products that where just purchased to update the inventory.
if you need assistance adding this to your site, i suggest signing up for a Premiere support appointment where we can walk you through this in a one on one screen sharing session.