Tamara PHP SDK is a wrapper for the Tamara API.
Update composer.json
"require": {
"tamara-solution/php-sdk": "1.*"
}
$configuration = Configuration::create($apiUrl, $apiToken, $apiRequestTimeout, $transport);
$client = Client::create($configuration);
$response = $client->getPaymentTypes('SA');
if ($response->isSuccess()) {
var_dump($response->getPaymentTypes());
}
$notification = \Tamara\Notification\NotificationService::create('token-key');
$message = $notification->processAuthoriseNotification();
var_dump($message->getOrderId());
var_dump($message->getOrderStatus());
var_dump($message->getData());
tamarapay.configuration:
factory: ['Tamara\Configuration', create]
arguments:
- https://api.tamarapay.com
- test_token
tamarapay.client:
factory: ['Tamara\Client', create]
arguments: ['@tamarapay.configuration']
- We use Guzzlehttp library as the default http client transport and Nyholm http as a backup
- You can use your own transport service and just need to implement the
Tamara\HttpClient\ClientInterface
and pass it toConfiguration::create
function