ikechukwuokalia / paylot-php
[A custom version of paylot/paylot-php by @dozieogbo] A PHP Wrapper for Paylot API
v1.0.2
2020-11-08 12:46 UTC
Requires
- php: >=5.3.0
- guzzlehttp/guzzle: ^7
This package is auto-updated.
Last update: 2025-03-08 22:10:54 UTC
README
A PHP API wrapper for Paylot.
Requirements
- Guzzle 6.3.0 or more recent (Unless using Guzzle)
- PHP 5.4.0 or more recent
- OpenSSL v1.0.1 or more recent
Install
Via Composer
$ composer require paylot/paylot-php
Via download
Download a release version from the releases page. Extract, then:
require 'path/to/src/autoload.php';
Usage
To use, follow the following.
0. Prerequisites
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!
0b. Secret Key
Please, ensure you have your Paylot secret key handy. You can obtain that from your business profile.
1. Verify Transaction
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. }