Is online payment with credit card equal to giving merchant whole wallet to take the money we agreen upon?
No, it is not. To clarify: you're not giving access to cash (=wallet), you're not even giving access to your bank account. You're giving access to your credit line, which is protected by multiple layers of legal and contractual obligations before you need to pay any actual money.
Isn't the sale amount just some number that is simply entered to some payment processing machine but is not part of the specific transaction from technicall POV like with the bank transfer example
No, it is not.
When you agree to a transaction, you agree to a specific set of details: what you're getting, how you're getting it, how much you're paying for it and how you're paying for it. When you click "I Agree", or sign your signature, or enter your PIN at the POS - that is what you're agreeing to.
The transaction amount is transmitted to your issuer as part of the authorization request (that's how you see "pending" transactions). Charging over the authorized amount leaves the merchant vulnerable for charge-backs.
merchant technically can charge whatever amounts he wants regardless of "online website cart amount" when confirming payment?
That is called "fraud" or "theft". Your wallet can be stolen from you, either by force or through fraud. Credit cards, however, have strong fraud protections, both contractual and legal, and you can demand money be returned to you if you didn't agree to the charge (this is called "charge back"). Merchants who do this would be dropped by their processors in no-time.