AsyncStatus Polling
function pollResult($ref, $max = 30) {
for ($i = 0; $i < $max; $i++) {
$r = gateway_post('https://secure.cyogate.net/api/cpca/v1/asyncstatus',
['security_key' => KEY, 'transaction_ref' => $ref]);
if ($r['status'] === 'complete') return $r;
if ($r['status'] === 'error') throw new Exception($r['message']);
sleep(2);
}
throw new Exception('Timed out');
}| status | Meaning |
|---|---|
| pending | Waiting for customer |
| processing | Being authorized |
| complete | Done — check response field |
| cancelled | Cancelled at terminal |
| error | Terminal/network error |
See the Lane/Series overview for the full topic list.