You pay separately for the iPhone (and since you said you're new to AT&T yours will be around $199 or $299 which depends on the capacity)
Then your upcoming AT&T bill will come in separate and will show all the plan rates plus some charges for new customers (and prorated charges plus more)
So yes you could use a credit card to pay or the iPhone 3G, then when the AT&T bill comes you can pay it via this
website. Of course you need to register for their OLAM