I am trying to create ecommerce website which includes payment gateway. My ecommerce site is coded in PHP.

Any clue how to incorporate payment gateway with my ecommerce site?

Also, is there any extra fee for that ?

Whatever system you use to process payment (either a payment gateway directly, or a service like paypal) will likely have a copy/paste or include PHP script for simple transactions that you call (like a function, or doing a cURL call to), or a more robust API that you can make your own code for, as long as you follow their standards.

Yes, there is likely a fee. Most will charge a monthly or annual fee, as well as a % of transaction fee (usually between 1 and 3%).

what about credit card? Does it charge any?

A payment gateway is for credit cards and debit card.