Answer the question
In order to leave comments, you need to log in
Understand the Yandex Money Payment Gateway plugin and connect it with Yandex?
I found a free plug-in for connecting payment via Yandex on the Internet, but there was a problem, I don’t know what to specify in the field
. I understand that there should be a name there, but I can’t fully figure out which one.
I am attaching part of the code, please help me figure it out
<?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
)
);
}
Answer the question
In order to leave comments, you need to log in
Good afternoon. In the Yandex.Money account, try specifying /?wc-api=WC_yandexmoney_gateway.
I suffered with the free version, but after payment, it returned to the main page of the site, and not to the page of the placed order, and the statuses changed badly.
Here they sell the plugin, the version is fully functional https://woohelp.ru/shop/plugin-yandeks-dengi-dlya-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question