1. Go to this page and download the library: Download pils36/rexpay 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/ */
pils36 / rexpay example snippets
$rexpay = new \Pils36\Rexpay;
try
{
$tranx = $rexpay->transaction->initialize([
'reference'=>"sm23oyr1122", // string
'amount'=>200, // integer
'currency'=>"NGN", // string
'userId'=>"[email protected]", // string
'callbackUrl'=>"google.com", // string
'metadata'=> ['email' => "[email protected]", 'customerName' => "Victor Musa"], // string
'authToken'=> $authtoken, // string - (Basic Authentication Token)
'mode' => 'test' // test or production
]);
} catch(\Pils36\Rexpay\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
// store transaction reference so we can query in case user never comes back
// perhaps due to network issue
saveLastTransactionId($tranx);
// initiate the Library's Rexpay Object
$rexpay = new Pils36\Rexpay;
try
{
// verify using the library
$tranx = $rexpay->transaction->verify([
'transactionReference'=>$reference, // unique to transactions
'authToken'=> $authtoken, // string - (Basic Authentication Token)
'mode' => 'test' // test or production
]);
} catch(\Pils36\Rexpay\Exception\ApiException $e){
print_r($e->getResponseObject());
die($e->getMessage());
}
($tranx->responseCode === "00") => "success";
($tranx->responseCode === "01") => "failed";
($tranx->responseCode === "02") => "pending";
if ($tranx->responseCode === "00") {
// transaction was successful... Please check other things like whether you already gave value for this transactions
// if the email matches the customer who owns the product etc
// Save your transaction information here
}
php
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.