A payment gateway authorizes and processes payments by acting as an intermediary between the merchant's website and the financial institutions involved. It ensures secure and efficient transfer of payment information and funds, enabling merchants to accept payments online.