iPhone batteries are not user replaceable. If your battery stops working while still under warranty, you can bring the iPhone to an Apple Retail Store or to an Apple Authorized Service Provider, and they will take care of replacing the battery (not immediately though, it may require some days). For out of warranty batteries, Apple made available a Battery Replacement Program, which costs $79 + 6.95 shipping.
iPodJuice is selling iPhone batteries directly to the customers, but you must be familiar with soldering to replace it by yourself, since the battery is soldered to the motherboard.