Payment method with percent

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 年 前
Hello, I would need to create a plugin for the payment that applies a percentage discount off the total, but I could not figure out how to do this, can anyone give me some advice?

Thanks in advance
11 年 前
Sorry!
deleted.
11 年 前
if you want a fixed % of discount for that paymentgateway add a additional settings field in the payment gateway plugin so you can change it by configuring the paymentgateway plugin whenever you need to change.
then paymentprocesser.cs goto PostProcessPayment method and write the code for the discount.

decimal cartTotal = decimal.Zero;
            var cartItems = postProcessPaymentRequest.Order.OrderProductVariants;
            foreach (var item in cartItems)
            {
                var priceExclTax = item.PriceExclTax;
                cartTotal += priceExclTax;
            }

write the discount logic with cartTotal here.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.