January 11, 2011 at 20:10
E-payment systems and bank services are everyday and common in Estonia, but both developers and companies, who implement e-payments to websites, tend to ask large sums of money for solutions that should be relatively simple. Having developed e-payment systems for years, I had not put together a single solution for this very common problem until now, when Estonia has adopted Euro as its main currency. This solution is released open source, under LGPL license.
Please note that while this e-payment system is now considered stable and has not run into major problems ever since it was released, some of the connections have been tested more often than others and it is still recommended to test the implementation and make sure it works accordingly before going live.
E-payment systems and Bank e-services that are supported with this solution:
Sampo (Estonia & Finland)
Nordea (Estonia & Finland)
Estcard (Estonian credit card web service, Mastercard, Visa, etc)
Solution is built with PHP and requires PHP support. The website or service that implements this solution should be modern and utilize UTF-8 for data encoding. This e-payment system assumes that it gets its data as UTF-8 and acts accordingly. This system may not work properly if website is not encoded in UTF-8. OpenSSL support is also required from the web server for some epayment profiles. Multibyte String extension support is required for certain UTF-8 calculations.
config.epay.php – Configuration file for each profile. This also includes testing environment access informatin, if that profile has it (read the comments). Whenever setting up a e-payment link, this file should be configured accordingly.
class.epay.php – Main class, this file also calls the configuration file and expects the file to be in the same directory as the class.epayments.php file. This file should not be edited, unless necessary for some reason.
gate.epay.php – This is gateway file that is used to submit data to the bank service or parse the result from the service.
example-submit.php – This is example file, which generates the form that submits order data to gateway and gateway then submits it to the bank.
example-return.php – This is example return page, which receives returned information from bank.
This package has a working example that is easy and quick to set-up. Package includes SEB bank e-service testing environment. The only thing you have to do, to get the example up and running, is download the package below and upload it to your website under root or subfolder. For example, if you upload the files to:
Then you have to change only two configuration settings in example-submit.php file, related to order information and return URL. Using the previous example, the lines should be changed accordingly:
line 22. $config['gateway-url']=’http://www.example.com/epayment/gate.epay.php’;
line 23. $config['return-url']=’http://www.example.com/epayment/example-return.php’;
Don’t forget to change the example.com website address to your own website address. Nothing else needs to be changed to test if the class works.
From example to Live implementation:
The example runs on ‘seb-est’ (SEB Estonia) profile. To use another bank, such as Swedbank, you need to assign correct payment-type before generating the form (like in example-submit.php file). Then you also need to assign proper values to config.epay.php to the profile. The settings in configuration file are commented and self-explanatory. It is important to note though that some e-payment services offer no testing environments and other epayment services cannot even be tested without the testing environment being set up by the other side first (such as the case with Estcard solutions).
As BETA, this solution does not check for errors in every location and there may be quirks as a result. These will be ironed out in future versions. Please report any bugs or problems you find either here in comments or personally to my e-mail firstname.lastname@example.org
Minor change for Nordea, switching the language keyword (estonian and english were switched)
VK_AUTO requests did not work with some banks, gateway now attempts a cURL request to remedy that, if cURL is enabled.
VK_AUTO assigned for ipizza profiles (Sampo, SEB and Swedbank) for automatic pings on success URL
Sampo profile now works properly, taking into account UTF-8 characters
Tags: open source, technology