Is there any api for to get transaction fees of the NFTs when buy or sold and does the transaction fees includes Royalty fees ?
There are several ways to get transaction information. The most known API provider is probably blockfrost.io, but there are others like tangocrypto.com, or api.koios.rest.
You'll need to know the transaction hash and will be able to query information like the spent transaction fee.
The transaction fee applies for using the network and is enforced on protocol level. The concept of royalties does not exist in the protocol. Hence, they are not part of the transaction fee.
DApps/marketplaces need to make sure to handle royalties themselves. You might be interested in reading the CIP 27 (Cardano Improvement Proposal) describing a community standard for royalties.
I'd suggest you check out this resource as it includes a lot of great information and links to start with: https://developers.cardano.org/docs/get-started