Custom Payment Gateway

WCMp Vendor Membership

Custom Payment Gateway Open

Viewing 3 reply threads
  • Author
    Posts
    • #102095
      Espen Kvelland
      Participant

      Hello,
      We are Tanzania based marketplace and need to add Tanzania based payment gateway to add payments from customer and send payment to vendors after deducting admin commission. I can see there are by default 4 payment gateway listed: Paypal masspay, Paypal payout, Stripe connect and Direct bank transfer. Can you suggest me how to achieve it?

    • #102107
      Fantastic Kuhu
      Keymaster

      Hi @Espen,

      Thank you for reaching out to us.

      All the transactions is managed by WooCommerce. By default WooCommerce supports Bank Payment, Cheque Payment, COD, Credit card and PayPal. You may refer the knowledbase link for the general details
      https://wc-marketplace.com/knowledgebase/payment/ .

      In case you want to integrate any country specific WooCommerce Payment Gateway, that can be done via customization as it needs to be made compatible at vendor end as well.

      After going through the above link, please do let us know in case you want to get any specific information.

      Regards,

    • #102135
      Espen Kvelland
      Participant

      I have gone through this document: https://docs.google.com/document/d/1WrSMzalzzc4DUWyevGfWH6ZkE9X3un3eHX2wOO4oWu0/edit
      And trying to add “RazorPay” option in WCMP. I have installed “RazorPay” woo-commerce plugin and added key-id, and key-secret into woo-commerce settings, but still I am not able to see form fields in Vendors tab. I am attaching here the screenshot. please have a look in it and let me know your feedback, what I am missing here?

    • #102600
      samaresh
      Moderator

      Hi, there was a missing code, which will display the form-field under razorpay tab. I have updated the doc.
      Here is the coding snippet for you :

      add_action( 'settings_page_payment_razorpay_tab_init', function ($tab, $subsection ){
              new WCMp_Settings_Payment_Razor_Pay( $tab, $subsection );
          }, 10, 2);
      
      class WCMp_Settings_Payment_Razor_Pay {
      
          /**
           * Holds the values to be used in the fields callbacks
           */
          private $options;
          private $tab;
          private $subsection;
          private $razorpay_key_id;
          private $razorpay_key_secret;
      
          /**
           * Start up
           */
         public function __construct($tab, $subsection) {
              $this->tab = $tab;
              $this->subsection = $subsection;
              $this->options = get_option("wcmp_{$this->tab}_{$this->subsection}_settings_name");
              $razorpay_details = get_option('woocommerce_razorpay_settings');
              if (isset($razorpay_details['testmode']) && !empty($razorpay_details['testmode'])) {
                  $this->razorpay_key_id = $razorpay_details['testmode'];
              }
              if (isset($razorpay_details['key_id']) && !empty($razorpay_details['key_id'])) {
                  $this->razorpay_key_id = $razorpay_details['key_id'];
              }
              if (isset($razorpay_details['key_secret']) && !empty($razorpay_details['key_secret'])) {
                  $this->razorpay_key_secret = $razorpay_details['key_secret'];
              }
              $this->settings_page_init();
          }
      
          /**
           * Register and add settings
           */
          public function settings_page_init() {
              global $WCMp;
              $settings_tab_options = array("tab" => "{$this->tab}",
                  "ref" => &$this,
                  "subsection" => "{$this->subsection}",
                  "sections" => array(
                      "api_settings_section" => array("title" => __('API keys', 'dc-woocommerce-multi-vendor'), // Section one
                          "fields" => array(
                              "key_id" => array('title' => __('Key Id', 'dc-woocommerce-multi-vendor'), 'type' => 'password', 'id' => 'key_id', 'label_for' => 'key_id', 'name' => 'key_id', 'hints' => __('Key id, you will get this credential from razorpay account apikeys.', 'dc-woocommerce-multi-vendor')), // Text
                              "key_secret" => array('title' => __('Key Secret', 'dc-woocommerce-multi-vendor'), 'type' => 'password', 'id' => 'key_secret', 'label_for' => 'key_secret', 'name' => 'key_secret', 'hints' => __('Key Secret, you will get this credential from razorpay account apikeys.', 'dc-woocommerce-multi-vendor')), // Text
                          ),
                      ),
                  )
              );
      
              $WCMp->admin->settings->settings_field_withsubtab_init(apply_filters("settings_{$this->tab}_{$this->subsection}_tab_options", $settings_tab_options));
          }
      
          /**
           * Sanitize each setting field as needed
           *
           * @param array $input Contains all settings fields as array keys
           */
          public function wcmp_payment_razorpay_settings_sanitize_old($input) {
            
      
          $new_input = array();
      
              $hasError = false;
              
              if(isset($input['key_id'])){
                  $new_input['key_id'] = sanitize_text_field($input['key_id']);
              }
              
              if(isset($input['key_secret'])){
                  $new_input['key_secret'] = sanitize_text_field($input['key_secret']);
              }
      
              if (!$hasError) {
                  add_settings_error(
                          "wcmp_{$this->tab}_{$this->subsection}_settings_name", esc_attr("wcmp_{$this->tab}_{$this->subsection}_settings_admin_updated"), __('Razorpay Gateway Settings Updated', 'dc-woocommerce-multi-vendor'), 'updated'
                  );
              }
              return apply_filters("settings_{$this->tab}_{$this->subsection}_tab_new_input", $new_input, $input);
          }
      
      }
      Copy
Viewing 3 reply threads

Please LOGIN to reply to this topic

COVID-19 Outbreak: WCMp team is supporting business affected by coronavirus

Read the Message Buy at Slashed Price