Expensing fees on credit card processing fees for business services

How can I write off processing fees on these platforms where I accept credit card/digital payments? Can I charge the client for the processing fee in the grand total sales and then expense the percentage the platform (say Square or PayPal) charged me/my business?