1. Go to this page and download the library: Download tuutti/php-tupas 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/ */
tuutti / php-tupas example snippets
class YourBankClass implements \Tupas\Entity\BankInterface {
// Add ();
...
$form = new \Tupas\Form\TupasForm($bank);
$form->setCancelUrl('http://example.com/tupas/cancel')
->setRejectedUrl('http://example.com/tupas/rejected')
->setReturnUrl('http://example.com/tupas/return')
->setLanguage('FI');
foreach ($form->build() as $key => $value) {
// Your form logic should generate a hidden input field:
// <input type="hidden" name="$key", value="$value">
}
...
// You should always use the bank number (three first
// characters of B02K_TIMESTMP) to validate the bank.
// Something like:
$bank_number = substr($_GET['B02K_TIMESTMP'], 0, 3);
...
$tupas = new \Tupas\Tupas($bank, $_GET);
// Compare transaction id stored in a persistent storage against
// the one returned by the Tupas service.
if (!$tupas->isValidTransaction($_SESSION['transaction_id'])) {
// Transaction id validation failed.
}
try {
$tupas->validate();
}
catch (\Tupas\Exception\TupasGenericException $e) {
// Validation failed due to missing parameters.
}
catch (\Tupas\Exception\HashMatchException $e) {
// Validation failed due to hash mismatch.
}