I have an error "TypeError: "send" and "transfer" are only available for objects of type "address payable", not "address"" on

function withdraw() payable public {

in the line "msg.sender.transfer"


2 Answers 2


address and payable address both store 160-bit length address, but If you want to send ethers to a particular address you need to specify them as payable address.

ways to define payable address:

address addr1; address payable addr2 = payable(addr1);


address payable addr; payable(addr).call("")...

As much I know you need to specify payable two times. once while declaring and once while using.

hope it helps...


this means that your type "address" (msg.sender) has no access to the send, transfer and call functions, it cannot send eth, in order to do so you need to use another type : address payable


address payable: Same as address, but with the additional members transfer and send.

In order to do the latter you need to:

  • use a type modifier : "payable" when you initialize the address variable (you create a container for storing addresses that can pay and receive eth)
  • typecast the "msg.sender" address type during the declaration of the payable address variable (you fill the container with an address).


conversions from address to address payable must be explicit via payable().

it will give you the following :

  address payable owner;
  owner = payable(msg.sender);

and from now you can use send and transfer.

Not the answer you're looking for? Browse other questions tagged or ask your own question.