1. Go to this page and download the library: Download hamedov/omnipay-moyasar 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/ */
hamedov / omnipay-moyasar example snippets
$moyasar = Omnipay::create('Moyasar');
$moyasar->setApiKey('You test or live api key');
$payment = $moyasar->capture([
'id' => $transactionId,
'amount' => $amount, // Optional, defaults to total amount
])->send();
if ($payment->isCaptured())
{
// Success
}
elseif ($payment->hasError())
{
$error = $payment->getMessage();
}
$moyasar = Omnipay::create('Moyasar');
$moyasar->setApiKey('You test or live api key');
$payment = $moyasar->void([
'id' => $transactionId,
])->send();
if ($payment->isVoided())
{
// Success
}
elseif ($payment->hasError())
{
$error = $payment->getMessage();
// You can fallback to the refund request here
}
$moyasar = Omnipay::create('Moyasar');
$moyasar->setApiKey('You test or live api key');
$payment = $moyasar->refund([
'id' => $transactionId,
'amount' => $amount, // Optional
])->send();
if ($payment->isRefunded())
{
// Success
}
elseif ($payment->hasError())
{
// Payment cannot be refunded
$error = $payment->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.