1. Go to this page and download the library: Download dizatech/transaction 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/ */
// Parsian Driver
$transaction = Transaction::driver('parsian')
->amount(2000)
->orderId(2000)
->callbackUrl('callback_parsian')
->detail(['auto_redirect' => false]) // if we want to get {token, url} and not auto redirect to Bank Gateway.
->pay();
// Pasargad Driver
$transaction = Transaction::driver('pasargad')
->amount(2000)
->orderId(2000)
->callbackUrl('callback_pasargad')
->detail(['auto_redirect' => false]) // if we want to get {token, url} and not auto redirect to Bank Gateway.
->pay();
// Parsian Driver, that use POST type
Route::post('/callback_parsian', function () {
$verify = Transaction::driver('parsian')->request(request()->all())->verify();
});
// Pasargad Driver, that use GET type
Route::get('/callback_pasargad', function () {
$verify = Transaction::driver('pasargad')->request(request()->all())->verify();
});
// Use the Trait
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Dizatech\Transaction\Traits\HasTransaction;
class Order extends Model
{
use HasFactory, HasTransaction;
}
// After add the Trait we can use this relations
$order->transactions; // get the all transactions for this order
$order->pendingTransactions; // get the pending transactions for this order
$order->successfulTransactions; // get the successful transactions for this order
$order->failedTransactions; // get the failed transactions for this order
$order->refundedTransactions; // get the refunded transactions for this order
// Set the namespace of your model in /config/dizatech_transaction.php
'model' => 'App\Models\Order',
// Use relation for get a parent of this transaction
$transaction->parent;
// Default
$transaction->id;
$transaction->order_id;
$transaction->amount;
$transaction->driver;
$transaction->status;
$transaction->ref_no;
$transaction->token;
$transaction->created_at;
$transaction->updated_at;
// Appends
$transaction->gateway; // Label of driver
$transaction->toman; // Get price to taman (convert rial to toman)
$transaction->status_label; // Label of status
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.