I liked the way you worded it... "is it allowed?"
With programming in general and C/C++ specifically, they will
allow you to do anything. Even shoot yourself in the foot. So yes... if it compiles... it is allowed.
Using String is a convenience piece and used correctly will work continuously. To my knowledge, it does not have memory leak issues. It does, however, cause fragmentation of memory. If you are not really tight on using the full 1MB of program address space and not doing other allocations (using malloc/new and delete/free) all over the place, you will also be fine. And even if you do, and it finally fails to allocate, the software/hardware watchdog will reboot it and clean everything up anew.
Now... if you really want to be a purist, hardcore developer or you absolutely want your program to run forever and never rely on the watchdog as a pacifier, I can understand that. In that case... you absolutely don't want to use String and certainly not the way you describe. I have not looked into the class for String on an Arduino/ESP8266 as I don't use it. But... in general... String class typically allocates memory on the heap. As you're using the String's features, it typically has to re-allocate memory as the string is added to. As there is no way ahead of time for the String to know what you are going to assign it later. This is where fragmentation occurs. Some implementations will allocate a larger block initially, but being a microcontroller needing to use memory sparingly, this probably does not happen on an ESP8266. Likely... when you set it to "0" it is doing the
equivalent of a malloc(2) to hold the 0 and the NULL. And later when you pass it the long strings... it either deletes or reallocs for the larger space. Either way a 2 byte (fragmentation) can occur.
IF you know the maximum size of the incoming strings... you'd be far better off just using character arrays. Something like...
char payload2D[40][80];
This way fragmentation can't occur. It is also the fastest as the allocation only happens once. But if you are relying on other features of the String class for manipulation or the string can be vary greatly in length this might not be possible.