1. Go to this page and download the library: Download tpay-com/tpay-openapi-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
$cache = /*Your Cache Implementation. Preferably PSR\Cache implementation, because it will be used in future by this library. */;
$tpayApiKey = $cache->get('example_YOUR_TPAY_API_TOKEN_KEY');
$tpayApi = new TpayApi($clientId, $clientSecret, true, 'read');
//if your cache returned a token, set it to TpayApi
if($tpayApiKey !== null){
$tpayApiKey->setCustomToken(unserialize($tpayApiKey));
} else {
//if not, get new token and cache it for given time
//as you can notice, we slightly shorten token validity time to avoid using almost invalid token
$tpayApi->authorization();
$cache->set('example_YOUR_TPAY_API_TOKEN_KEY', serialize($tpayApi->getToken()), $tpayApiKey->getToken()->expires_in->getValue() - 10);
}
$transactions = $tpayApi->Transactions->getTransactions();
// Any time you construct the class providing payment forms, you can pass the language in constructor
$paymentForms = new PaymentForms('pl');
// After this line all static messages (input labels, buttons titles etc.) will be displayed in Polish
// If you want to access translations manually, use:
$lang = new Lang();
$lang->setLang('pl'); // for setting language
$lang->lang('pay'); // to echo translated key
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.