Payment Processing

Learn about making payments to and from a Solidity contract.

Sending money to a contract

Contracts have an address on the Ethereum network, just like EOAs; therefore, they can receive and send ETH.

Payable functions

A contract is able to receive ETH, for a specific purpose, by making the corresponding function payable using the payable keyword. ETH can then be sent as part of a call to that function.

For example, in the following contract, we define a deposit() function, allowing addresses (the msg.sender) to send ETH to the contract.

Get hands-on with 1200+ tech skills courses.