我正在尝试将 adyen api(C#.net) 实施到我的项目中,但遇到以下问题:
AdyenPaymentGatewaySample.dll 中出现“System.Net.WebException”类型的异常,但未在用户代码中处理附加信息:远程服务器返回错误:(401) 未经授权。
var config = new Config();
config.MerchantAccount = "MyMerchantAccountName";
config.Password = "mypassword";
config.Username = "test";
config.Endpoint = "https://pal- test.adyen.com/pal/servlet/Payment/v30";
config.ApplicationName = "MyServername";
config.Environment = Test;
config.SkinCode = "7A26B737";//test
config.HmacKey = "7A26B737AN79CSpV87A7A26B737AN79CSpV87A7A26B737AN79CSpV87A";//test
var client = new Client(config);
var payment = new Payment(client);
var paymentRequest = new PaymentRequest
{
MerchantAccount = "MyMerchantAccountName",
Amount = new Amount("CAD", 5),
Card = new Card(Number: "4111111111111111", ExpiryMonth: "08", ExpiryYear: "2018", Cvc: "737", HolderName: "John Smith"),
Reference = "Merchant reference",
AdditionalData = new Dictionary<string, string>()
};
var paymentResult = payment.Authorise(paymentRequest);
return paymentResult;
为什么会发生这种情况的任何想法?