PHP code example of matscode / paystack
1. Go to this page and download the library: Download matscode/paystack 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 example snippets
php
php
// Set data to post using array
$data =
[
'email' => 'customer@email.com',
'amount' => 500000 // amount is treated in kobo using this method
];
$response = $Transaction->initialize($data);
php
$response = $Transaction->verify();
// Debuging the $response
Debug::print_r( $response);
php
// This method does the check for you and return `(bool) true|false`
$response = $Transaction->isSuccessful();
php
// This method does the check for you and return `(bool) true|false`
$response = $Transaction->isSuccessful($reference);
php
// returns Auth_xxxxxxx
$response = $Transaction->authorizationCode($reference); // can also guess Transaction $reference