Добавление Paytabs Express Checkout на страницу оформления заказа WooCommerce

Я пытаюсь добавить опцию Paytabs Express Checkout на страницу оформления WooCommerce, я хотел добавить ее в качестве способа оплаты, который доступен только для определенных стран.

Это все, что я получил до сих пор

/**
* Plugin Name: Paytabs Express Checkout
* Description: Add the Paytabs Express Checkout Option.
* Author:
* Version: 1.0
*/

@session_start();
//load plugin function when woocommerce loaded
add_action('plugins_loaded', 'woocommerce_paytabs_express_checkout_init', 0);

// Paytabs Express checkout function
function woocommerce_paytabs_express_checkout_init() {
// Extend WooCommerce payment options class
class WC_Gateway_Paytabs_express_checkout extends WC_Payment_Gateway{

public function __construct(){
$pluginpath          =   WC()->plugin_url();
$pluginpath          =   explode('plugins', $pluginpath);
$this->id            =   'paytabs_ec';
$this->icon          =   apply_filters( 'woocommerce_paytabs_icon', $pluginpath[0] . 'plugins/Paytabs-ExpressCheckout/icons/paytabs.png' );
$this->medthod_title =   'PayTabs Express Checkout';
$this->description   =   'Integrate PayTabs Express Checkout Option';
$this->has_fields    =   false;
// Init admin panel fields under woocommerce settings page
$this->init_form_fields();
$this->init_settings();

$this->title            = $this->settings['title'];
}

/**
* Initialize Gateway Settings Form Fields
*/
public function init_form_fields() {
$this->form_fields = array(
'enabled'   => array(
'title'   => __('Enable/Disable', 'PayTabs Express Checkout'),
'type'    => 'checkbox',
'label'   => __('Enable PayTabs Express Checkout .', 'PayTabs'),
'default' => 'no'),

'title'     => array(
'title'       => __('Title:', 'Credit Card payments powered by PayTabs.'),
'type'        => 'text',
'description' => __('PayTabs Express Checkout.', 'PayTabs'),
'default'     => __('PayTabs', 'PayTabs')),

'description' => array(
'title'       => __('Description:', 'PayTabs'),
'type'        => 'textarea',
'description' => __('Making any changes to the above may result in suspension or termination of your PayTabs Merchant Account.', 'PayTabs'),
'default'     => __('Pay securely by Credit or Debit card through PayTabs Secure Servers.', 'PayTabs')),
);
}

public function process_payment( $order_id ) {

$order = wc_get_order( $order_id );

// Mark as on-hold (we're awaiting the payment)
$order->update_status( 'on-hold', __( 'Awaiting payment', 'PayTabs' ) );

// Reduce stock levels
$order->reduce_order_stock();

// Remove cart
WC()->cart->empty_cart();

// Return thankyou redirect
return array(
'result'    => 'success',
'redirect'  => $this->get_return_url( $order )
);
}

} // End WC_Gateway_Paytabs_express_checkout Class

/**
* Add the Gateway to WooCommerce
**/
function woocommerce_add_paytabs_creditcard_wc_gateway($methods) {
$methods[] = 'WC_Gateway_Paytabs_express_checkout';
return $methods;
}
add_filter('woocommerce_payment_gateways', 'woocommerce_add_paytabs_creditcard_wc_gateway' );
}

добавлена ​​возможность оплаты через Paytabs, но теперь мне нужно запустить скрипт экспресс-оплаты (подробности здесь https://dev.paytabs.com/wp-content/uploads/paytabs-express-checkout-v3-documentation-v3.6.pdf )

0

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector