easytransac / easytransac-sdk-php
Easytransac payment gateway PHP SDK
Installs: 22 598
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 0
Forks: 5
Open Issues: 1
pkg:composer/easytransac/easytransac-sdk-php
Requires
- php: >=7.4 <9.0
Requires (Dev)
- phpunit/phpunit: ^9.6
- squizlabs/php_codesniffer: ^3.7
This package is auto-updated.
Last update: 2025-12-15 08:32:30 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.1.1)
- โ
Updated SEPA Direct Debit (SDD) endpoint
api/payment/debitโapi/payment/sdd/init
- โ
Fixed card listing endpoint
api/payment/listcardsโapi/payment/card/list
- ๐งพ Documentation updated accordingly
- โ ๏ธ No breaking changes in the SDK public API
What's New (v2.1.0)
- โ
Added
setEnvironment('sandbox')for clean sandbox/production separation - โ Full PHP 7.0 to 8.4 compatibility
- โ Deprecated PHP 5.6 support
- โ Improved response helpers and strict typing
- โ Updated documentation
Requirements
You need at least:
- PHP โฅ 7.0
- cURL in order to get clear error messages
- An API key provided by EasyTransac (register an account at EasyTransac website)
- OpenSSL version 1.0.1 to support TLSv1.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); \EasyTransac\Logger::getInstance()->setFilePath('YOUR_CUSTOM_PATH');
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); $dp = new EasyTransac\Requests\DirectPayment(); $response = $dp->execute($transaction); if ($response->isSuccess()) { $transactionItem = $response->getContent(); if ($transactionItem->getSecure()) { // Use 3DS URL to complete the transaction 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); // raw dump for debug
Get base API response in JSON and Array
$dp = new EasyTransac\Requests\DirectPayment(); $response = $dp->execute($transaction); var_dump($response->getRealJsonResponse()); // stdClass var_dump($response->getRealArrayResponse()); // array