if it is listening (ie: The Payment Gateway will call your script) then you should not do anything. When the payment gateway has a change in it's status, it should be calling your endpoint again.
Otherwise, you'd need to start a background task, which will do some HTTP request to the payment gateway to poll for the status every X seconds (not adviced).
Could you give a bit more background info? (Which payment gateway, is it an endpoint on your end that's being called by the gateway, or is the user being returned to your website and you need to POLL for the status ?)
If you have to GET the status from the Payment Gateway, please also post that code here.