kirbi1996
@kirbi1996

Разобраться в плагине Yandex Money Payment Gateway и связать его с яндекс?

В интернете нашел бесплатный плагин для подключения оплаты через яндекс, но возникла проблема, не знаю что именно указать в поле
5a90d4c6b077f026248038.jpeg
Понимаю что там должно быть название но не могу до конца сообразить какое именно.
прилагаю часть кода, прошу помочь разобраться
<?php
/*
Plugin Name: Yandex Money Gateway for WooCommerce
Description: Yandex Money Gateway for WooCommerce.
Version: 1.0
Author: Dayes
*/

add_action('plugins_loaded', 'woocommerce_yandexmoney_init', 0);
define('yandexmoney_imgdir', WP_PLUGIN_URL . "/" . plugin_basename(dirname(__FILE__)) . '/');

load_plugin_textdomain('wc-yandexmoney', false, dirname(plugin_basename(__FILE__)) . '/languages/');

function woocommerce_yandexmoney_init(){
  if(!class_exists('WC_Payment_Gateway')) return;

    if( isset($_GET['msg']) && !empty($_GET['msg']) ){
        add_action('the_content', 'yandexmoney_showMessage');
    }
    function yandexmoney_showMessage($content){
            return '<div class="'.htmlentities($_GET['type']).'">'.htmlentities(urldecode($_GET['msg'])).'</div>'.$content;
    }

    /**
     * Gateway class
     */
  class WC_yandexmoney extends WC_Payment_Gateway{
    public function __construct(){
      $this->id 					= 'yandexmoney';
      $this->method_title 		= __('Yandex Money', 'wc-yandexmoney');
      $this->method_description	= __('Pay with Yandex.Money', 'wc-yandexmoney');
      $this->has_fields 			= false;
      $this->init_form_fields();
      $this->init_settings();
      $this->icon 			= yandexmoney_imgdir . 'logo.png';
            
      $this->title 			= $this->settings['title'];
      $this->redirect_page_id = $this->settings['redirect_page_id'];
      $this->liveurl 			= 'https://money.yandex.ru/quickpay/confirm.xml';
        

      $this->yandex_merchant_id      = $this->settings['yandex_merchant_id'];
      $this->yandex_secret         = $this->settings['yandex_secret'];
      $this->yandex_curs         = $this->settings['yandex_curs'];
      $this->yandex_order_desc         = $this->settings['yandex_order_desc'];			
      
      $this->description 		= $this->settings['description'];	
      
      $this->msg['message'] 	= "";
      $this->msg['class'] 	= "";
      
              
      
      //update for woocommerce >2.0
      add_action( 'woocommerce_api_' . strtolower( get_class( $this ) ), array( $this, 'check_yandexmoney_response' ) );
      
      if ( version_compare( WOOCOMMERCE_VERSION, '2.0.0', '>=' ) ) {
        /* 2.0.0 */
        add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( &$this, 'process_admin_options' ) );
      } else {
        /* 1.6.6 */
        add_action( 'woocommerce_update_options_payment_gateways', array( &$this, 'process_admin_options' ) );
      }
      
      add_action('woocommerce_receipt_yandexmoney', array(&$this, 'receipt_page'));
    }
    
    function init_form_fields(){
      $this->form_fields = array(
        'enabled' => array(
          'title' 		=> __('Enable/Disable', 'wc-yandexmoney'),
          'type' 			=> 'checkbox',
          'label' 		=> __('Enable Yandex Money Payment Module', 'wc-yandexmoney'),
          'default' 		=> 'no',
          'description' 	=> __('Show in the Payment List as a payment option', 'wc-yandexmoney')
        ),
      			'title' => array(
          'title' 		=> __('Title', 'wc-yandexmoney'),
          'type'			=> 'text',
          'default' 		=> __('Yandex Money', 'wc-yandexmoney'),
          'description' 	=> __('This controls the title which the user sees during the checkout', 'wc-yandexmoney'),
          'desc_yandexmoney' 		=> true
        ),
      			'description' => array(
          'title' 		=> __('Description', 'wc-yandexmoney'),
          'type' 			=> 'textarea',
          'default' 		=> __('Pay with Yandex Money', 'wc-yandexmoney'),
          'description' 	=> __('This controls the description which the user sees during the checkout', 'wc-yandexmoney'),
          'desc_yandexmoney' 		=> true
        ),
      			'yandex_merchant_id' => array(
                    'title'       => __('Yandex Money Wallet number', 'wc-yandexmoney'),
                    'type'        => 'text',
                    'value'       => '',
                    'description' => __( 'Enter the Wallet number of Yandex Money','wc-yandexmoney' ),
                    'default'     => '',
                    'desc_yandexmoney'    =>true,
                    'required'    =>true),
        'yandex_secret' => array(
                    'title'       => __('Secret word', 'wc-yandexmoney'),
                    'type'        => 'text',
                    'value'       => '',
                    'description' => __( 'Secret word can be found at https://money.yandex.ru/myservices/online.xml','wc-yandexmoney' ),
                    'default'     => '',
                    'desc_yandexmoney'    =>true,
                    'required'    =>true),
        'yandex_curs' => array(
                    'title'       => __('Currency rate', 'wc-yandexmoney'),
                    'type'        => 'text',
                    'value'       => '',
                    'description' => __( 'Enter the exchange rate against the currency of the sale of goods. If sold in rubles, exchange rate is 1.','wc-yandexmoney' ),
                    'default'     => '',
                    'desc_yandexmoney'    =>true,
                    'required'    =>true),
                'yandex_order_desc' => array(
                    'title'       => __('Order description', 'wc-yandexmoney'),
                    'type'        => 'text',
                    'value'       => '',
                    'description' => __( 'Text for the order description field', 'wc-yandexmoney' ),
          					'default'     => '',
          					'desc_yandexmoney'    => true,
                    'required'    => true
                   ),
      			
      			'redirect_page_id' => array(
          'title' 		=> __('Return page', 'wc-yandexmoney'),
          'type' 			=> 'select',
          'options' 		=> $this->yandexmoney_get_pages('Select page'),
          'description' 	=> __('URL of success page', 'wc-yandexmoney'),
          'desc_yandexmoney' 		=> true
                )
      );
    }
  • Вопрос задан
  • 1033 просмотра
Пригласить эксперта
Ответы на вопрос 2
@Desgrou
Добрый день. В кабинете Яндекс.Деньги попробуйте указать /?wc-api=WC_yandexmoney_gateway.
Я мучился с халявной версией, но после оплаты он возвращал на главную страницу сайта, а не на страницу оформленного заказа и статусы плохо менял.
Вот тут продают плагин, версия полностью функционирует https://woohelp.ru/shop/plagin-yandeks-dengi-dlya-...
Ответ написан
Комментировать
@vinni8
Я взял хорошо работающий и не дорогой вариант https://qner.ru/product/platezhnyj-shlyuz-yandex-m...
Советую
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы