0
I've gone through most of the instructions here and am able to process a test card transaction https://docs.adyen.com/online-payments/web-drop-in. I pulled down the example repo here https://github.com/adyen-examples/adyen-dotnet-online-payments.
I adapted it to my own Adyen account and it works when running it under the 'test' Adyen configuration.
However when pushing this to production, it errors at the point when it's calling
Dim CreateCheckoutSessionResponse = _checkout.Sessions(sessionsRequest)
<WebMethod(EnableSession:=True), ScriptMethod()>
Public Shared Function GetPaymentForm() As Object
Dim orderId As String = HttpContext.Current.Session("OrderID")
Dim _connString As String = Config.StrWebConnection()
Dim cart As New ShoppingCart(_connString)
Dim dt = cart.GetOrderInfo(orderId)
Dim isGlobal = IsGlobalSite(Config.SiteUrl)
Dim liveEndpointUrlPrefix = If(Config.LiveEndpointUrlPrefix = "", Nothing, Config.LiveEndpointUrlPrefix)
Dim env = If(Int32.Parse(Config.AdyenEnvironment) = 0, Model.Enum.Environment.Test, Model.Enum.Environment.Live)
Dim clientCheckout = New Client(Config.ApiKey, env, liveEndpointUrlPrefix)
Dim _checkout = New Checkout(clientCheckout)
Dim cartTotal = Utilities.SanitizeCurrency(GetCartTotal(orderId, HttpContext.Current.Session("user_name")))
Dim sessionsRequest = New CreateCheckoutSessionRequest()
sessionsRequest.MerchantAccount = Config.MerchantAccount(0)
sessionsRequest.MerchantOrderReference = orderId
Dim Amount = New Amount("USD", Convert.ToInt64(String.Format("{0:f2}", cartTotal).Replace(".", String.Empty)))
sessionsRequest.Amount = Amount
sessionsRequest.DeliverAt = DateTime.Parse(DateTime.Now.AddDays(3).ToString("yyyy-MM-dd"))
sessionsRequest.ExpiresAt = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-ddTHH:mm:ssK"))
sessionsRequest.ShopperEmail = dt.Email
sessionsRequest.ShopperLocale = "en-us"
sessionsRequest.ShopperReference = HttpContext.Current.Session("ShopperReference").ToString().ToUpper()
sessionsRequest.Channel = PaymentRequest.ChannelEnum.Web
sessionsRequest.Reference = String.Format("ClientSite_{0}", orderId)
sessionsRequest.RecurringProcessingModel = CreateCheckoutSessionRequest.RecurringProcessingModelEnum.CardOnFile 'req.IsRecurring ? CreateCheckoutSessionRequest.RecurringProcessingModelEnum.Subscription : CreateCheckoutSessionRequest.RecurringProcessingModelEnum.CardOnFile;
sessionsRequest.EnableRecurring = False 'req.IsRecurring
sessionsRequest.EnableOneClick = True '!req.IsRecurring
'required for 3ds2 redirect flow
sessionsRequest.ReturnUrl = Config.SiteUrl & "/Confirm.aspx?"
Dim json As String
Try
Dim CreateCheckoutSessionResponse = _checkout.Sessions(sessionsRequest)
json = CreateCheckoutSessionResponse.ToJson()
Catch ex As Exception
Console.WriteLine(ex.Message)
System.Diagnostics.Debug.WriteLine(ex.Message)
Return 0
End Try
Return json
End Function
The liveEndpointUrlPrefix is set to the full Live Adyen API endpoint. The API key is also the one used from my Adyen API credentials. My environment is set to 'live'. I have also added this site to my allow origins in the API credential.
Lastly, when I step through the code it fails when calling the _checkout.Sessions(sessionRequest) and produces the following error:
{System.Net.WebException: The remote name could not be resolved: 'https'" & vbCrLf & " at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)" & vbCrLf & " at System.Net.HttpWebRequest.GetRequestStream()" & vbCrLf & " at Adyen.HttpClient.HttpUrlConnectionClient.Request(String endpoint, String json, Config config, Boolean isApiKeyRequired, RequestOptions requestOptions)" & vbCrLf & " at Adyen.Service.ServiceResource.Request(String json, RequestOptions requestOptions)" & vbCrLf & " at Adyen.Service.Checkout.Sessions(CreateCheckoutSessionRequest createCheckoutSessionRequest)" & vbCrLf & " at clients_site.Confirm.GetPaymentForm() in C:\www\Confirm.aspx.vb:line 70}
When I change the Adyen credentials to my test Adyen, the payment form loads fine.
Any ideas please. Thanks in advance!