Skip to content

Latest commit

 

History

History
executable file
·
68 lines (52 loc) · 2.2 KB

README.md

File metadata and controls

executable file
·
68 lines (52 loc) · 2.2 KB

Omnipay: Paystack

Paystack driver for the Omnipay PHP payment processing library

Maintainability Test Coverage Style CI Scrutinizer Code Quality

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 oneafricamedia/omnipay-paystack

Basic Usage

Get the Paystack redirect URL

use Omnipay\Omnipay;

$url = Omnipay::create('Paystack')
    ->setCredentials(
        'your_key', 
        'your_secret'
    )
    ->setCallbackUrl('https://example.com/callback')
    ->getUrl(
        '[email protected]',
        'my_reference',
        'description',
        100
    );

Check transaction status (from the Paystack ipn)

  1. Configure & setup an endpoint to receive the ipn message from Paystack
  2. 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(
        $_GET['paystack_notification_type'],
        $_GET['paystack_transaction_tracking_id'],
        $_GET['paystack_merchant_reference']
    );
  1. $status will be either PENDING, COMPLETED, FAILED or INVALID. Handle these statuses in your application workflow accordingly.

TODO

  1. Test coverage
  2. add QueryPaymentStatusByMerchantRef support
  3. add QueryPaymentDetails support