Yeni sayfanın başlığı 621
VISA MASTER" .
"";
}
else if ($_REQUEST['json']) // If there is json in query string, then get transaction result.
{
$post = $_REQUEST['json'];
$post = preg_replace('/\\\"/',"\"", $post);
$result = json_decode($post, true);
echo "Sipariş Sonucu:
";
echo "
";
// If transaction is successful, finalize order.
if ($result['response']['state'] == 'success')
{
$string = $result['transaction']['external_id'];
$display = explode('-', $string);
$order_id = $display[1];
if ($result['transaction']['payment']['installment']['final_amount']) // installment payment response
{
$amount = $result['transaction']['payment']['installment']['amount'];
$currency = $result['transaction']['payment']['clearing']['currency'];
$final_amount = $result['transaction']['payment']['installment']['final_amount'];
$number = $result['transaction']['payment']['installment']['number'];
$order = new WC_Order( $order_id );
$order->payment_complete();
updateOrder($order_id, $final_amount);
global $woocommerce;
$woocommerce->cart->empty_cart();
echo "Teşekkür Ederiz.
Siparişiniz ve Ödemeniz Alınmıştır.
";
echo "Sipariş No: " . $order_id . "
";
echo "Taksitli ödeme miktarı: " . $amount . " " . $currency . " x " . $number . "
";
echo "Toplam: " . $final_amount;
}
else // single payment response
{
$amount = $result['transaction']['payment']['clearing']['amount'];
$currency = $result['transaction']['payment']['clearing']['currency'];
$order = new WC_Order( $order_id );
$order->payment_complete();
global $woocommerce;
$woocommerce->cart->empty_cart();
echo "Teşekkür Ederiz.
Siparişiniz ve Ödemeniz Alınmıştır.
";
echo "Sipariş No: " . $order_id . "
";
echo "Kredi kartınızdan çekilen miktarı: " . $amount . " " . $currency;
}
}
else if ($result['response']['state'] == 'failed') // If transaction is failed, show error message
{
echo "Ödeme Başarısız.
Lütfen Kart Bilgilerinizi ve Kredi Kartınızın Limitini Kontrol Ediniz.
";
}
}
/*
* Function updateOrder
*
* This function updates the order in database
* using wordpress database function
* if the transaction is installment transaction.
*
*/
function updateOrder($order_id, $final_amount) {
global $wpdb;
$wpdb->query(
"
UPDATE $wpdb->postmeta
SET meta_value = ". $final_amount ."
WHERE meta_key= '_order_total' AND post_id=" . $order_id
);
}
// İyzico Bitiş