Being tired of regular subscriptions, I want to use Billing Agreements to charge my clients based on their usage at the end of the month.
From what I saw on http://myworks.design/software/whmcs-paypal-billing-agreements-payment-gateway Billing Agreements can accomplish this.
However I wasn't able to find out how to do it this way. As I know it works the following:
Create Billing Plan and activate it.
Create Billing Agreement with user
Take the payment
However in every example I found creating a billing plan involved setting a start date, intervall, as well as a price and I suppose this won't allow me to charge clients any amount I'd want to based on their usage.
I have used sites that run this whmcs plugin as a client so I know this works. A client first approves the Billing Agreement. On the approval page is no price, it just says to approve payments for merchant xyz.
After this is done I can pay all the invoices, no matter the amount with one click from the website.
How is this done using paypal? Are there any code samples?
We're the developers of the module you linked to above. Do you use WHMCS?
Our module does work as we described - and how you wish above. The description of a Billing Agreement is inherently that there is no amount attached, as it would then be a subscription.
A Billing Agreement with PayPal can be likened to having a credit card number on file for your client - except in this case, it's a token that you can use to charge their account at any time. That's what our module does - stores the token on file, then whenever an invoice is due or attempted payment, it simply uses that token to charge their PayPal account.
In short, as long as you install and configure our module correctly, it should perform how you desire.