show only first element from a type with acf

If I understand this correctly, you want the whole code inside if ($type == "payment-services") to run only once.
There might be an easier way to do this, but a suggestion is:

  1. Add a variable with a certain value before your for loop (e.g. $run=”yes”)
  2. Put the code you only want to run the first time inside an if statement, where it only runs if the above variable has its initial value
  3. Change the value of the variable during the first iteration so the whole if statement is false during the rest of the loop.

So your code could look something like this:

....
$run="yes";
foreach($types as $type) {
  if($run=="yes"){
    if ($type == "payment-services") { 

      rest of code which will only run once

      $run="no";
    }       
  }
}
....