定制 easytransac/easytransac-sdk-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

easytransac/easytransac-sdk-php

最新稳定版本:v2.1.1

Composer 安装命令:

composer require easytransac/easytransac-sdk-php

包简介

Easytransac payment gateway PHP SDK

README 文档

README

Build PSR12 Test Coverage Status Latest Stable Version

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/debitapi/payment/sdd/init
  • ✅ Fixed card listing endpoint
    • api/payment/listcardsapi/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

统计信息

  • 总下载量: 22.82k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 0
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-01-03