adyen / adyen-dotnet-api-library Goto Github PK
View Code? Open in Web Editor NEWAdyen API Library for .NET
License: MIT License
Adyen API Library for .NET
License: MIT License
The following line of code is causing this library to throw an exception when used in a NET Framework project:
The exception thrown is:
System.ArgumentException: 'The 'Expect' header must be modified using the appropriate property or method.'
You can refer to this article for further explanation of the issue:
Can this line of code be removed and a new version of the library published?
Please add possibility to get req / resp logging to callback
Request to build the application with current commit to the nuget.org.
The package was last update 2 months ago, last PR was 5 days ago...
Also submitted request by email, that created a ticket on Adyen's support system
Hi,
The Lib seems to be missing UnscheduledCardOnFile for the RecurringProcessingModelEnum.
I'll add it on a PR :)
Recurring service call the wrong object _listRecurringDetails in this line [the wrong endpoint] instead of _disable object
Please fix the bug
I've had problems in my attempt to build a BrowserInfo Object.
Don't matter what I do I always have the following error :
System.IO.InvalidDataException: 'AcceptHeader is a required property for BrowserInfo and cannot be null'
I simply am trying to execute the following code (C#):
```
var browserInfo = new Adyen.Model.Checkout.BrowserInfo()
{
JavaEnabled = false,
Language = "BR",
AcceptHeader = @"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3",
UserAgent = @"Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36",
ColorDepth = 24,
ScreenHeight = 723,
ScreenWidth = 1536,
TimeZoneOffset = 0
};
I guess there must to be a internal error in this class.
I hope the solution comes up asap.
Hi,
I'm trying to make a new payment using web drop-in (https://docs.adyen.com/checkout/drop-in-web#step-3-make-a-payment). Using AJAX i'm calling my WebAPI controller which in turn should create a payment using the Adyen nuget package.
In my WebAPI controller I'm using the DefaultPaymentMethodDetails object as parameter (which I think is the right type?) to map the incoming JSON. Which works for creditcard, Klarna, etc. But for iDeal the issuer doesn't get mapped because the drop-in javascript library sends the issuer in the "issuer" property and the DefaultPaymentMethodDetails object doesn't have an "issuer" property but instead has an "idealIssuer" property. Am I missing something?
I could ofcourse create my own object which correctly maps the incoming "issuer" property to the "idealIssuer" property of the DefaultPaymentMethodDetails object. But I do not want to update my own models every time the properties in the Adyen package are changed.
AJAX call
$.ajax({
url: "/api/adyen",
data: JSON.stringify(state.paymentMethod),
type: "POST",
contentType: "application/json",
success: (result) => {
...
},
error: (error) => {
...
}
});
JSON that's being sent to WebAPI controller
{"type":"ideal","issuer":"1153"}
WebAPI controller
[HttpPost]
public void Post([FromBody]Adyen.Model.Checkout.DefaultPaymentMethodDetails paymentMethod)
{
...
}
Hello, in the 3DS2 /payments response, I don't see any properties to store the action and authentication objects.
Example:
{"resultCode":"IdentifyShopper","action":{"paymentData":"","paymentMethodType":"scheme","token":"","type":"threeDS2Fingerprint"},"authentication":{"threeds2.fingerprintToken":""},"details":[{"key":"threeds2.fingerprint","type":"text"}],"paymentData":""}
Also, I don't see any properties to store the data for payment methods like Giropay, Sepa, or Ideal for example.
Here is a sample request for Giropay,
"paymentMethod":{
"type":"giropay",
"bic":"DEUTDE2H"
},
And I'm assuming the Github class I should use to post to the /payments API is DefaultPaymentMethodDetails. But I don't see any properties there that reference "bic".
And same thing for Sepa payments,
{ type: "sepadirectdebit", "sepa.ownerName": "A. Klaassen", "sepa.ibanNumber": "NL13 TEST 0123 4567 89" }
There isn't a property that references sepa.ownerName or sepa.ibanNumber.
The documentation for the Checkout API lists the following as possible result codes for the /payments
and /payments/details
endpoints:
AuthenticationFinished
Authorised
Cancelled
ChallengeShopper
Error
IdentifyShopper
Pending
PresentToShopper
(not included in the referenced doc, but I have seen it mentioned elsewhere on the site)Received
RedirectShopper
Refused
The result codes currently in the Checkout model PaymentsResponse.ResultCodeEnum
are as follows:
Authorised
Cancelled
ChallengeShopper
Error
IdentifyShopper
PartiallyAuthorised
PresentToShopper
Received
RedirectShopper
Refused
Most of documented result codes are included in this .NET SDK (and even an extra one which is not documented -- i.e. PartiallyAuthorised
) but there are some discrepancies between the two. All of the documented result codes for Checkout API should be in the PaymentsResponse.ResultCodeEnum
.
Hi guys,
we would like to use this library in our projects. According to the Payment API (https://docs.adyen.com/api-explorer/#/Payment/v46/authorise), there should be a recurringProcessingModel
member. I can only see that in the Checkout API (https://github.com/Adyen/adyen-dotnet-api-library/search?q=recurringProcessingModel&unscoped_q=recurringProcessingModel). Is there a plan to add it also in the Payment API client? Or, what's your suggested way to use your API in a .NET Core project? We are currently using a generated client using Swagger code generator, but that used the old OpenAPI spec. We tried generating for the latest version but the generated client wasn't working properly...thanks.
There is a check in the ctor of Adyen.EcommLibrary.Model.Checkout.PaymentsDetailsRequest
if (PaymentData == null)
throw new InvalidDataException("PaymentData is a required property for PaymentsDetailsRequest and cannot be null");
However, various bits of documentation such as https://docs.adyen.com/payment-methods/sofort/#step-4-present-payment-result show that you can submit with just a payload.
The work-around is to pass an empty string into the ctor but this guard clause should be updated/removed
origin
is required for 3DS2
When we tried to use this library we recieved errors when calling the HttpUrlConnectionClient.Request method.
The error is thrown as the code is trying to set the paramenter User-Agent in the call on line 99 but I think you should set the user agent by calling HttpWebRequest .UserAgent
Issue is mentioned here
Hello,
I'm getting the error from title when executing payment.Authorise(paymentRequest);
and I believe it comes from this line.
I think it has to be req.Expect = "100-continue";
(https://docs.microsoft.com/en-us/dotnet/api/system.net.httpwebrequest.expect?view=netcore-2.0)
Thank you.
The integrator of one of our merchants reported an exception when sending a Terminal API AbortRequest through the library:
"An exception occured when trying to abort :
Error reading JObject from JsonReader. Path '', line 0, position 0."In your "ecommlibrary" and file "SaleToPoiMessageSecuredSerializer.cs" and method "internal SaleToPoiMessageSecured Deserialize(string saleToPoiMessageSecuredJSon)"
The argument saleToPoiMessageSecuredJSon = "" and throws the exception when trying to parse the "JObject".
The terminal gives an empty response body (with HTTP 200) in case of an AbortRequest, so I think the problem is caused by an attempt to parse that empty response into an object.
Hosting an application in the cloud across multiple environments can cause requests to be made from instances that have an IP which hasn't been whitelisted (i.e. when scaling up/down the number of instances), resulting in unauthorised request errors from Adyen.
To lessen this impact I propose enabling consumers of the API Library to be able to provide their own set of configuration values, so that for example, requests can be made to a proxy endpoint that is whitelisted, which can handle the forwarding of requests to Adyen from any number of application instances.
Hi, i just want use CardAcquisitionTransaction,I made a request according to the documentation https://docs.adyen.com/point-of-sale/build-your-integration/acquire-card-details/
example:
var request = new SaleToPOIRequest()
{
MessageHeader = new MessageHeader()
{
ProtocolVersion = "3.0",
MessageType = "Request",
MessageClass = "Service",
MessageCategory = "CardAcquisition",
SaleID = "USER" + input.SaleId,
POIID = input.POIID,
ServiceID = "AC" + input.TerminalTransactionID.ToString()
},
MessagePayload = new CardAcquisitionRequest()
{
SaleData = new SaleData()
{
SaleTransactionID = new TransactionIdentification()
{
TransactionID = "AC" + input.TerminalTransactionID.ToString(),
TimeStamp = DateTime.Now
}/*,
TokenRequested = "Customer"*/
},
CardAcquisitionTransaction = new CardAcquisitionTransaction()
{
}
},
SecurityTrailer = new ContentInformationType() { }
};
but response is with errors:
"MessagePayload": {
"Response": {
"AdditionalResponse": "tid=75102760&transactionType=GOODS_SERVICES&backendGiftcardIndicator=false&expiryYear=2028&posAmountGratuityValue=0&giftcardIndicator=false&paymentMethodVariant=maestro&expiryDate=2%2f2028&cardHolderName=N%2fA&applicationPreferredName=ms%20en&txtime=08%3a57%3a59&iso8601TxDate=2019-05-20T06%3a57%3a59.0000000%2b0000&cardType=maestro&posOriginalAmountValue=0&txdate=20-05-2019&paymentMethod=mc&merchantReference=AC77&applicationLabel=ms%20en&expiryMonth=02&cardSummary=9990&warnings=At%20SaleToPOIRequest.CardAcquisitionRequest.CardAcquisitionTransaction%2c%20field%20LoyaltyHandling%3a%20Field%20not%20supported%0aAt%20SaleToPOIRequest.CardAcquisitionRequest.CardAcquisitionTransaction%2c%20field%20ForceCustomerSelectionFlag%3a%20Field%20not%20supported%0aAt%20SaleToPOIRequest.CardAcquisitionRequest.CardAcquisitionTransaction%2c%20field%20CashBackFlag%3a%20Field%20not%20supported&posAuthAmountCurrency=EUR&posAmountCashbackValue=0&posEntryMode=ICC&cardScheme=maestro&cardBin=679999&posAuthAmountValue=0",
"Result": "Success",
"ErrorCondition": null
},
TotalAmount is not supported and many others fields
Can you please fix this problem
Are there any plans to support the new 3d secure 2.0 API. It will be required in Europe by sept 2019 I believe.
Hey, just recently encountered this small issue when I was using your library.
When newing up a Client class I was using the constructor:
Client(string xapikey, Environment environment)
for both Test and Live environments, this worked fine for Test.
However, for Live I was getting this error when I was calling the Checkout.PaymentMethods
method:
System.UriFormatException: Invalid URI: The format of the URI could not be determined.
at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)
at System.Uri..ctor(String uriString)
at System.Net.WebRequest.Create(String requestUriString)
at Adyen.EcommLibrary.HttpClient.HttpUrlConnectionClient.GetHttpWebRequest(String endpoint, Config config, Boolean isApiKeyRequired, RequestOptions requestOptions)
at Adyen.EcommLibrary.HttpClient.HttpUrlConnectionClient.Request(String endpoint, String json, Config config, Boolean isApiKeyRequired, RequestOptions requestOptions)
at Adyen.EcommLibrary.Service.ServiceResource.Request(String json, RequestOptions requestOptions)
at Adyen.EcommLibrary.Service.Checkout.PaymentMethods(PaymentMethodsRequest paymentMethodsRequest)
Obviously this was because I wasn't using the constructor:
Client(string xapikey, Environment environment, string liveEndpointUrlPrefix)
to declare the data center correctly for Live. However, this wasn't picked up until we released to our Staging environment. As the Live URL was malformed since it was missing the liveEndpointUrlPrefix
.
I feel that ideally it would be nice to have had a more descriptive error before the code made it to a method call. I don't really understand the reason behind the config value not setting the CheckoutEndpoint
if the liveEndpointUrlPrefix
is null in this switch statement? is this Possibly a bug?
switch (environment)
{
case Environment.Test:
Config.Endpoint = ClientConfig.EndpointTest;
Config.HppEndpoint = ClientConfig.HppTest;
Config.CloudApiEndPoint = ClientConfig.CloudApiEndPointTest;
Config.CheckoutEndpoint = ClientConfig.CheckoutEndpointTest;
break;
case Environment.Live:
Config.Endpoint = ClientConfig.EndpointLive;
Config.HppEndpoint = ClientConfig.HppLive;
Config.CloudApiEndPoint = ClientConfig.CloudApiEndPointLive;
//set live endpoint for checkout api
if (!string.IsNullOrEmpty(liveEndpointUrlPrefix))
{
Config.Endpoint = ClientConfig.EndpointProtocol + liveEndpointUrlPrefix + ClientConfig.EndpointLiveSuffix;
Config.CheckoutEndpoint = ClientConfig.EndpointProtocol + liveEndpointUrlPrefix + ClientConfig.CheckoutEndpointLiveSuffix;
}
break;
}
If this is intended, please dirsregard. I'm happy to push a fix if you think it should throw here, or use a default CheckoutEndpoint
instead? Thanks for taking the time to humor my issue and thanks for a great library!
The way it is implemented now in CheckoutUtility, it uses originkeys
, when it should be originKeys
.
Because this is not implemented properly, it is impossible to implement Checkout
using solely the library.
This is how it's supposed to work
curl https://checkout-test.adyen.com/v1/originKeys \
-H "X-API-key: <api-key>" \
-H "Content-Type: application/json" \
-d '{
"originDomains":[
"https://www.your-company1.com",
"https://www.your-company2.com",
"https://www.your-company3.com"
]
}'
This is what's called by the library
curl https://checkout-test.adyen.com/v1/originkeys \
-H "X-API-key: <api-key>" \
-H "Content-Type: application/json" \
-d '{
"originDomains":[
"https://www.your-company1.com",
"https://www.your-company2.com",
"https://www.your-company3.com"
]
}'
(Results in 500 bad request)
Hello, I have added a property on my existing class which is marked as [Serializable] since it's stored session. The new property is, public PaymentRequest AdyenPaymentRequest { get; set; }
Since the PaymentRequest class is not marked as [Serializable], I get the following exception:
SerializationException: Type 'Adyen.Model.Checkout.PaymentRequest' in Assembly 'Adyen, Version=3.2.1.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
The only way I know to fix this is to add the [Serializable] attribute to the PaymentRequest class, is that something you guys can do? Or do you have any suggestions to get around this issue?
Thanks
Hello,
I'm trying to integrate Adyen to our POS application using Terminal API over local communications.
I'm currently able to do a basic sale request and refund and tipping. I would like to know if manual capture and tokenization of card details could be done using Terminal API over local area network.
need to have
"PaymentData" : {
"PaymentType" : "Refund"
}
Hi,
I like what you guys have done regarding the response codes from the Adyen API, however I think the exception name has room for improvement as it may be confused with a native .net exception.
A readme document regarding exception handling along with a possible renaming of the exception thrown to be more "Proprietary" would be great, as the main methods (Payments, PaymentDetails, etc) for the Adyen checkout also don't mention exceptions thrown.
What do you think? :)
Hi,
Have you thought to add asynchronous versions of the Request() and Post() methods of the various operations?
Currently it's possible to provide a seperate implementation of the IClient interface, but since it currently doesn't have methods that return Tasks it's difficult to use this library with an async flow from end-to-end.
AdyenECommerceLibrary.Model.Checkout.PaymentRequest has a property of AdditionalData with type Dictionary<string, string>
The documentation https://docs.adyen.com/checkout/3d-secure-2/3ds2-checkout-api-integration/ shows setting a boolean: "allow3DS2" : true
The documentation https://docs.adyen.com/development-resources/test-cards/result-code-testing/ shows setting an int: "RequestedTestAcquirerResponseCode":6
PaymentRequest.AdditionalData should be changed to type Dictionary<string, object>
Doing the following
var p = new Payment(client);
p.Authorise(new PaymentRequest
{
SelectedRecurringDetailReference = "LATEST",
Reference = Guid.NewGuid().ToString(),
MerchantAccount = "HIDDEN",
ShopperReference = "HIDDEN",
Amount = new Amount("SEK", 5000),
ShopperInteraction = ShopperInteractionEnum.Contauth,
Recurring = new Adyen.EcommLibrary.Model.Reccuring.Recurring(Contract: Adyen.EcommLibrary.Model.Enum.Contract.Recurring),
});
I get an error 807 Invalid combination of shopper interaction and recurring-contract
where it looks like it received shopperinteraction Ecommerce (or most likely none at all)
However it works fine when I manually create the JSON myself with
var auth = new Authorise(new Payment(client))
auth.Request(JsonConvert.SerializeObject(
new
{
selectedRecurringDetailReference = "LATEST",
reference = Guid.NewGuid().ToString(),
merchantAccount = "HIDDEN",
shopperReference = "HIDDEN",
amount = new
{
currency = "SEK",
value = 5000
},
shopperInteraction = "ContAuth",
recurring = new
{
contract = "RECURRING"
}
}
))
which leads me to believe something is wrong with how the PaymentRequest class handles
the serialization of ShopperInteraction
Env is Test btw if that matters
When serializing the notification (NotificationRequest) the property NotificationItemContainers (a list of NotificaticationItemContainer) comes null (no Json property assigned)
The class Adyen.EcommLibrary.Model.Checkout.PaymentsResponse has it's own Enum for ResultCodeEnum (instead of using Adyen.EcommLibrary.Model.Enum.ResultCodeEnum) so when making a 3DS call to Adyen.EcommLibrary.Service.Payments you get the error:
Error converting value "IdentifyShopper" to type 'System.Nullable`1[Adyen.EcommLibrary.Model.Checkout.PaymentsResponse+ResultCodeEnum]'. Path 'resultCode', line 1, position 31.
Hello,
Version: 2.0.0
PaymentType: Boleto Bancario
I am trying to implement the adyen api integration into my project (.net core 2.0) and I am encountering the following issue when my application tries to read a PaymentResponse:
Error converting value "PresentToShopper" to type 'System.Nullable
1[Adyen.EcommLibrary.Model.Checkout.PaymentsResponse+ResultCodeEnum]'. Path 'resultCode', line 1, position 66.`
And Here is My Method:
public async Task<PaymentsResponse> PayBrokerageViaBoleto(EntityDto<long> input)
{
var brokerage = await _brokerageRepository.FirstOrDefaultAsync(input.Id);
if (!brokerage.BoletoUrl.IsNullOrEmpty())
throw new Abp.UI.UserFriendlyException(L("Error"), L("ThisBrokerageHasBoleto"));
var vendor = await _vendorRepository.GetAsync(brokerage.VendorId);
var user = await _userRepository.GetAsync(AbpSession.UserId.Value);
var result = new PaymentsResponse();
try
{
var address = new Address(
City: vendor.City,
Country: "BR",
HouseNumberOrName: vendor.Number.ToString(),
StateOrProvince: vendor.State,
PostalCode: vendor.ZipCode,
Street: vendor.Address
)
{ };
var client = new Client(AdyenConsts.ApiKey, Environment.Test);
var checkout = new Checkout(client);
var deliveryDate = System.DateTime.Now.AddDays(1);
var amount = new Adyen.EcommLibrary.Model.Checkout.Amount("BRL", 9990); //brokerage.FeeAmount
var details = new Adyen.EcommLibrary.Model.Checkout.DefaultPaymentMethodDetails
{
Type = "boletobancario_santander"
};
var paymentsRequest = new Adyen.EcommLibrary.Model.Checkout.PaymentRequest(
MerchantAccount: AdyenConsts.AccountMerchant,
PaymentMethod: details,
Amount: amount,
CountryCode: "BR",
ShopperLocale: "pt_BR",
Reference: brokerage.Id.ToString(),
ReturnUrl: LojistaConsts.BaseAddress + AdyenConsts.AdyenCheckoutCompleted,
BillingAddress: address,
SelectedBrand: "boletobancario_santander", //https://docs.adyen.com/developers/payment-methods#cashandatmpaymentmethods
SocialSecurityNumber: vendor.Cnpj,
ShopperName: new Name(FirstName: "R.SOCIAL:", LastName: vendor.BusinessName) { },
ShopperStatement: AdyenConsts.AdyenShopperStatementForBoleto,
DeliveryDate: deliveryDate
)
{ };
result = checkout.Payments(paymentsRequest); //ERROR FIRES HERE
}
catch (System.Exception ex)
{
throw new Abp.UI.UserFriendlyException(L("Error"), ex.Message);
}
return result;
}
When trying to authorize a recurring payment using Client-Side Encryption; the request fails due to an Unprocessable Entity.
The expected JSON to be sent to Adyen /authorize endpoint in this case would be
{"amount":{"currency":"USD","value":0},"reference":"xxxxx","shopperIp":"xxxxx","merchantAccount":"xxxxx","shopperEmail":"xxxxxxx","shopperReference":"xxxxxxx","recurring":{"contract":"RECURRING"},"additionalData":{"card.encrypted.json": "adyenjs_0_1_19$xxxxxxx"}}
But instead we get:
{"amount":{"currency":"USD","value":0},"reference":"xxxxx","shopperIp":"xxxxx","merchantAccount":"xxxxx","shopperEmail":"xxxxxxx","shopperReference":"xxxxxxx","recurring":{"contract":"RECURRING"},"additionalData":{"Key":"card.encrypted.json","Value":"adyenjs_0_1_19$xxxxxxx"}}
Because the AdditionalData is implemented as a KeyValuePair and the underlying JsonSerializer produces the wrong output in this scenario ("Key": xxx, "Value": xxxx)
Additionally; I believe the AdditionalData property on the PaymentRequest model should accept multiple key/value pairs; since it's normally possible to pass more than 1 "additional data" (see https://docs.adyen.com/developers/risk-management/skip-risk-checks )
I am trying to make live PayPal payments and it fails though it works fine with test payments.
I am getting this exception message: Invalid URI: The format of the URI could not be determined.
I debugged the dot net SDK v2.0.0 and v.2.0.2 and noticed the following.
a) in the "namespace Adyen.EcommLibrary":
The method "SetEnviroment" on the switch statement when it sets the live environment it fails testing the variable "liveEndpointUrlPrefix".ย
b) In the "namespace Adyen.EcommLibrary.HttpClient"
The method "GetHttpWebRequest" receives the endpoint "/v41/payments" instead of the full API URL; for the test environment it gets the URL "https://checkout-test.adyen.com/v41/payments" instead of the "-checkout-live.adyenpayments.com/checkout" probably because of failing the prefix as mentioned above.
After serializing a payment request using a class deriving from AbstractPaymentRequest, the metadata property is not submitted.
This appears to be due to the property missing a DataMember
decorator.
Implementing the new drop-in solution requires API version 49. This .NET library still targets v40 however and renders it incompatible with the drop-in solution. This is because the /payments
endpoint response has been changed in v49.
Any plans to support this api?
https://docs.adyen.com/developers/api-reference/cost-estimation-api/getcostestimaterequest
Hi guys!
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.
Here is a code sample of the callback file:
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;
Thanks in advance,
for voucher payments, this code is missing
resultCode = PresentToShopper
Use case : voucher (boleto / Brazil)
Hi, there is a problem with receiving of response when StatusCode 100 Continue is sended by your server. Example:
Call TerminalApiCloudAsync with SaleToPOIRequest
`public string Request(string endpoint, string json, Config config, bool isApiKeyRequired, RequestOptions requestOptions = null)
{
string responseText = null;
var httpWebRequest = GetHttpWebRequest(endpoint, config, isApiKeyRequired, requestOptions);
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
try{
using (var response = (HttpWebResponse)httpWebRequest.GetResponse())
{
using (var reader = new StreamReader(response.GetResponseStream(), _encoding))
{
responseText = reader.ReadToEnd();
}
}
}
catch (WebException e)
{
var response = (HttpWebResponse)e.Response;
using (var sr = new StreamReader(response.GetResponseStream()))
{
responseText = sr.ReadToEnd();
}
throw new HttpClientException((int)response.StatusCode, e.Message, response.Headers, responseText);
}
return responseText;
}`
When i run request on Linux platform with .net core, this code raise exception (over 10MB debug file, realy??), when i raised only WebException, then i get
{ "ClassName": "System.Net.WebException", "Message": "The remote server returned an error: (100) Continue.", "Data": null, "InnerException": null, "HelpURL": null, "StackTraceString": " at System.Net.HttpWebRequest.GetResponse()\n at Adyen.EcommLibrary.HttpClient.HttpUrlConnectionClient.Request(String endpoint, String json, Config config, Boolean isApiKeyRequired, RequestOptions requestOptions) in /app/gapatoadyen/src/Adyen.EcommLibrary/HttpClient/HttpURLConnectionClient.cs:line 51\n at Adyen.EcommLibrary.Service.PosPaymentCloudApi.TerminalApiCloudAsync(SaleToPOIMessage saleToPoiRequest) in /app/gapatoadyen/src/Adyen.EcommLibrary/Service/PosPaymentCloudApi.cs:line 30\n
No usual repairs doesnt work
System.Net.ServicePointManager.Expect100Continue = false;
, settings of Expect header, ...
after 30 hours i found a solution
public HttpWebRequest GetHttpWebRequest(string endpoint, Config config, bool isApiKeyRequired, RequestOptions requestOptions = null)
{
//Add default headers
var httpWebRequest = (HttpWebRequest)WebRequest.Create(endpoint);
httpWebRequest.Method = "POST";
httpWebRequest.ProtocolVersion = HttpVersion.Version10;
HTTP 1.0 doesnt support StatusCode 100, so magicly work.
Please repair receiving of response when 100 status is sended by your server.
In the documentation at https://docs.adyen.com/developers/api-reference/live-endpoints
it says that live-endpoints should be prefixed with [random]-[company name].
Can i set that somewhere when i use the Live Environment?
(from what i see it uses hardcoded urls without any of those prefixes internally)
Or does it work anyway?
Hi,
in class PaymentSessionRequest in constructor is validation logic for some class properties. So when I want to create a new PaymentSessionRequest then I need to specify all properties via constructor although I need to set only several properties.
Could you put validation logic somewhere else?
So, Adyen.EcommLibrary/Notification/NotificationHandler.cs has a bunch of uncommented code. What's wrong with deleting the file in its entirety if it's only returning null? We're supposed to put people's payment information (well - but you know what I mean) through this codebase, and commented out code, in master, isn't inspiring confidence.
Hello,
Version: 2.0.2.0
The enum found here does not include a "PresentToShopper" value, but is supposedly supported by Checkout API. Here is an example: https://docs.adyen.com/payment-methods/wechat-pay/wechat-pay-desktop-qr-payments/#step-1-get-qr-code-data
Thanks,
jaw64
Are there any time-frames on when the new 3D Secure 2.0 API will be supported?
Per merchant feedback, it is confusing to have a Checkout class in Checkout.cs as well as a Checkout directory. Could be worth refactoring the name of checkout.cs
Note: this may be a duplicate of issue #28?
Currently, HttpUrlConnectionClient
is vulnerable to Exception
s being thrown both when sending the request and also when handling WebException
s thrown when retrieving the response (particularly if WebException.Response
happens to be null, which .NET documentation says is possible).
I have seen a few NullReferenceException
s thrown for different endpoints (very infrequently, once a day or less) and it seems to always be happening in this HttpUrlConnectionClient.Request(...)
method, but I can't pinpoint exactly where it's occurring at because I'm currently using the NuGet package. From .NET documentation, the only place I can see this type of exception potentially occurring is at the handling of the WebException
. Here is the stack trace, though I don't know that it'll be very helpful:
Stack trace:
at Adyen.EcommLibrary.HttpClient.HttpUrlConnectionClient.Request(String endpoint, String json, Config config, Boolean isApiKeyRequired, RequestOptions requestOptions)
at Adyen.EcommLibrary.Service.ServiceResource.Request(String json, RequestOptions requestOptions)
at Adyen.EcommLibrary.Service.Payment.Authorise(PaymentRequest paymentRequest, RequestOptions requestOptions)
at FooBar.MyApp.AuthoriseRequest.Execute(PaymentRequest paymentRequest)
at FooBar.MyApp.Authorise.Execute(PaymentProcessRequest paymentProcessRequest, PaymentInfo paymentInfo)
Is this intended behavior? Is the merchant responsible for handling these exceptions, and if so, how should they be handled?
Hi,
In the documentation:
https://docs.adyen.com/api-explorer/#/PaymentSetupAndVerificationService/v32/payments
It says:
"When providing the merchantOrderReference value, we also recommend you submit retry.orderAttemptNumber, retry.chainAttemptNumber, and retry.skipRetry values."
I can't find these properties in the library.
Am I missing something or does the library not support these properties?
Hey,
Found an issue with the serialization for the getCostEstimate call in BinLookup.
When making a call to BinLookup -> CostEstimate the field shopperInteraction is getting converted to the enum value and not the string representation.
Example:
{
"amount": {
"currency": "EUR",
"value": 1000
},
"assumptions": {
"assume3DSecureAuthenticated": true,
"assumeLevel3Data": true
},
"cardNumber": "4111111111111111",
"merchantAccount": "<MERCHANT_ACCOUNT>",
"merchantDetails": {
"countryCode": "NL",
"enrolledIn3DSecure": true,
"mcc": "7411"
},
"shopperInteraction": 0
}
As you can see the example above serializes the shopperInteraction to 0, this errors out when calling the api endpoint https://pal-test.adyen.com/pal/servlet/BinLookup/getCostEstimate
, returning:
{
"status": 422,
"errorCode": "000",
"message": "Invalid shopperInteraction provided",
"errorType": "validation"
}
It should be the following:
{
"amount": {
"currency": "EUR",
"value": 1000
},
"assumptions": {
"assume3DSecureAuthenticated": true,
"assumeLevel3Data": true
},
"cardNumber": "4111111111111111",
"merchantAccount": "<MERCHANT_ACCOUNT>",
"merchantDetails": {
"countryCode": "NL",
"enrolledIn3DSecure": true,
"mcc": "7411"
},
"shopperInteraction": "Ecommerce"
}
As this returns a valid getCostEstimate response:
{
"cardBin": {
"bin": "411111",
"issuingBank": "ADYEN TEST BANK",
"issuingCountry": "NL",
"paymentMethod": "visa"
},
"resultCode": "Unsupported",
"surchargeType": "ZERO"
}
Hi,
I'm using Terminal API through LAN communication to communicate with the terminal.
My code fails on this particular line in PosPaymentLocalApi.cs
var response = _terminalApiLocal.Request(serializeSaleToPoiRequestMessageSecured, remoteCertificateValidationCallback);
The error message (HTTP Exception) I receive is:
{ "errors": [ "At SaleToPOIRequest, field PaymentRequest: Missing", "At SaleToPOIRequest: Missing" ], "warnings": [ "At SaleToPOIRequest.MessageHeader, field SecurityTrailer: Unexpected", "At SaleToPOIRequest.MessageHeader, field NexoBlob: Unexpected" ] }
I see that when the message is being serialized MessagePayload does change to PaymentRequest and then the encryption happens.
Please let me know why does it still consider MessagePayload instead of PaymentRequest.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.