1

2Chechout でサンドボックス アカウントを作成し、セールの作成方法に関する.NET チュートリアルに従いました。同じ API を使用して定期的な販売を作成する方法に関するドキュメントが見つからないようです。誰でも例を挙げてもらえますか?

4

1 に答える 1

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);
    }

これは定期的な販売で機能するはずです。

于 2015-09-10T23:38:09.033 に答える