Claim your freedom to choose the perfect partner for your multi-vendor journey.

FREEDOM25

Celebrate the festive season by giving your marketplace a powerful lift!

FESTIVE20

5.0.0
Multi-store. Franchise. Facilitator. AI tools.
Everything your marketplace needs - now in one platform.
Power your marketplace dreams with unbeatable Black Friday deals!

MVXBLACK30

Supercharge your marketplace vision with unstoppable Cyber Monday deals!

MVXCYBER30

Holiday cheer, bigger savings
Take 25% off-because your marketplace deserves a gift too.

happyholiday

Help me complete my Custom Vendor Payment Method Customization

Resolved
Viewing 2 reply threads
  • Author
    Posts
    • #189497
      kevajo
      Participant

      Good morning

      I’m trying to create a personalized payment method for sellers because available payments are not active with us.

      Here is my code, I need help from anyone to add my personalized payment method.

      This code I placed in function.php of my child theme

      // Addition of Mobile money for merchant payment
      add_filter(‘automatic_payment_method’,function($payment_methods) {
      $payment_methods[‘mobile_money’] = ‘Mobile Money’;
      return $payment_methods;
      });

      add_filter(‘wcmp_vendor_payment_mode’, ‘payment_mode’);
      function payment_mode($r){
      $payment_admin_settings = get_option(‘wcmp_payment_settings_name’);
      if (isset($payment_admin_settings[‘payment_method_mobile_money’]) && $payment_admin_settings[‘payment_method_mobile_money’] = ‘Enable’) {
      $r[‘mobile_money’] = __(‘Mobile money’, ‘multivendorx’);
      }
      return $r;
      }

      add_filter(“settings_vendors_payment_tab_options”, ‘admin_values’, 10, 2);
      function admin_values( $payment_tab_options, $vendor_obj ){
      $payment_tab_options[‘vendor_mobile_money_name’] = array(‘label’ => __(‘Mobile Money Name’, ‘multivendorx’), ‘type’ => ‘text’, ‘id’ => ‘vendor_mobile_money_name’, ‘label_for’ = > ‘vendor_mobile_money_name’, ‘name’ => ‘vendor_mobile_money_name’, ‘value’ => $vendor_obj->mobile_money_name, ‘wrapper_class’ => ‘payment-gateway-mobile_money payment-gateway’);

      $payment_tab_options[‘vendor_mobile_money_type’] = array(‘label’ => __(‘Account type’, ‘multivendorx’), ‘type’ => ‘select’, ‘id’ => ‘vendor_mobile_money_type’, ‘label_for’ => ‘vendor_mobile_money_type’, ‘name’ => ‘vendor_mobile_money_type’, ‘options’ => array(‘orange’ => __(‘Orange’, ‘multivendorx’), ‘mtn’ => __(‘Mtn’, ‘multivendorx’ ), ‘moov’ => __(‘Moov’, ‘multivendorx’)), ‘value’ => $vendor_obj->mobile_money_type, ‘wrapper_class’ => ‘payment-gateway-mobile_money payment-gateway’);

      $payment_tab_options[‘vendor_mobile_money_number’] = array(‘label’ => __(‘Account type’, ‘multivendorx’), ‘type’ => ‘text’, ‘id’ => ‘vendor_mobile_money_number’, ‘label_for’ => ‘vendor_mobile_money_number’, ‘name’ => ‘vendor_mobile_money_number’, ‘value’ => $vendor_obj->mobile_money_number, ‘wrapper_class’ => ‘payment-gateway-mobile_money payment-gateway’);
      return $payment_tab_options;
      }

      //storing data of vendor mobile money account

      add_filter(‘mvx_vendor_user_fields’,function ($fields,$user_id){
      $vendor = new WCMp_Vendor($user_id);
      $fields[“vendor_mobile_money_name”] = array(
      ‘label’ => __(‘Mobile Money Name’, ‘multivendorx’),
      ‘type’ => ‘text’,
      ‘value’ => $vendor->mobile_money_name,
      ‘class’ => “user-profile-fields-regular-text”
      ); // Text
      $fields[“vendor_mobile_money_type”] = array(
      ‘label’ => __(‘Mobile Money Type’, ‘multivendorx’),
      ‘type’ => ‘select’,
      ‘options’ => array(‘orange’ => __(‘Orange’, ‘multivendorx’), ‘mtn’ => __(‘Mtn’, ‘multivendorx’), ‘moov’ => __(‘Moov’, ‘multivendorx’)),
      ‘value’ => $vendor->mobile_money_type,
      ‘class’ => “user-profile-fields-regular-text”
      ); // Text
      $fields[“vendor_mobile_money_number”] = array(
      ‘label’ => __(‘Mobile Money Number’, ‘multivendorx’),
      ‘type’ => ‘text’,
      ‘value’ => $vendor->mobile_money_number,
      ‘class’ => “user-profile-fields-regular-text”
      ); // Text
      return $fields;
      },10,2);

      The second part
      source code: class-mvx-gateway-mobile_money.php
      ————————————————– —–
      <?php
      /**
      * The template for displaying vendor payment content
      *
      * Override this template by copying it to yourtheme/MultivendorX/vendor-dashboard/vendor-custom-payment-details.php
      *
      * @author Kevajo webmaster
      * @package MVX/Templates
      * @version 2.2.0
      */
      if (!defined(‘ABSPATH’)) {
      exit;
      }

      class MVX_Gateway_Mobile_Money extends MVX_Payment_Gateway {

      public $id;
      public $message = array();
      public $gateway_title;
      public $payment_gateway;

      public function __construct() {
      $this->id = ‘mobile_money’;
      $this->gateway_title = __(‘Mobile Money’, ‘multivendorx’);
      $this->payment_gateway = $this->id;
      //$this->enabled = get_mvx_global_settings(‘payment_method_mobile_money’, ‘payment’);
      $this->enabled = mvx_is_module_active(‘payment_method_mobile_money’)? ‘Enable’: ”;
      }

      public function gateway_logo() { global $MVX; return $MVX->plugin_url . ‘assets/images/’.$this->id.’.png’; }

      public function process_payment($vendor, $commissions = array(), $transaction_mode = ‘auto’) {
      $this->vendor = $vendor;
      $this->commissions = $commissions;
      $this->currency = get_woocommerce_currency();
      $this->transaction_mode = $transaction_mode;
      if ($this->validate_request()) {
      $this->record_transaction();
      if ($this->transaction_id) {
      return array(‘message’ => __(‘New transaction has been initiated’, ‘multivendorx’), ‘type’ => ‘success’, ‘transaction_id’ => $this->transaction_id);
      }
      } else {
      return $this->message;
      }
      }

      here is the result, the payment method is displayed but the fields to fill in the information are not displayed and also on the seller side when you navigate in “storefront” and “vendor-billing” you receive an error.
      Thank you for helping us.
      Please let me know if there are any errors or codes that I need to complete

      check video : https://www.loom.com/share/f91657671bcc447a98c9c41eff0bfe77

    • #189513
      kevajo
      Participant

      I have successfully added and set up custom seller payments.
      Everything is going well on the seller’s side, the seller manages to choose the personalized payment methods and fill in the information in the fields.
      But on the admin side, when you go to seller, the personalized payment methods appear but the fields to fill in the information do not appear.
      No errors appearing on the site.

      Help me please.
      Could be a misnamed function or something else.
      Below is an illustrative video :https://www.loom.com/share/02bb0d35b5aa44549ca0352a1b5a6002

    • #189551

      Thank you for reaching out to us . As shared earlier on this thread https://multivendorx.com/support-forum/topic/adding-a-custom-seller-payment-method/#post-189279
      We are very sorry to inform you that as you are asking help for your custom payment gateway, which requires custom coding support. This is beyond our support policy . However you can seek help from our custom development team by sending a mail on custom.dev@multivendorx.com

Viewing 2 reply threads
  • The topic ‘Help me complete my Custom Vendor Payment Method Customization’ is closed to new replies.
Shopping Cart
Scroll to Top