A PHP API wrapper for Paylot.
- Guzzle 6.3.0 or more recent (Unless using Guzzle)
- PHP 5.4.0 or more recent
- OpenSSL v1.0.1 or more recent
$ composer require paylot/paylot-php
Download a release version from the releases page. Extract, then:
require 'path/to/src/autoload.php';
To use, follow the following.
Confirm that your server can conclude a TLSv1.2 connection to Paylot's servers. Most up-to-date software have this capability. Contact your service provider for guidance if you have any SSL errors. Don't disable SSL peer verification!
Please, ensure you have your Paylot secret key handy. You can obtain that from your business profile.
After a successful transaction, please verify the transaction before giving value.
$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.
}