2017-10-05 139 views
1

我已經使用以下代碼集成了2Checkout Payment API,但在授權客戶時出錯。「Value can not be null。Parameter name:s」2Checkout payment API

如下:https://www.2checkout.com/documentation/libraries-net-tutorial

代碼:

public ActionResult Process() 
{ 
     TwoCheckoutConfig.SellerID = "801785575"; 
     TwoCheckoutConfig.PrivateKey = "SA7947DS-CWE1-1233-4EE-33331DA607B6"; 
     TwoCheckoutConfig.Sandbox = true; 

     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 = "[email protected]"; 

      var Customer = new ChargeAuthorizeServiceOptions(); 
      Customer.total = (decimal)1.00; 
      Customer.currency = "USD"; 
      Customer.merchantOrderId = "123"; 
      Customer.billingAddr = Billing; 
      Customer.token = Request["token"]; 

      var Charge = new ChargeService(); 

      var result = Charge.Authorize(Customer); 
      Console.Write(result); 
     } 
     catch (TwoCheckoutException e) 
     { 
      Console.Write(e); 
     } 

     return View(); 
} 

遇到錯誤 「值不能爲空參數名:的」 請幫助我..

感謝,

回答

0

從我錯誤複製時得到的堆棧跟蹤,異常似乎源自System.IO.StringReader(String s)構造函數,因爲肯定action作爲空字符串值傳遞構造函數參數,表明您正在使用的版本爲TwoCheckOut DLL程序集,該程序集可能具有StringReader期望非空值(它屬於TwoCheckOut程序集)的錯誤。

Update-Package TwoCheckout 

如果更新過程不成功或異常還更新之後出現,在此命令中刪除相應的包::

Uninstall-Package TwoCheckout 

嘗試通過發出包管理器命令更新TwoCheckOut組件然後從this source下載最新的TwoCheckOut DLL程序集,並將其添加到項目的References部分。

類似的問題:

Value cannot be null. Parameter name: s, 2Chekout sandbox error

TwoCheckout System.ArgumentNullException : Value cannot be null Parameter name: s

+0

感謝您的答覆,但我在哪裏可以找到更新TwoCheckOut.dll。我已經從這裏申請DLL https://github.com/2Checkout/2checkout-dotnet – Pratik

+0

更新包後得到同樣的錯誤 – Pratik

相關問題