Pesapal driver for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP 5.3+. This package implements PayPal support for Omnipay. This package is a driver for pesapal https://www.pesapal.com/
Via Composer
$ composer require oneafricamedia/omnipay-pesapal
###to render the pesapal iframe
use Omnipay\Omnipay;
$iframeSrc = Omnipay::create('Pesapal')
->setCredentials(
'your_key',
'your_secret'
)
->setCallbackUrl('https://example.com/callback')
->getIframeSrc(
'[email protected]',
'my_reference',
'description',
100
);
echo "<iframe src='$iframeSrc' />";
- configure & setup an endpoint to receive the ipn message from pesapal
- listen for the message and use
getTransactionStatus
(please handle the http GET vars accordingly)
use Omnipay\Omnipay;
$status = Omnipay::create('Pesapal')
->setCredentials(
'your_key',
'your_secret'
)
->getTransactionStatus(
$_GET['pesapal_notification_type'],
$_GET['pesapal_transaction_tracking_id'],
$_GET['pesapal_transaction_tracking_id']
);
$status
will be eitherPENDING
,COMPLETED
,FAILED
orINVALID
. Handle these statuses in your application workflow accordingly.