PHP code example of paylot / paylot-php
1. Go to this page and download the library: Download paylot/paylot-php 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/ */
paylot / paylot-php example snippets
$reference = isset($_GET['reference']) ? $_GET['reference'] : '';
if(!$reference){
die('No reference supplied');
}
// initiate the Library's Paystack Object
$paylot = new Paylot\Paylot(SECRET_KEY);
try
{
// verify using the library
$tranx = $paylot->transaction->verify($reference);
} catch(\Paylot\Exceptions\ApiResponseException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
if ($tranx->sent) {
// Payment has been made. You can give value
}
if ($tranx->confirmed) {
// Payment has been confirmed on blockchain.
// If you don't give value here, I don't know what you are waiting for.
}
bash
$ composer
php