Skip to main content

Getting started

To be able to use and test payment gateway you need to have Client ID and Client secret from TB developer portal. To obtain these tokens you need to register in developer portal, for more info, please visit Developer portal documentation.

Installation

To install API client you need to install tatrapayplus-node package.

npm i @tatrabanka/tatrapayplus-node

Test installation

You can test your installation with this minimal working setup.

  1. If you haven’t already, create an Account and Application in TB developer portal.

  2. Copy the following code into a new file test_tb.mjs. Replace API_KEY, API_SECRET and REDIRECT_URI with values from your account.

    import { TBPlusSDK } from "@tatrabanka/tatrapayplus-node";

    const API_KEY = "REPLACE FROM TB PORTAL";
    const API_SECRET = "REPLACE FROM TB PORTAL";
    const REDIRECT_URI = "REPLACE FROM TB PORTAL";
    const sdk = new TBPlusSDK(API_KEY, API_SECRET, "192.0.2.123");
    const { data } = await sdk.createPayment(
    {
    bankTransfer: {},
    basePayment: {
    endToEnd: "/VS0123456789/SS0123456789/KS123456",
    instructedAmount: {
    amountValue: 10,
    currency: "EUR",
    },
    },
    },
    REDIRECT_URI,
    );
    console.log(JSON.stringify(data));
  3. Run: node test_tb.mjs

  4. If the command is successful, you’ll see the API response in JSON format like this:

    {
    "paymentId": "fcdab2d3-f471-4434-8834-df3cebdab03d",
    "tatraPayPlusUrl": "https://api.tatrabanka.sk/tatrapayplus/sandbox/v1/auth?paymentId=xxxx&client_id=xxxx&hmac=xxxx",
    "availablePaymentMethods": [
    {
    "isAvailable": true,
    "paymentMethod": "CARD_PAY"
    },
    {
    "isAvailable": true,
    "paymentMethod": "PAY_LATER"
    },
    {
    "isAvailable": true,
    "paymentMethod": "BANK_TRANSFER"
    },
    {
    "isAvailable": true,
    "paymentMethod": "QR_PAY"
    }
    ]
    }
  5. You can copy and paste tatraPayPlusUrl to you preferred browser, and you should see Tatrapay+ payment gateway. 🎉