1. Go to this page and download the library: Download azima/tamara 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/ */
azima / tamara example snippets
use Azima\Tamara\Tamara;
$order = ['phone' => '00966511111', 'total' => 600];
$response = (new Tamara())->checkPaymentOptionsAvailability($order);
public function tamaraResult(Request $request)
{
if ($request->paymentStatus == 'approved') {
//update order payment status
return view('success_payment');
} else {
return view('fail_payment');
}
}
use Azima\Tamara\Tamara;
//use id that you used in createCheckoutSession function $order['order_num']
$response = (new Tamara())->getOrderDetails($orderId = '123');
use Azima\Tamara\Tamara;
//get id from createCheckoutSession function response
$order = ['id' => '9d7546e6-59e5-46ab-884c-9dbf95e2877c' ,'amount' => 100];
$response = (new Tamara())->cancelOrder($order);