I got this defitiniton below is it true and what is the difference between packet and payload?
The ESP (Encapsulation Security Payload) protocol is a member of IPSec suite. Its purpose is to guarantee payload's (message) integrity, data origin authentication of IP packets and confidentially of the payload. It does provide protection for the entire packet, not only to the payload.
As mentioned; A payload is the part of the packet with the actual info (the good stuff!) There are other parts of a packet, the packet headers, that describe the payload, like how big it is.
But for ESP, actual answer is:
It depends on the mode.
In tunnel mode ESP secures whole packet, in transport mode ESP secures only payload.