This is possible, and there are likely many ways of doing it.
It would be easier to invert the logic, and say “if a page exists, display it – otherwise feed it to wordpress and let wordpress display/handle it”. This is actually the default on most WordPress sites, as its more-or-less required for “pretty URL’s”, which are important for SEO.
If the server is using Apache and you can modify the .htaccess file it is possible to reverse the logic and program what is pulled from WordPress and what isn’t by modifying the rewrite rules.
Expanded Info
I’ve made some reasonable [- ie very common but not always correct] assumptions below.
(At least on Apache), WordPress normally has a .htaccess file or equivalent which includes the following:
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
This Basically instructs the web server to check if the requested URL maps to a file or a directory – and if it does not, feed the request through WordPress.
As long as the resource you are trying to reach is either the name of a directory (which would be the case if your URL did not have a filename on the end – in which case the web server will look for a file like index.php or index.html or a few other defaults in that directory – or a filename) and exists, that resource will be fed directly by the filesystem.
You could thus have https://www.example.com load up your wordpress site, and https://www.example.com/payment – and (for example) create an (public_html)/payment/index.php – with the code to process payments, and the webserver would be smart enough to know to not process that url through WordPress.