How can i get status update for mobile transaction in php


#1
<?php

require_once 'paynow/autoloader.php';

    $paynow = new Paynow\Payments\Paynow(
    'INTEGRATION_ID',
    'INTEGRATION_KEY',
    'http://example.com/gateways/paynow/update',
    'http://example.com/return?gateway=paynow'
);
$payment = $paynow->createPayment('Invoice 35', 'example@gmail.com');

$payment->add('Bananas', 21.50);
$payment->add('Apples', 31.40);

$response = $paynow->sendMobile($payment, '0771111111', 'ecocash');

if($response->success()) {
 
    $pollUrl = $response->pollUrl();
   $status = $paynow->pollTransaction($pollUrl);
    //listen to status update changes using ajax after test
   if($status->paid()) {     
    echo "Paid";
      } else {
        echo "No payment done yet";
    }     
}else {
  echo "Not successful <br>";
  var_dump($response);
  //error();
}

 ?>

I have tried to follow other almost similar forums but they don’t seem to address my issue. I wish i could simply get a status update in a string. I understand the pollurl idea a little but i have no enough programming experience to follow the directions to poll for a status update as shown in https://developers.paynow.co.zw/docs/polling_status.html. May i have a simple way to get status update from the poll url or at the least dumbed down directions on how to poll for a status update.


#2

You have to right your own logic to check for the status, use javascript