I will try to explain my idea.
Our server receive data to save from different servers, we call it S1, S2 and S3.
Our server uses a node script with web3.js to call function over a contract. Actually we're paying all the transactions from our wallet.
I'd like to be able to receive eth from our clients, saving into contract balance, having a balance x single address.
This is doable.
But then i'd like that our server will spend the clients's eth, not our eth, to call contract functions.
So the ultimate goal is that user will pay for what server does.
My problem is that users are not interacting with our server with a browser, so we have no metamask to pay costs.
Is there a way to addebitate to third party the fees?
We could do calls for our clients, we anticipate costs, then call a contract function that only we can call to move a certain amount of eth from user's personal balance to our.
I imagine I can't simply move eth from other's wallet to our. So I thinked to create something like a balance per user inside contract, accept anticipated payments, and move gas from user's balance into contract balance.
I am totally sure it will be hacked in some way. I am not entirely happy.
Edit
My user should be able to send ETH to contract. This amount is sent to contract, not to contract owner
When contract receive eth from an user, the contract does something like
balance[msg.sender] += msg.valueA part the initial payment, user will NO be able to interact directly to the contract in any way.
EDIT 2 : Probably I've found a practical example
Imagine like we act as a bank.
You, the user, transfer money to your bank account. The bank, our contract, actually knows the total amount of money owned by you.
But if your bank account has enough money, the bank pays your bills.
You sent initially money into your bank account, but is the bank that spends your money without your intervention.
So sending eth to my contract, users allow me to spend what they sent.