knusperleicht / eps-bank-transfer
PSA e-payment standard (EPS) implementation for PHP
Requires
- php: >=7.3.0
- ext-dom: *
- ext-libxml: *
- ext-simplexml: *
- jms/serializer: ^3.29
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^2.0
Requires (Dev)
- goetas-webservices/xsd2php: ^0.4.13
- goetas-webservices/xsd2php-runtime: ^0.2.17
- monolog/monolog: ^2.10
- nyholm/psr7: ^1.8
- php-coveralls/php-coveralls: ^2.7
- phpunit/phpunit: 9.*
- symfony/http-client: ^5.4
This package is auto-updated.
Last update: 2025-10-03 09:49:29 UTC
README
A PHP library for integrating the Austrian EPS bank transfer (PSA, specification v2.6, with preparation for v2.7). It helps you start EPS payments, handle the confirmation (callback/return), and trigger refunds (full or partial). Note on origins: This project was initially based on hakito/php-stuzza-eps-banktransfer. The codebase was rewritten but has the same core functionality. Credit to the original authors for the concept and initial implementation.
Links:
- Original code: https://github.com/hakito/PHP-Stuzza-EPS-BankTransfer
- Specification/Info: https://www.eps-ueberweisung.at/
Installation
Install via Composer:
composer require knusperleicht/eps-bank-transfer
What is this library for?
- Start an EPS payment: Create a payment request and redirect customers to the bank list/bank.
- Receive confirmation (return/callback): Verify the transaction status and update your order.
- Refund: Trigger a full or partial refund.
The library wraps the required requests/responses generated from the official XSD schemas and provides PSR-compatible HTTP communication.
Quick start
Check the examples in the samples/
folder:
samples/eps_start.php
– Start a payment (fetch bank list, initialize payment)samples/eps_confirm.php
– Process the confirmation callbacksamples/eps_refund.php
– Trigger a refund
Basic configuration (Test/Live)
The SoCommunicator
provides endpoint URLs as constants: TEST_MODE_URL
for test environments and
LIVE_MODE_URL
for production usage. Choose the appropriate URL for your environment.
Example:
use Knusperleicht\EpsBankTransfer\Api\SoCommunicator; use GuzzleHttp\Client; use Http\Discovery\Psr17FactoryDiscovery; $isTestMode = true; $url = $isTestMode ? SoCommunicator::TEST_MODE_URL : SoCommunicator::LIVE_MODE_URL; $requestFactory = Psr17FactoryDiscovery::findRequestFactory(); $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); $soCommunicator = new SoCommunicator( new Client(['verify' => true]), $requestFactory, $streamFactory, $url );
Typical flow
- Get bank list (optional): Show available banks to the user.
- Start payment: Create the start request with amount, currency, order ID, and return URLs.
- User is redirected to the bank/e-banking.
- Process callback/return: Validate status, amount, order ID; update your order status.
- Optional: Perform a refund.
The examples under samples/
demonstrate this end-to-end flow.
Security and limitations
- XML signatures/certificates: Not supported at the moment. Make sure your confirmation URL is hard to guess (e.g., unique tokens per transaction).
- TLS/verification: Keep certificate verification enabled (
['verify' => true]
). - Idempotency: Implement idempotent handling for callbacks and refunds.
Generated classes from XSD (background & generation)
Requests/responses are generated from the official XSD schemas. This ensures type safety and compatibility with the EPS standard. If schemas change or you need adjustments, you can regenerate the PHP classes:
vendor/bin/xsd2php convert xsd2php.yaml resources/schemas/*.xsd
xsd2php.yaml
contains the mapping configuration.- Schemas live under
resources/schemas
. - Generated classes are placed under
src/Internal/Generated/...
namespaces and used by the serializer.
Tests
PHPUnit is configured. Run:
vendor/bin/phpunit
License
GPL-2.0-or-later – see LICENSE.
Credits
- Project initially started by @hakito: https://github.com/hakito/PHP-Stuzza-EPS-BankTransfer