<?php require_once "../lib/GestPayCryptWS.php"; $gestpay = new GestPayCryptWS(); $gestpay->setShopLogin("SHOP ID"); // Es. 9000001 $gestpay->setShopTransactionID("SHOP TRANSACTION ID"); // Identificativo transazione. Es. "34az85ord19" $gestpay->setAmount("0.05"); // Importo. Es.: 1256.50 $gestpay->setCurrency("242"); // Codice valuta. 242 = euro $gestpay->setTestEnv(true); if (!$gestpay->encrypt()) { throw new Exception("Error: " . $gestpay->getErrorCode() . ": " . $gestpay->getErrorDescription()); } header("Location: " . $gestpay->getRedirectUrl());
<?php require_once "../lib/GestPayCryptWS.php"; if (empty($_GET["a"])) { throw new Exception("Parametro mancante: 'a'"); } if (empty($_GET["b"])) { throw new Exception("Parametro mancante: 'b'"); } $gestpay = new GestPayCryptWS(); $gestpay->setShopLogin($_GET["a"]); $gestpay->setEncryptedString($_GET["b"]); $gestpay->setTestEnv(true); if (!$gestpay->decrypt()) { throw new Exception("Error [" . $gestpay->getErrorCode() . "]: " . $gestpay->getErrorDescription()); } $result = $gestpay->getTransactionResult(); if ($result == "XX") { echo "Esito transazione sospeso (pagamento tramite bonifico)\n"; } elseif ($result == "KO") { echo "Esito transazione negativo\n"; } elseif ($result == "OK") { echo "Esito transazione positivo\n"; } else { echo "Esito transazione indefinito\n"; }