If you are simply using preg_match in an if statement as a boolean test to see if it matches something or not, (yet, you will not make explicit use of matched elements afterwards), you do not need to include the third argument [$matches] within preg.
When using alternations (...|...), this acts as a capture (not to be confused with matching) as well (which in this case stores whichever it finds within the alternation into the variable $1 (I think regex still stores this even without the $matches paramter) You can make it non-capturing instead by using (?: ... | ...)
Finally, since you are using / as delimiters, as you can see, you need to escape those same characters throughout your path.. you could use other delimiters that eleviate the need to escape those...
if (!preg_match('#(?:/payment|/confirmation)#',$_SERVER['REQUEST_URI'])) {
Just lends to easier readability