As the Indonesian regulations are frequently changing, we advise you, a couple of month before your trip, to check the latest updates at your embassy or consulate.
Depending on your country and the length of your stay there will be different regulations and fees.
For more information on short stay visas (max 2 months) you can check:
http://www.bali.com/visa-indonesia-entry-requirements-bali.html
http://www.balitourismboard.org/immigration.html
http://www.baliguide.com/bali-info/visa_regulations.html
For longer stays, you will have to contact an agent once in Bali and will have to go out of the country to validate your new visa.
http://www.indonesiavisa.bali-hands.com/
Please note:
You will need a passport valid for a minimum of 6 month after your departure date and you’ll need to have one free page on your passport for the Visa sticker or stamp.