【问题标题】:Recurring Payment 2Checkout .NET Api定期付款 2Checkout .NET Api
【发布时间】:2015-08-29 03:09:43
【问题描述】:

我使用 2Chechout 创建了一个沙盒帐户,并按照.NET tutorial 了解如何创建销售。我似乎找不到任何关于如何使用相同的 api 创建经常性销售的文档。谁能举个例子?

【问题讨论】:

    标签: .net asp.net-mvc model-view-controller 2checkout


    【解决方案1】:

    我得到了答案。要通过 Payment API 传递定期销售,您需要完全省略“total”参数,而是使用“charge”数组的子对象传递定期订单项。

    从 2Checkout 编辑的示例:

        TwoCheckoutConfig.SellerID = "901248156";
        TwoCheckoutConfig.PrivateKey = "8CE03B2D-FE41-4C53-9156-52A8ED5A0FA3";
        // TwoCheckoutConfig.Sandbox = true;    #Uncomment to use Sandbox
    
        try
        {
            var Billing = new AuthBillingAddress();
            Billing.addrLine1 = "123 test st";
            Billing.city = "Columbus";
            Billing.zipCode = "43123";
            Billing.state = "OH";
            Billing.country = "USA";
            Billing.name = "Testing Tester";
            Billing.email = "example@2co.com";
            Billing.phoneNumber = "5555555555";
    
            var LineItem = new AuthLineitem();
            LineItem.duration = "Forever";
            LineItem.name = "Recurrencing Item Name";
            LineItem.price = (decimal)10.00;
            LineItem.productId = "12345";
            LineItem.quantity = 1;
            LineItem.startupFee = (decimal)10.00;
            LineItem.recurrence = "1 Month";
            LineItem.tangible = "N";
            LineItem.type = "product";
    
            var LineItems = new List<AuthLineitem>();
            LineItems.Add(LineItem);
    
            var Customer = new ChargeAuthorizeServiceOptions();
            //Customer.total = (decimal)1.00; --> omit this
            Customer.currency = "USD";
            Customer.merchantOrderId = "123";
            Customer.billingAddr = Billing;
            Customer.token = Request["token"];
            Customer.lineItems = LineItems; // --> add this
    
            var Charge = new ChargeService();
    
            var result = Charge.Authorize(Customer);
            Console.Write(result);
        }
        catch (TwoCheckoutException e)
        {
            Console.Write(e);
        }
    

    这应该适用于经常性销售。

    【讨论】:

    • Charge.Authorize(Customer) 出错;错误:“值不能为空。参数名称:s”
    猜你喜欢
    • 2019-11-25
    • 2013-12-26
    • 2014-04-25
    • 2011-09-16
    • 2012-04-05
    • 2012-03-13
    • 2020-02-09
    • 2011-01-27
    • 2013-03-21
    相关资源
    最近更新 更多