BLIK mobile payments are an increasingly popular method of making payments on the e-commerce market.

This tutorial will help you understand the mechanism of this payment type and implement it correctly on your own site - without the need to redirect the client to external sites.

BLIK Level 0 payment mechanism

This is the simplest method of integration, consisting in putting the field for entering the six-digit BLIK code at your website.

  1. In the first place, you should display an additional "BLIK payment" button or add this method among other banks, e.g.



  2. After choosing the BLIK method, the client should be presented with a field in which he will be able to enter a six-digit code, generated in his mobile banking application and Tpay.com payment regulations.
  3. After confirming a Blik code, the action can be carried out by immediately forwarding it in the background and displaying the result or clicking the "I place order" button. The choice of solution depends on the technical capabilities of the store where the solution is implemented.
  4. At this stage of the order, our system will return information on whether the correct BLIK code has been entered and the payment confirmation pop-up has been displayed to the customer in his application.
  5. If everything went well, display the thank-you and allow you to re-pay by clicking the link to the transaction, as it is not yet known if the customer approved the payment on his device.
  6. After successful approval, the transaction will be finalized, the funds assigned to the seller's account, and notifications of a successful payment will be sent to the customer and the seller.

Technical explanation of BLIK Level 0 payment

  1. The BLIK transaction is performed by sending API requests. To start the integration you will need an API key and password, which should be generated in accordance with the instruction.
  2. While placing the order, the service should already have the customer's details, such as email address and name and surname, which will be required to prepare the transaction.
  3. The first step is to call the create method, which is used to generate an unpaid transaction with the BLIK channel (group parameter with a value of 150).
    This method generates and returns the title of the transaction in TR-XXX-XXXXXX format based on basic data such as amount, transaction description, customer's email and indicated payment group - in this case BLIK.
    An Example of this method can be found on the GitHub site in the PHP tpay-com library, and you can also do a test call by clicking "Try" in the documentation.
    The minimum set of parameters to be sent in this method:
    {
      "id": 1010,
      "amount": 13.99,
      "description": "Payment for order X",
      "md5sum": "6d6807ef9edd112bf09c1a9d10292ff6",
      "group": 150,
      "email": "[email protected]",
      "name": "john doe",
      "accept_tos": 1,
      "api_password": "p@$$w0rd#@!"
    }​
  4. The second step is to perform the blik method API call in which the transaction title generated in the first step and the BLIK code entered by the client will be sent.
    An example of the implementation of this method in PHP language can be found in the PHP library on the GitHub site.
    The parameter set (in JSON format) that should be sent in this case is:
    {
      "title": "TR-XXX-XXXXXX",
      "code": 123456,
      "api_password": "p@$$w0rd#@!"
    }​

    This method will return a positive result if the blik code entered is correct and it was possible to display the notification in the client's mobile application.
    The code that can be tested in the test mode is 123456.

  5. After successful payment confirmation by the customer, an asynchronous payment notification will be sent to the server's address, just like in the case of bank transfers. Read How to pick up POST notification for payment

BLIK ONE-CLICK payment mechanism

The one-click payment method is an extension of the level 0 payment, with the ability to remember the device that the customer most often uses to finalize the transaction. The user interface is extended by the option to pay with a new BLIK code (eg when a bank or mobile device is changed) or a saved device, just like after saving the payment card.

  1. Before starting this type of integration, you must complete the level 0 implementation steps, where the payment is done by entering the six-digit BLIK code on the store's website.
  2. In the one-click model, each logged-in user should have automatically generated a random string of characters (letters and numbers) that will be assigned to his account in the store. The aforementioned string of characters is called an alias that will identify him in subsequent purchases.
  3. A new customer who pays for the first time will have to enter a six-digit BLIK code, but with the option of associating the store with his banking application.
  4. After placing the order, as in the level 0 model, in the client's bank mobile application he will be prompted to approve the transaction, and then the question whether to remember the store in which he just made the payment.
  5. If the customer agrees, he will be able to pay for the next purchase by selecting his saved bank from the list. Using a generated alias, you can associate more than one banking application with the store, so always display the payment selection with a new or saved device.
  6. If he chooses a saved application, there is no need to enter any codes, and the prompt for accepting the transaction appears immediately after clicking "place an order".
  7. Every client has the option to remove the association of his banking application with a given store, so our system sends notifications to keep the list up to date.

Technical explanation of BLIK ONE CLICK payments

In comparison to the basic functionality (level 0), where the title of the transaction and the code entered by the customer is sent in API request, in the one-click model, a data table containing information about the customer alias must be added to your database. Alias is a random string of characters and numbers assigned to the user's account, which is identified when attempting to make a payment without the need to enter a blik code.

  1. The first payment of the client using the BLIK method must take place by entering the six-digit BLIK code - the same as in the level 0 model, but additionally, a checkbox must be made available to decide whether its application is to be remembered. If the client agrees, the implementation of the blik API method will be extended by a set of additional parameters:
    {
      "title": "TR-XXX-XXXXXX",
      "code": 123456,
      "api_password": "p@$$w0rd#@!",
      "alias": [
        {
          "value": "TPAY_TEST_ALIAS_REGISTER",
          "type": "UID",
          "label": "shoes shop NY"
        }
      ]
    }​

    In the above example, test values are sent but in production mode, they should be replaced:

    • value - a parameter in which we send the value of the alias assigned to the user in the integrated store,
    • label - is the name under which the store will be remembered in the client's mobile application,
    • type - currently only "UID" - "user identificator" is supported.
  2. After confirming the transaction, the customer will receive an additional message in the banking application, allowing the store to be saved. If he agrees, our system will send an asynchronous POST notification to the store's address (defined in the merchant panel), with information on saving the alias, which must be updated in the database
  3. If the returning customer already has a registered banking application, it is enough to send the parameters without the blik code (there is no need to enter it):
    {
      "title": "TR-XXX-XXXXXX",
      "api_password": "p@$$w0rd#@!",
      "alias": [
        {
          "value": "TPAY_TEST_ALIAS",
          "type": "UID",
          "label": "shoes shop NY"
        }
      ]
    }​

    If for some reason you will not be able to display the payment pop-up - for example, a device with a saved application will not have access to the Internet at the moment, after the error is returned by our API you should allow re-payment but this time with the BLIK code - as in the level 0 model.

  4. If the alias has been registered in more than one banking application, our system will return information - err: ERR82 indicating its ambiguity.
    The data returned by our API will have the following format:
    {
      "result": 0,
      "availableUserApps": [
        {
          "applicationName": "My first associated bank",
          "applicationCode": 1
        },
        {
          "applicationName": "My second associated bank",
          "applicationCode": 2
        }
      ],
      "err": "ERR82"
    }​
    In this situation, an additional choice should be displayed to the client (eg a drop-down list), where he will be able to specify from which bank he wants to make a payment.
    Then the same alias should be sent, extended to the user's key:
    {
      "title": "TR-XXX-XXXXXX",
      "api_password": "p@$$w0rd#@!",
      "alias": [
        {
          "value": "TPAY_TEST_ALIAS",
          "type": "UID",
          "label": "shoes shop NY",
          "key": 2
        }
      ]
    }​​