📁 PHP Dosya Yöneticisi
/
/
home
/
demodesigncom
/
e-ticaretv9.demodesign.com.tr
/
includes
/
modules
/
paytr
📝
paytr.php
← Geri Dön
<?php function paytr($o_id,$address,$kimlik,$isim,$soyisim,$telefon,$email,$price) { $db = new DB(); $paytr_api = $db->table('virtual_pos')->where('id','=',1)->get_var('api_json'); $paytr_api = json_decode($paytr_api,true); $merchant_id = $paytr_api['merchant']['value']; $merchant_key = $paytr_api['key']['value']; $merchant_salt = $paytr_api['salt']['value']; $success_url = ''.SITE_DOMAIN.'/payment-result/success'; $fail_url = ''.SITE_DOMAIN.'/payment-result/error'; $price = str_replace(',','.',$price); $price = str_replace('.','',$price); $user_basket = base64_encode(json_encode(array( array("Sipariş", "$price", 1), ))); $user_ip=m_ip(); $timeout_limit = "15"; $debug_on = 0; $test_mode = $paytr_api['test_mode']['value']; $no_installment = 1; $max_installment = 0; $currency = "TL"; $hash_str = $merchant_id .$user_ip .$o_id .$email .$price .$user_basket.$no_installment.$max_installment.$currency.$test_mode; $paytr_token=base64_encode(hash_hmac('sha256',$hash_str.$merchant_salt,$merchant_key,true)); $post_vals=array( 'merchant_id'=>$merchant_id, 'user_ip'=>$user_ip, 'merchant_oid'=>$o_id, 'email'=>$email, 'payment_amount'=>$price, 'paytr_token'=>$paytr_token, 'user_basket'=>$user_basket, 'debug_on'=>$debug_on, 'no_installment'=>$no_installment, 'max_installment'=>$max_installment, 'user_name'=>''.$isim.' '.$soyisim.'', 'user_address'=>$address, 'user_phone'=>$telefon, 'merchant_ok_url'=>$success_url, 'merchant_fail_url'=>$fail_url, 'timeout_limit'=>$timeout_limit, 'currency'=>$currency, 'test_mode'=>$test_mode ); $ch=curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.paytr.com/odeme/api/get-token"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1) ; curl_setopt($ch, CURLOPT_POSTFIELDS, $post_vals); curl_setopt($ch, CURLOPT_FRESH_CONNECT, true); curl_setopt($ch, CURLOPT_TIMEOUT, 20); curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false); $result = @curl_exec($ch); curl_close($ch); $result=json_decode($result,1); if($result['status']=='success') { $token=$result['token']; $return = ' <script src="https://www.paytr.com/js/iframeResizer.min.js"></script> <iframe src="https://www.paytr.com/odeme/guvenli/'.$token.'" id="paytriframe" frameborder="0" scrolling="no" style="width: 100%;" onload="iFrameResize({log:true})"></iframe> <script>iFrameResize({},"#paytriframe");</script>'; } else { $return = m_alert(LG_ERROR,LG_PAYMENT_RESULT_POS_TECHNICAL_ERROR); } return $return; } ?>
💾 Kaydet
İptal
📝 Yeniden Adlandır
İptal
Kaydet
🔐 Dosya İzinleri (chmod)
İzin Değeri:
Hızlı Seçim:
777
755
644
600
777
= Herkes okur/yazar/çalıştırır
755
= Sahip tam, diğerleri okur/çalıştırır
644
= Sahip okur/yazar, diğerleri okur
600
= Sadece sahip okur/yazar
İptal
Uygula