我正在尝试将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;
有关为何发生这种情况的任何想法?
答案 0 :(得分:1)
HTTP错误401表示您的用户密码错误,系统中不存在,或者无权发送卡数据。