easytransac / easytransac-sdk-php
Easytransac payment gateway PHP SDK
Package info
github.com/easytransac/easytransac-sdk-php
pkg:composer/easytransac/easytransac-sdk-php
Requires
- php: >=7.4
Requires (Dev)
- phpunit/phpunit: ^9.6
- squizlabs/php_codesniffer: ^3.7
- dev-master
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- 1.3.7
- 1.3.6
- 1.3.5
- 1.3.4
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.14
- 1.0.13
- 1.0.12
- 1.0.11
- 1.0.10
- 1.0.9
- 1.0.8
- 1.0.7
- 1.0.6
- 1.0.5
- 1.0.4
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-feature/dropin-sdk
- dev-dependabot/composer/phpunit/phpunit-9.6.33
- dev-fix-endpoint-sdd-debit
This package is auto-updated.
Last update: 2026-04-24 13:25:41 UTC
README
Make your EasyTransac API implementation easier with our SDK.
The EasyTransac SDK is a tool to process payments with the EasyTransac API.
What's New (v2.2.1)
- Added
setEnvironment('sandbox')for clean sandbox/production separation - Full PHP
7.0to8.4compatibility - Deprecated PHP 5.6 support
- Improved response helpers and strict typing
- Added backend Drop-in session support
- Updated documentation
Requirements
You need at least:
- PHP >= 7.0
- cURL in order to get clear error messages
- An API key provided by EasyTransac
- OpenSSL version 1.0.1 to support TLS v1.2 ciphers
Installation
By composer
composer require easytransac/easytransac-sdk-php
Or add this in your composer.json:
{
"require": {
"easytransac/easytransac-sdk-php": "*"
}
}
Manually
In order to use it, you only need to require the autoload file easytransac/easytransac-sdk-php/sdk/EasyTransac/autoload.php.
Unit Testing
Our test cases are written under PHPUnit. Please check the required PHPUnit version in the composer.json file.
Sandbox Support
As of v2.0.0, the sandbox API is hosted separately at:
https://sandbox.easytransac.com
Use the new method to enable sandbox mode:
\EasyTransac\Core\Services::getInstance()->setEnvironment('sandbox');
No need to override API URLs manually.
Samples
Set up the configuration
require_once(__DIR__ . '/vendor/easytransac/easytransac-sdk-php/sdk/EasyTransac/autoload.php'); \EasyTransac\Core\Services::getInstance()->provideAPIKey('YOUR_API_KEY_HERE'); \EasyTransac\Core\Services::getInstance()->setEnvironment('sandbox'); \EasyTransac\Core\Services::getInstance()->setDebug(true); \EasyTransac\Core\Services::getInstance()->setRequestTimeout(30);
Make a direct payment request
$customer = (new EasyTransac\Entities\Customer()) ->setFirstname('Demo') ->setLastname('Mini SDK') ->setCity('Strasbourg') ->setUid('a1b2c3d4'); $card = (new EasyTransac\Entities\CreditCard()) ->setNumber('1111111111111111') ->setMonth('10') ->setYear('2025') ->setCVV('123'); $transaction = (new EasyTransac\Entities\DirectTransaction()) ->setAmount(100) ->setClientIp('127.0.0.1') ->setCustomer($customer) ->setCreditCard($card); $request = new EasyTransac\Requests\DirectPayment(); $response = $request->execute($transaction); if ($response->isSuccess()) { $transactionItem = $response->getContent(); if ($transactionItem->getSecure()) { echo $transactionItem->getSecureUrl(); } else { var_dump($transactionItem->getStatus()); var_dump($transactionItem->getTid()); } } else { var_dump($response->getErrorMessage()); }
Push payment notification
$response = \EasyTransac\Core\PaymentNotification::getContent($_POST, $myApiKey); var_dump($response->toArray()); var_dump($response->getStatus()); var_dump($_POST);
Get base API response in JSON and Array
$request = new EasyTransac\Requests\DirectPayment(); $response = $request->execute($transaction); var_dump($response->getRealJsonResponse()); var_dump($response->getRealArrayResponse());
Create a Drop-in session token
The Drop-in flow starts on the backend with POST /api/dropin/session.
Important:
Providersis required by the EasyTransac API- pass it on the transaction with
->setProviders(...) setProviders()accepts either a comma-separated string or an array- array values are trimmed, lowercased, deduplicated, and serialized for the API
- examples:
card,applepay,googlepay,card, or['applepay', 'googlepay']
use EasyTransac\Core\Services; use EasyTransac\Entities\Customer; use EasyTransac\Entities\DropinSessionTransaction; use EasyTransac\Requests\DropinSession; Services::getInstance() ->provideAPIKey('your_api_key') ->setEnvironment(Services::ENV_SANDBOX); $customer = (new Customer()) ->setFirstname('John') ->setLastname('Doe') ->setEmail('john.doe@example.com'); $transaction = (new DropinSessionTransaction()) ->setOrderId('ORDER-123') ->setAmount(1000) ->setDescription('Drop-in test order') ->setLanguage('FRE') ->setReturnUrl('https://merchant.test/return') ->setCancelUrl('https://merchant.test/cancel') ->setNotificationUrl('https://merchant.test/notify') ->setProviders(['applepay', 'googlepay']) ->setCustomer($customer); $response = (new DropinSession())->execute($transaction); if (!$response->isSuccess()) { var_dump($response->getErrorCode(), $response->getErrorMessage()); exit(1); } $session = $response->getContent(); var_dump([ 'token' => $session->getToken(), 'request_id' => $session->getRequestId(), 'status' => $session->getStatus(), ]);
You can now pass the returned session token to the EasyTransac frontend Drop-in widget.