定期付款 2Checkout .NET Api

Recurring Payment 2Checkout .NET Api

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

我得到了答案。要通过付款 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);
    }

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