I would work through it step by step and ask specific questions here when you get stuck.
The steps would be something like:
1) Allow customers to purchase gift cards and add them to a shopping cart
2) Save gift card purchases to the database after checkout so they can be retrieved later
3) Display a gift card balance for purchased gift cards
4) Allow users to apply gift card balances to shopping carts
5) Reduce the "amount" available in gift cards when they are used
This is going to be rough for you to pull off on your own, but it is possible. I think #5 is probably the most difficult step, but don't get too caught up in worrying about the next step. Do each step and work through your issues and whittle away at the problem and eventually it will be done.