PHPackages                             rixtrayker/laravel-tamara - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. rixtrayker/laravel-tamara

ActiveLibrary

rixtrayker/laravel-tamara
=========================

Laravel wrapper for Tamara SDK

1.2.4(1y ago)017MITPHPPHP ^8.1

Since Aug 4Pushed 1y agoCompare

[ Source](https://github.com/rixtrayker/laravel-tamara)[ Packagist](https://packagist.org/packages/rixtrayker/laravel-tamara)[ Docs](https://github.com/rixtrayker/laravel-tamara)[ RSS](/packages/rixtrayker-laravel-tamara/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (15)Versions (4)Used By (0)

Laravel wrapper for [Tamara SDK](https://github.com/tamara-solution/php-sdk)
============================================================================

[](#laravel-wrapper-for-tamara-sdk)

[![Latest Version on Packagist](https://camo.githubusercontent.com/447248ba76a7f519acb2e75b6736fa44fdc04926b4666267f74b4d87494616d4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c617a7a692d617a2f6c61726176656c2d74616d6172612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/alazzi-az/laravel-tamara)[![GitHub Tests Action Status](https://camo.githubusercontent.com/8a244b677b23885f44a44b440a7b7d65a48659eebf5f26abf59ceeb4d2443048/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616c617a7a692d617a2f6c61726176656c2d74616d6172612f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/alazzi-az/laravel-tamara/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/23b8a2ed6fb284d950059fc42f8f5259abb58425198b03137c0c2ab1b7ab2c04/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f616c617a7a692d617a2f6c61726176656c2d74616d6172612f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/rixtrayker/laravel-tamara/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/4e459e57e5d4478aba0bd7fb5170533396bc4bbe6ec7569dc68c5b62a10292bc/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c617a7a692d617a2f6c61726176656c2d74616d6172612e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/rixtrayker/laravel-tamara)

Laravel wrapper for Tamara SDK with small amount of changes to make it work with Laravel 9.x.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require alazzi-az/laravel-tamara
```

You can publish the config file with:

```
php artisan vendor:publish --tag="laravel-tamara-config"
```

This is the contents of the published config file:

```
return [
    'uri' => env('TAMARA_URI', 'https://api-sandbox.tamara.co'),
    'token' => env('TAMARA_TOKEN', ''),
    'notification_token' => env('TAMARA_NOTIFICATION_TOKEN', ''),
    'request_timeout' => env('TAMARA_REQUEST_TIMEOUT', 1000),
    'transport' => null,
    'success_url' =>  env('APP_URL').'/tamara_handle_success_redirect',
    'failure_url' =>  env('APP_URL').'/tamara_handle_failure_redirect',
    'cancel_url' =>  env('APP_URL').'/tamara_handle_cancel_redirect',
    'notification_url' =>  env('APP_URL').'/tamara_notification_redirect',
];
```

Usage For Client Instance
-------------------------

[](#usage-for-client-instance)

```
use \AlazziAz\Tamara\Facades\Tamara;

$client = \AlazziAz\Tamara\Facades\Tamara::client();
$response = $client->getPaymentTypes('SA');
```

Create Order Checkout
---------------------

[](#create-order-checkout)

```
use \AlazziAz\Tamara\Facades\Tamara;
use \AlazziAz\Tamara\Tamara\Model\Order\MerchantUrl;
use \AlazziAz\Tamara\Tamara\Model\Order\OrderItemCollection;
use \AlazziAz\Tamara\Tamara\Model\Order\Order;
use \AlazziAz\Tamara\Tamara\Model\Order\OrderItem;
use AlazziAz\Tamara\Tamara\Request\Checkout\CreateCheckoutRequest;
use \AlazziAz\Tamara\Tamara\Model\Order\Consumer;
use AlazziAz\Tamara\Tamara\Model\Money;
use AlazziAz\Tamara\Tamara\Model\Order\Address;

$merchantUrl = app()->make(MerchantUrl::class);
$order = new Order();
$order->setMerchantUrl($merchantUrl);
$orderItemCollection = new OrderItemCollection();
$client = Tamara::client();

// firs set  Order Details
$order->setOrderReferenceId($orderReferenceId);
$order->setLocale($local);
$order->setCurrency($orderCurrency);
$order->setTotalAmount(new Money($totalAmount, $orderCurrency));
$order->setCountryCode($countryCode);
$order->setPaymentType($paymentType);
$order->setDescription($orderDescription);
$order->setTaxAmount(new Money($taxAmount, $orderCurrency));
$order->setDiscount(new Discount($discountType, new Money($discountAmount, $orderCurrency)));
$order->setShippingAmount(new Money($shippingAmount, $orderCurrency));

// second set Consumer data
$consumer = new Consumer();
$consumer->setFirstName($firstName);
$consumer->setLastName($lastName);
$consumer->setEmail($email);
$consumer->setPhoneNumber($phoneNumber);
$order->setConsumer($consumer);

// third sett Billing Address
$address = new Address();
$address->setFirstName($firstName);
$address->setLastName($lastName);
$address->setLine1($line1);
$address->setLine2($line2);
$address->setRegion($region);
$address->setCity($city);
$address->setPhoneNumber($phoneNumber);
$address->setCountryCode($countryCode);
$order->setBillingAddress($address);

// forth set Shipping Address
$address = new Address();
$address->setFirstName($firstName);
$address->setLastName($lastName);
$address->setLine1($line1);
$address->setLine2($line2);
$address->setRegion($region);
$address->setCity($city);
$address->setPhoneNumber($phoneNumber);
$address->setCountryCode($countryCode);
$order->setShippingAddress($address);

// fifth we add items to items collection
$orderItem = new OrderItem();
$orderItem->setName($name);
$orderItem->setQuantity($quantity);
$orderItem->setUnitPrice(new Money($unitPrice, $currency));
$orderItem->setType($type);
$orderItem->setTotalAmount(new Money($totalPrice, $currency));
$orderItem->setTaxAmount(new Money($taxAmount, $currency));
$orderItem->setDiscountAmount(new Money($discount, $currency));
$orderItem->setReferenceId($uniqueId);
$orderItem->setSku($uniqueId);
if ($imageUrl) {
    $orderItem->setImageUrl($imageUrl);
}

// append items can be in iterator
$orderItemCollection->append($orderItem);

// sixth set items collection to order
$order->setItems($this->orderItemCollection);

// seventh  create request object
$request = new CreateCheckoutRequest($this->order);

// now we can make request

$response = $client->createCheckout($request);

// get data from response
$checkoutUrl=$response->getCheckoutResponse()->getCheckoutUrl(); // redirect customer to complete payment
$orderID=$response->getCheckoutResponse()->getOrderId();
$heckOutID=$response->getCheckoutResponse()->getCheckoutId();
```

After Customer complete payment we need to Authorise Order Transaction
----------------------------------------------------------------------

[](#after-customer-complete-payment-we-need-to-authorise-order-transaction)

### in controller that handle success\_url endpoint

[](#in-controller-that-handle-success_url-endpoint)

```
use AlazziAz\Tamara\Tamara\Request\Order\AuthoriseOrderRequest;
use AlazziAz\Tamara\Facades\Tamara;

  $authOrder = new AuthoriseOrderRequest($request->get('orderId'));
  $authedResponse = Tamara::client()->authoriseOrder($authOrder);
  $orderStatus=$authedResponse->getOrderStatus(); // authorised, approved, captured, fully_captured, declined, refunded, failed, expired
// then check the status of the order and update your app state
```

#### you can Capture payment by using AlazziAz\\Tamara\\Tamara\\Request\\Payment\\CaptureRequest

[](#you-can-capture-payment-by-using-alazziaztamaratamararequestpaymentcapturerequest)

Usage For Notification Service Instance
---------------------------------------

[](#usage-for-notification-service-instance)

```
use AlazziAz\Tamara\Facades\Tamara;

$notificationService = Tamara::notificationService();
$message = $notificationService->processAuthoriseNotification();
// then you can update state of the app e.g.
$orderId=$message->getOrderReferenceId();
$orderStatus=$message->getEventType();
//...
```

Usage Some Instance by Laravel Container to get the instance injected config values
-----------------------------------------------------------------------------------

[](#usage-some--instance-by-laravel-container-to-get-the-instance-injected-config-values)

```
use Illuminate\Support\Facades\App;
use AlazziAz\Tamara\Tamara\Model\Order\MerchantUrl;

$merchantUrl = App::make(MerchantUrl::class); // app()->make(MerchantUrl::class);
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](https://github.com/alazzi-az/.github/blob/main/CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Mohammed Ali Azman](https://github.com/alazzi-az)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance35

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~15 days

Total

3

Last Release

615d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b6e3f5370d96347874ff526b3df1de70b2b64245336fc2b91643bc76b9aa9ba3?d=identicon)[rixtrayker](/maintainers/rixtrayker)

---

Top Contributors

[![mohammedazman](https://avatars.githubusercontent.com/u/56982649?v=4)](https://github.com/mohammedazman "mohammedazman (15 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (6 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")[![rixtrayker](https://avatars.githubusercontent.com/u/7710590?v=4)](https://github.com/rixtrayker "rixtrayker (5 commits)")[![200-0K](https://avatars.githubusercontent.com/u/38166228?v=4)](https://github.com/200-0K "200-0K (1 commits)")

---

Tags

laravelalazzi-azlaravel-tamara

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/rixtrayker-laravel-tamara/health.svg)

```
[![Health](https://phpackages.com/badges/rixtrayker-laravel-tamara/health.svg)](https://phpackages.com/packages/rixtrayker-laravel-tamara)
```

###  Alternatives

[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[sunchayn/nimbus

A Laravel package providing an in-browser API client with automatic schema generation, live validation, and built-in authentication with a touch of Laravel-tailored magic for effortless API testing.

29428.0k](/packages/sunchayn-nimbus)[muhammadhuzaifa/telescope-guzzle-watcher

Telescope Guzzle Watcher provide a custom watcher for intercepting http requests made via guzzlehttp/guzzle php library. The package uses the on\_stats request option for extracting the request/response data. The watcher intercept and log the request into the Laravel Telescope HTTP Client Watcher.

98239.8k1](/packages/muhammadhuzaifa-telescope-guzzle-watcher)[spatie/laravel-mailcoach-sdk

An SDK to easily work with the Mailcoach API in Laravel apps

41290.2k1](/packages/spatie-laravel-mailcoach-sdk)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
