Omnipay: Paystack
Paystack driver for the Omnipay PHP payment processing library
Omnipay is a framework agnostic, multi-gateway payment processing library for PHP. This package implements Paystack support for Omnipay. https://paystack.com/ refer to the API docs here: http://developer.paystack.com/
Install
Via Composer
$ composer require aramics/omnipay-paystack
Basic Usage
Get the Paystack redirect URL
use Omnipay\Omnipay;
$url = Omnipay::create('Paystack')
->setCredentials(
'your_key',
'your_secret'
)
->setCallbackUrl('https://domain.com/paymentdone/confirm')
->getUrl(
'customermail@domain.com',
'my_reference',
'description',
100 //amount
);
Check transaction status (from the Paystack ipn)
- Configure & setup an endpoint to receive the ipn message from Paystack
- Listen for the message and use
getTransactionStatus
(please handle the http GET vars accordingly)
use Omnipay\Omnipay;
$status = Omnipay::create('Paystack')
->setCredentials(
'your_key',
'your_secret'
)
->getTransactionStatus(
$_REQUEST['paystack_notification_type'],
$_REQUEST['paystack_transaction_tracking_id'],
$_REQUEST['paystack_merchant_reference']
);
-
$status
will be eitherPENDING
,COMPLETED
,FAILED
orINVALID
. Handle these statuses in your application workflow accordingly.