Is there a way to get the total of all the payments sent and received by an account?
If by chance you are running a Stellar Core node with fully-synced Horizon, you can execute aggregation queries on the operations table to retrieve the data you need. Otherwise, the only way to do this is to fetch payments for an account from Horizon, and dig through all payments with paging. This isn't the best option from the performance perspective, especially for high-volume accounts with thousands of payments. But if you decide to go this way, use the maximum allowed page size (currently 200) to reduce the Horizon loading, always check payment
source account (the endpoint returns incoming and outgoing payments), and save the results somewhere on your server if possible, as you won't need to fetch all the data back to day one again on the subsequent requests – just the portion since the last aggregation.