Support » Plugin: Paystack WooCommerce Payment Gateway » HOW TO ADD TRANSACTIONS CHARGES AT CHECKOUT

  • Resolved ZaacWilliam

    (@omo9jatoja)


    Please how do i add the transaction charges which will go to @paystack to the product price at checkout?

    I’ve seen the code on github but yet i don’t know how/where to place it and how to start showing the @paystack charges of 1.5%+100ngn and more

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Tunbosun Ayinla

    (@tubiz)

    Presently it is not possible to add Paystack transaction charges to the order total in the Paystack WooCommerce plugin.

    ZaacWilliam

    (@omo9jatoja)

    Here is what i found on github

    <?php
    class PaystackCharge{
    public $percentage;
    public $additional_charge;
    public $crossover_total;
    public $cap;
    public $charge_divider;
    public $crossover;
    public $flatline_plus_charge;
    public $flatline;
    public function __construct($percentage = 0.015, $additional_charge = 10000, $crossover_total = 250000, $cap = 200000){
    $this->percentage = $percentage;
    $this->additional_charge = $additional_charge;
    $this->crossover_total = $crossover_total;
    $this->cap = $cap;
    $this->__setup();
    }
    private function __setup(){
    $this->charge_divider = $this->__charge_divider();
    $this->crossover = $this->__crossover();
    $this->flatline_plus_charge = $this->__flatline_plus_charge();
    $this->flatline = $this->__flatline();
    }
    private function __charge_divider(){
    return floatval(1 – $this->percentage);
    }
    private function __crossover(){
    return ceil(($this->crossover_total * $this->charge_divider) – $this->additional_charge);
    }
    private function __flatline_plus_charge(){
    return floor(($this->cap – $this->additional_charge) / $this->percentage);
    }
    private function __flatline(){
    return $this->flatline_plus_charge – $this->cap;
    }
    public function add_for_kobo($amountinkobo){
    if ($amountinkobo > $this->flatline)
    return $amountinkobo + $this->cap;
    elseif ($amountinkobo > $this->crossover)
    return ceil(($amountinkobo + $this->additional_charge) / $this->charge_divider);
    else
    return ceil($amountinkobo / $this->charge_divider);
    }
    public function add_for_ngn($amountinngn){
    return $this->add_for_kobo(ceil($amountinngn * 100)) / 100;
    }
    }

    But i don’t know where to use the mayb I’ll try using code snippet plugin if it be displaying changeprice for customers

    ZaacWilliam

    (@omo9jatoja)

    Have found a plugin to do that!
    I searched woocomerce extra charges on Google working fine in adding the 1.5% to fees but the additional 100naira which is waived for payment about 2000 was not waived and it was added for all.

    Simply because I’m using woo wallet payments for my site so then i just needed paystack for funding wallet so i added the 1.5% to the plugin then i fixed my woo wallet payment payment charges to 100 naira and made my minimum amount to fund wallet 2500.

    I wrote this to help others show some love too!

    The booster plugin does it better.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘HOW TO ADD TRANSACTIONS CHARGES AT CHECKOUT’ is closed to new replies.