The transfer method is similar to the send method. It is responsible for sending Ether or wei to an address. However, the difference here is that transfer raises an exception in the case of execution failure, instead of returning false , and all changes are reverted. Take a look at the transfer method in the following screenshot:
The transfer method is preferred over the send method as it raises an exception in the event of an error, meaning exceptions are bubbled up in the stack and halt execution.