1. Go to this page and download the library: Download sahanh/ezcash 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/ */
sahanh / ezcash example snippets
use SZ\EZCash\EZCash;
//create a new EZCash instace by prvoding the key files.
$ez = new EZCash(__DIR__.'/keys/publicKey.key', __DIR__.'/keys/myprivateKey.key');
$params = array(
'merchant' => 'TESTMERCHANT', //id of the merchant
'transaction_id' => 'TX_6729', //id for the transaction, typically an invoice id
'amount' => '100.00', //amount
'url' => 'http://mysite.com/process.php' //url to redirect after processing
);
//form (simple form with a submit button)
echo $ez->getInvoiceForm($params);
//get the encrypted transaction data to use in form field
$invoice = $ez->getInvoice($params);
use SZ\EZCash\EZCash;
use SZ\EZCash\Exception\InvalidTransactionException;
use SZ\EZCash\Exception\EZCashException;
//create a new EZCash instace by prvoding the key files.
$ez = new EZCash(__DIR__.'/keys/publicKey.key', __DIR__.'/keys/myprivateKey.key');
try {
$receipt = $ez->getReceipt($_POST['merchantReciept']);
print_r($receipt->toArray());
} catch (InvalidTransactionException as $e) {
echo $e->getMessage();
} catch (EZCashException as $e) {
//Something went wrong, please retry
}