In order to find out what version of specification is used, please select “Service management”. Upon selecting the required project, please open “general settings” tab. You find the version of specification, used in your project with comments below.

When a user successfully transfers money and that money reaches your account, Paysera requests your indicated address callbackurl and transfers all required information about the performed payment.

Parameter callbackurl is the address of the script on your website, which informs Paysera system about the request on the successful payment. The answer is generated in the following way:

1. Create a folder.

Create a folder named libwebtopay. It will contain all files related to the payment integration.

2. Download libwebtopay library.

Download WebToPay.php file to the created folder libwebtopay.

3. Create a callback.php file.

Create a file named callback.php in the folder libwebtopay. The content of this file has to be:

<?php
require_once('libwebtopay/WebToPay.php');

try {
    $response = WebToPay::checkResponse($_GET, array(
            'sign_password' => 'paslaptis',

            // Path to file to which all requests will be logged
            // If you plan to use this feature, make sure that log file
            // is not accessible from outside.
            //'log'           => 'webtopay.log',
        ));

    echo 'OK Thank you for sending';
}
catch (Exception $e) {
    echo get_class($e).': '.$e->getMessage();
}

It is necessary to transfer all data received from Paysera to the method WebToPay::checkResponse. It is required for the check of data integrity. If there is no parameter at all, or values of parameters are not equal, then WebToPayException exception will be invoked.

Parameter Length Necessary Description
sign_password 32 Yes Project password. You can find it when logged in to Paysera system with your user. Choose "service management" and then press "general settings".

After checking $_GET data, if everything is correct, it is necessary to return the answer. An example is shown above (echo 'OK';). Possible variants of answers:

OK <text>
The text indicated after the keyword OK will be sent back as a responsive message.
Example: "OK Thank you for sending" (the responsive message will be: "Thank you for sending").
NOSMS
The sender will not receive any answer in this case. You will be able to send it later, in one week.
WAPPUSH <url> <text>
The system will send the answer to the sender by the Wap Push method.
Example: "WAPPUSH http://www.address.com/services/link service description".

4. Sending of the response message.

You can send the answer in one week with libwebtopay function, if you do not deliver it immediately through OK <text>:

<?php

// Incduding libwebtopay library
require_once('libwebtopay/WebToPay.php');

try {
    // Validating data of processed payment.
    WebToPay::smsAnswer(array(
            // Unique message number in our system. You got it by message.
            'id'            => 0,

            // Responsive message
            'msg'           => 'Thank you for sending',

            // Generated project password from paysera.com system.
            'sign_password' => 'secret',

            // Path to file to which all requests will be logged
            // If you plan to use this feature, make sure that log file
            // is not accessible from outside.
            //'log'           => 'webtopay.log',
        ));
}
catch (Exception $e) {
    echo get_class($e).': '.$e->getMessage();
}

To integrate the system for MacroPayments we recommend to use our prepared open source library -libwebtopay . Library performs all required inspections of saveable, transmissible and receivable data.

Download the newest libwebtopay version in desirable format:

For libwebtopay to work successfully, file libwebtopay/WebToPay.php from archives is enough. Other files are meant for tests, examples and explanations. You can download libwebtopay/WebToPay.php file 1.2 version here:

You also can download versionable variant (from Mercurial VCS):

$ hg clone https://bitbucket.org/paysera/libwebtopay/

Attention: libwebtopay is suitable to use with both MicroPayments and MacroPayments.

You are able to test libwebtopay in demo mode. To run demo version in your web browser address bar add:

http://www.yourwebsiteurl.com/libwebtopay/demo/

Attention: mentioned way to demo folder would be different in adress, if you extracted archyve in other place.

Attention: to try demonstration, indicate your project ID from paysera.com website in projectid field. Demonstration will not be workable, if you try it from your computer (localhost).

Bellow you can find detailed specification of transmissible and receivable data, if you do not have an ability to use libwebtopay library.

Paysera sends the answer to your indicated address: callbackurl. Additional GET paremeters (list of description is below) are added to your indicated address callbackurl. All these parameters are transmissible with prefix wp_.

Parameter Description
to A short number the message was sent to.
sms Content of the SMS message with keyword and subkeyword (up to 160 symbols).
from Mobile number the message was received from.
operator Name of the mobile operator ("Bitė", "TELE2", "Omnitel", "Orange", "LMT" and etc).
amount Price of the message in cents. For example, 100 (1 lt), 500 (5 lt) and etc.
currency Payment currency (USD, EUR) you want the client to pay in. If the selected currency cannot be accepted by a specific payment method, the system will convert it automatically to the acceptable currency, according to the currency rate of the day. Payamount and paycurrency answers will be sent to your website.
country Double-figure country code. (LT, EE, LV, UA, RU and etc)
id Unique message number in our system.
_ss2 Parameter, which checks if you get the answer from our server. This is the most reliable way to check it.
_ss1 Parameter, which checks if you get the answer from our server. This is not as reliable as _ss2 to check it. You can download script example from here.
test The parameter, which allows to test the connection. The payment is not executed, but the result is returned immediately, as if the payment has been made. To test, it is necessary to activate the mode for a particular project by logging in and selecting: "Manage projects" -> "Payment gateway" (for a specific project) -> "Allow test payments" (check).
key Keyword