There are two conceptual mechanisms which can be used for handling of convenience fees. They are as follows.
If merchant funding is performed by the system that processes the transaction (by payment service provider, or processor) then convenience fees can be withheld at the time of funding. In this case primary payment and convenience fee are processed as a single transaction.
If merchant funding is performed by some third-party system (and not by the system that processes transactions) then convenience fees are charged at the time of processing. In this case a convenience fee is processed as a separate transaction.
Depending on the mechanism you choose for handling of convenience fees in your payment system, you need to address particular questions, related to the process.
More detailed information on various aspects of convenience fee handling is available in the respective article on #Paylosophy.