【问题标题】:How to pass discount amount to Authorize.Net如何将折扣金额传递给 Authorize.Net
【发布时间】:2018-05-17 15:59:01
【问题描述】:

我想通过折扣(优惠券)金额在 C# 中授权 .net, 当我在具有负值($-30)的订单项中传递折扣金额时,我收到错误消息。没有折扣码一切正常

例子:

1   Item1   10  N   US $24.95   US $249.50

Discount:       US $-30.00
Total:      US $219.50

var transactionRequest = new transactionRequestType
            {
                transactionType = transactionTypeEnum.authCaptureTransaction.ToString(),   // charge the card
                amount = order.LineItems.Sum(od => od.UnitPrice * od.Quantity),
                lineItems = lineItems,
                order = new orderType { invoiceNumber = order.Orderid, description = order.OrderDescription },
                customer = new customerDataType { id = order.customerdetails.Customerid, email = order.customerdetails.CustomerEmail },
                currencyCode = order.CurrencyCode
            };

我怎样才能做到这一点?

【问题讨论】:

    标签: c# payment-gateway payment authorize.net


    【解决方案1】:

    您有一个字符串输入,必须将字符串解析为一个数值:

    string input = "1   Item1   10  N   US $24.95   US $249.50";
    
    string[] array = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    
    decimal amount = decimal.Parse(array[7], System.Globalization.NumberStyles.Currency);
    
    decimal discount = amount - 30;
    

    【讨论】:

    • 我有单独的折扣金额值,我想将它与订单项一起传递。
    • 解释得更好。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-13
    • 2019-02-21
    • 1970-01-01
    • 2014-02-12
    • 2012-09-08
    • 1970-01-01
    相关资源
    最近更新 更多