Pesapal.com

Forum

Welcome, Guest
Username
Password:
 

how to know the payment status in pesapal
(1 viewing) (1) Guest
Welcome to the Pesapal integration forum!

This forum discusses everything about Pesapal integration on your web site. Having any problems? This is the right place to post a question and we are sure you will get an answer
  • Page:
  • 1

TOPIC: how to know the payment status in pesapal

how to know the payment status in pesapal 10 years, 9 months ago #1259

$callback_url =fn_url("payment_notification.CHANGE?payment=pesapal&order_id=$order_id", AREA, 'current');


pesapal payment only return pesapal_transaction_tracking_id and pesapal_merchant_reference . I want the know the payment status whether the payment was complited or cancelled or pending ...

Re: how to know the payment status in pesapal 10 years, 9 months ago #1260

Hi Soniya,

Yes you can query a payment status from Pesapal using the pesapal tracking ID and merchant reference returned to you. If you downloaded the Pesapal API files, within there is a file called checkStatus with a class containing methods that can query a payment status. If you don't have the API files please download them from here:

developer.pesapal.com/how-to-integrate/samples-downloads

Please let me know if you are successful.

Re: how to know the payment status in pesapal 10 years, 9 months ago #1261

Yes i missed the $statusrequestAPI . Now its working for me.

Re: how to know the payment status in pesapal 10 years, 8 months ago #1280

  • kikuyu1
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hey there
There is no file like checkStatus in the Pesapal Api folder provided
I'm an enthusiast in PHP & MYSQL Website and web application Development in Kenya.Visit my website here questdesigners.com

Re: how to know the payment status in pesapal 10 years, 8 months ago #1281

The checkStatus functionality has been included in the file pesapal-ipn-listener.php
Read the code carefully and you will see a CURL request doing the checkstatus.

Re: how to know the payment status in pesapal 10 years, 8 months ago #1282

  • kikuyu1
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Thanks
What i need to do is update the database once the status is COMPLETED, I'm trying to output $status in the url that is listening to the notification.
I also want to output this message as shown in the image below


I want the exact code that i can insert to my page and return the status

this is what I'm trying to do

 
 
<?php
 
include_once('OAuth.php');
$consumer_key="xxxxxxxxxxxxxxxxxxxxwuD4";//Register a merchant account >set_parameter("pesapal_merchant_reference", $pesapal_merchant_reference);
$request_status->set_parameter("pesapal_transaction_tracking_id",$pesapalTrackingId);
$request_status->sign_request($signature_method, $consumer, $token);
 
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_status);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
if(defined('CURL_PROXY_REQUIRED')) if (CURL_PROXY_REQUIRED == 'True')
{
$proxy_tunnel_flag = (defined('CURL_PROXY_TUNNEL_FLAG') && strtoupper(CURL_PROXY_TUNNEL_FLAG) == 'FALSE') ? false : true;
curl_setopt ($ch, CURLOPT_HTTPPROXYTUNNEL, $proxy_tunnel_flag);
curl_setopt ($ch, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
curl_setopt ($ch, CURLOPT_PROXY, CURL_PROXY_SERVER_DETAILS);
}
 
$response = curl_exec($ch);
 
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$raw_header = substr($response, 0, $header_size - 4);
$headerArray = explode("\r\n\r\n", $raw_header);
$header = $headerArray[count($headerArray) - 1];
 
//transaction status
$elements = preg_split("/=/",substr($response, $header_size));
$status = $elements[1];
 
curl_close ($ch);
 
//UPDATE YOUR DB TABLE WITH NEW STATUS FOR TRANSACTION WITH pesapal_transaction_tracking_id $pesapalTrackingId
 
if(DB_UPDATE_IS_SUCCESSFUL)
{
 
$numberbal = $number + $balance;
 
$sql2 = "UPDATE balance
SET balance = '$numberbal'
WHERE username= '"
.$office1."'";
dbQuery($sql2);
 
$resp="pesapal_notification_type=$pesapalNotification&pesapal_transaction_tracking_id=$pesapalTrackingId&pesapal_merchant_reference=$pesapal_merchant_reference";
ob_start();
echo $resp;
ob_flush();
exit;
}
}
?>
 
 


Your help would be appreciated.
I'm an enthusiast in PHP & MYSQL Website and web application Development in Kenya.Visit my website here questdesigners.com
  • Page:
  • 1