Ejemplo n.º 1
0
<?php

include dirname(__FILE__) . "/../common/header.php";
require dirname(__FILE__) . "/../../payzippy-sdk/ChargingResponse.php";
// This file corresponds to your Charging Response Callback URL.
// Create an instance of the ChargingResponse using the GET parameters
// returned to the callback URL.
$pz_charging_response = new ChargingResponse(array_merge($_POST, $_GET));
$transaction_success = $pz_charging_response->is_transaction_successful();
$transaction_status = $pz_charging_response->get_transaction_status();
$transaction_response_message = $pz_charging_response->get_transaction_response_message();
$transaction_response_code = $pz_charging_response->get_transaction_response_code();
if ($transaction_success) {
    echo "<p class='text-success'><b>";
} else {
    echo "<p class='text-error'><b>";
}
echo "Transaction Status : {$transaction_status}<br/>";
echo "Transaction Response Code : {$transaction_response_code}<br/>";
echo "Transaction Response Message : {$transaction_response_message}<br/>";
echo "</b></p>";
// To check the validity of the response, call the validate function on
// the ChargingResponse object. It verifies the hash returned in the response.
$hash_match = $pz_charging_response->validate();
if ($hash_match) {
    echo "<p class='text-success'><b>Hash matches. The response is valid.</b></p>";
} else {
    echo "<p class='text-error'><b>Hash mismatch. Response is invalid</b></p>";
}
echo "<h4>Charging Response</h4>";
echo "Merchant ID: {$pz_charging_response->get_merchant_id()}<br/>";