user6349948
user6349948

Reputation: 33

Adyen payment gateway integration error 401.(The remote server returned an error: (401) Unauthorized.)

I am trying to implement the adyen api(C#.net) into my project and I am encountering the following issue:

An exception of type 'System.Net.WebException' occurred in AdyenPaymentGatewaySample.dll but was not handled in user code Additional information: The remote server returned an error: (401) Unauthorized.

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;

Any ideas for why this is happening?

Upvotes: 0

Views: 1022

Answers (1)

Taras Kalapun
Taras Kalapun

Reputation: 1761

HTTP error 401 means your ws user either has wrong password, does not exist in the system, or does not have permission to send card data.

Upvotes: 1

Related Questions