This should be an easy job.
My server uses Sendgrid to send out emails. I want to bill my customers based on the amount of emails they've sent.
With Sendgrid's API I can get the amount of emails my customers sent like this:
sendgrid dot com/apiv2/[url removed, login to view]
URL above returns this:
Requests = number of emails sent.
I need WHMCS to identify the user that is logged in, and put their username at the end of the URL (done easily using cURL in PHP), and then show the amount of delivered emails in their customer page. A cronjob will update this value every X hours.
Then, at the end of the month, WHMCS will get the amount of emails sent and bill my customers basing the price in $[url removed, login to view] for 1000 emails sent.