If iām understanding you correctly you need a function to setup the TCP payload through the API ?
if so, you can combine URCap Sample: Send Script with button push URCap
with sending a script command set_tcp_payload on a button press
or
use the ScriptWriter function set_payload() on Program generation.