shop-old/libs/billpay/example/php5/cancel.php
2026-04-20 01:03:43 +02:00

42 lines
1.1 KiB
PHP

<?php
session_start();
/**
* @author Jan Wehrs (jan.wehrs@billpay.de)
* @copyright Copyright 2010 Billpay GmbH
* @license commercial
*/
require_once '../../api/ipl_xml_api.php';
require_once '../../api/php5/ipl_cancel_request.php';
// This is the order reference from the capture request
$ref = $_GET["ref"];
$req = new ipl_cancel_request($_SESSION['api-url-base']);
$req->set_default_params($_SESSION['mid'], $_SESSION['pid'], $_SESSION['security-key']);
$req->set_cancel_params($ref, 27455, "EUR");
try {
$req->send();
if ($req->has_error()) {
echo "Error occured!<br />";
echo "Error code: " . $req->get_error_code() . "<br />";
echo "Merchant msg: " . utf8_decode($req->get_merchant_error_message()) . "<br />";
echo "Customer msg: " . utf8_decode($req->get_customer_error_message()) . "<br />";
}
else {
echo "Cancel successful<br />";
}
echo "<br /><br />";
echo "<strong>Request XML:</strong> " . htmlentities($req->get_request_xml());
echo "<br /><br />";
echo "<strong>Response XML:</strong> " . htmlentities($req->get_response_xml());
}
catch(Exception $e) {
echo $e->getMessage();
}
?>