Estonian e-payments solution for PHP released (updated 1.4 stable 20.04.2011)

January 11, 2011 at 20:10

Electronic Payments

Electronic Payments

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:

Swedbank (Estonia)
SEB (Estonia)
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.

Files descriptions:

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']=’’;
line 23. $config['return-url']=’’;

Don’t forget to change the 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).

Download: e-payments solution 1.4 stable

Other notes:

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

Version history:

1.4 stable
Minor change for Nordea, switching the language keyword (estonian and english were switched)

1.3 beta
VK_AUTO requests did not work with some banks, gateway now attempts a cURL request to remedy that, if cURL is enabled.

1.2 beta

VK_AUTO assigned for ipizza profiles (Sampo, SEB and Swedbank) for automatic pings on success URL

1.1 beta

Sampo profile now works properly, taking into account UTF-8 characters

1.0 beta
First release

Tags: ,

2 Responses to “Estonian e-payments solution for PHP released (updated 1.4 stable 20.04.2011)”

  • marko says:


    I have question about Sampo-est payment. We have trouble confirming the transaction when returning from bank. Sampo tells that the problem is in the return url that your library makes. Sampo documentation says that query strings are not allowed. Still you library adds them. Have you tested sampo payments and have succesfully confirmed them with openssl?

  • Thank you, I have recently been searching for information approximately this subject for ages and yours is the best I’ve discovered till now. But, what about the conclusion? Are you certain in regards to the source?|What i do not understood is in reality how you’re now not actually much more neatly-preferred than you might be now. You are very intelligent.

Leave a Reply

You must be logged in to post a comment.