Я сделал пользовательский платежный шлюз Woocommerce, и все работает до тех пор, пока я не вернусь на веб-сайт с ответом API от ссылки на внешний платеж.Я получаю -1 пустую страницу, и состояние сети составляет 400 ошибок (неверный запрос).Любая помощь ценит это.Спасибо
$this->notify_url = str_replace( 'https:', 'http:', add_query_arg( 'wc-api', 'pm_wc_ncm', home_url( '/' ) ) );
add_action( 'woocommerce_api_pm_wc_ncm', array( $this, 'check_notify_response' ) );
function check_notify_response(){
if (isset($_POST['txtIndex'])) {
$order_id = $_POST['txtIndex'];
$order = new WC_Order($order_id);
$order_total = $order->get_total();
$amount_paid = $_POST['txtAmount'];
$RespVal = $_POST['RespVal'];
$RespMsg = $_POST['RespMsg'];
$txtIndex = $_POST['txtIndex'];
$txtMerchNum = $_POST['txtMerchNum'];
$txtNumAut = $_POST['txtNumAut'];
$Signature = $_POST['signature'];
$txtCurrency = $_POST['txtCurrency'];
$sha = $this->sha_key;
$SignatureElts = $txtMerchNum . $order_id . $amount_paid . $txtCurrency . $txtNumAut . $RespVal . $RespMsg . $sha;
$ReturnSignature = hash('sha256', $SignatureElts);
if ($ReturnSignature != $Signature) {
echo "Security violation was detected! <br>";
echo "Order ID: ".$txtIndex."<br>";
$message1 = "Signature error";
if (function_exists('wc_add_notice')) {
wc_add_notice($message1, 'error');
}
}else{
if($RespVal=="1")
{
echo "Your Transaction was successful <br>";
echo "Order ID: ".$txtIndex."<br>";
echo "Authorization no.: ".$txtNumAut."<br>";
echo "Amount: ".$amount_paid."<br>";
}
elseif ($RespVal=="0")
{
echo "Unfortunately your transaction was refused <br>";
echo "Order ID: ".$txtIndex."<br>";
echo "Amount: ".$amount_paid."<br>";
}
}
}
}