megauser Posted January 22, 2020 Report Share Posted January 22, 2020 Кто сталкивался с платежной системой PayKeeper? Закинул модуль в папку payment Добавил способ оплаты, все отлично, при попытке заказа пишет что к оплате, (сумма) А самой кнопки оплатить нет. Quote Link to post Share on other sites
megauser Posted January 22, 2020 Author Report Share Posted January 22, 2020 <?php require_once('api/Simpla.php'); class PayKeeper extends Simpla { public function checkout_form($order_id, $button_text = null) { if(empty($button_text)) $button_text = 'Перейти к оплате'; $order = $this->orders->get_order((int)$order_id); $payment_method = $this->payment->get_payment_method($order->payment_method_id); $payment_settings = $this->payment->get_payment_settings($payment_method->id); $price = $this->money->convert($order->total_price, $payment_method->currency_id, false); $success_url = $this->config->root_url.'/order/'.$order->url; $fail_url = $this->config->root_url.'/order/'.$order->url; ////////////////////////////////////// $phone = preg_replace('/[^\d]/', '', $order->phone); $phone = substr($phone, -min(10, strlen($phone)), 10); $clientid = $order->user_id; $formdata = array( "phone" => $phone, "clientid" => $clientid, "sum" => number_format($price, 2,'.',''), "orderid" => $order_id ); //build the post string $poststring = ""; foreach($formdata as $key => $val){ $poststring .= urlencode($key) . "=" . urlencode($val) . "&"; } // strip off trailing ampersand $poststring = substr($poststring, 0, -1); $url = $payment_settings['PAYKEEPER_PAYMENT_FORM_URL']; $html = ''; if( function_exists( "curl_init" )) { $CR = curl_init(); curl_setopt($CR, CURLOPT_URL, $url); curl_setopt($CR, CURLOPT_POST, 1); curl_setopt($CR, CURLOPT_FAILONERROR, true); curl_setopt($CR, CURLOPT_POSTFIELDS, $poststring); curl_setopt($CR, CURLOPT_RETURNTRANSFER, 1); curl_setopt($CR, CURLOPT_SSL_VERIFYPEER, 0); $result = curl_exec( $CR ); $error = curl_error( $CR ); if( !empty( $error )) { $html = "<br/><span class=message>"."INTERNAL ERROR:".$error."</span>"; return false; } else { $html = $result; } curl_close( $CR ); } else { $payment_parameters = http_build_query(array( "clientid"=>$clientid, "orderid"=>$order_id, "sum"=>number_format($price, 2,'.',''), "phone"=>$phone)); $options = array("http"=>array( "method"=>"POST", "header"=>"Content-type: application/x-www-form-urlencoded", "content"=>$payment_parameters )); $context = stream_context_create($options); $html = file_get_contents($url, false, $context); } ////////////////////////////////////// $button = $html; return $button; } } Файл PayKeeper.php Quote Link to post Share on other sites
simpla24 Posted January 22, 2020 Report Share Posted January 22, 2020 Судя по коду, контент подтягивается из настроек: $payment_settings['PAYKEEPER_PAYMENT_FORM_URL']; а что указано в этом поле? Quote Link to post Share on other sites
megauser Posted January 23, 2020 Author Report Share Posted January 23, 2020 (edited) Судя по коду, контент подтягивается из настроек: $payment_settings['PAYKEEPER_PAYMENT_FORM_URL']; а что указано в этом поле? Ссылка на сервер их, где форма данная Edited January 23, 2020 by megauser Quote Link to post Share on other sites
simpla24 Posted January 23, 2020 Report Share Posted January 23, 2020 сложно так сказать. Скиньте адрес сайта, может в коде чего видно будет Quote Link to post Share on other sites
mishanya Posted January 24, 2020 Report Share Posted January 24, 2020 может у вас cUrl не настроен? if( function_exists( "curl_init" )) { Quote Link to post Share on other sites
megauser Posted January 24, 2020 Author Report Share Posted January 24, 2020 может у вас cUrl не настроен? if( function_exists( "curl_init" )) { а где он настраивается? на стороне клиента? ну в Личном кабинете PayKeeper? Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.