PHP code example of matscode / paystack-php-sdk

1. Go to this page and download the library: Download matscode/paystack-php-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

matscode / paystack-php-sdk example snippets


$response = $Paystack->transaction->initialize([
            'email'  => '[email protected]',
            'amount' => 500000, // amount is in kobo
            'callback_url' => 'https://www.app.local/paystack/transaction/verify'
        ]);

$response = $Paystack->bank->list();

$bank_code='0000';
$account_number='0987654321'
$response = $Paystack->bank->resolve($bank_code, $account_number); 
//result: returns account information is found, throws exception otherwise
 bash
composer 
 php
 php
    
 php
use Matscode\Paystack\Paystack;

$paystackSecret = 'sk_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
$Paystack = new Paystack($paystackSecret);
 php
$reference_code = $_GET['reference']
$response = $Paystack->transaction->verify($reference_code);
 php
// This method does the check for you and return `(bool) true|false` 
$response = $Paystack->transaction->isSuccessful($reference_code);