I have a VB.Net application that has been using authorize.net for years. When they made the change for TLS I had to do some recoding. It seems to work most of the time, but recently customers have been complaining about the frequency of failures to authorize. I looked at the errors and I am seeing this a lot.
I'm not sure why this is so sporadic. Any suggestions would help.
The request was aborted: Could not create SSL/TLS secure channel.
Here is the code that I am using.
ApiOperationBase(Of ANetApiRequest, ANetApiResponse).RunEnvironment = Global.AuthorizeNet.Environment.PRODUCTION
'define the merchant information (authentication / transaction id)
Dim merchantAuthType As New merchantAuthenticationType() With {
.name = MyLogin,
.ItemElementName = ItemChoiceType.transactionKey,
.Item = MyTranKey
}
ApiOperationBase(Of ANetApiRequest, ANetApiResponse).MerchantAuthentication = merchantAuthType
Dim creditCard = New creditCardType()
creditCard.cardNumber = CCNum
creditCard.expirationDate = ExpDate
Dim billingAddress = New customerAddressType()
billingAddress.firstName = tbFirstOnCard.Text
billingAddress.lastName = tbLastOnCard.Text
billingAddress.zip = tbCCZip.Text
'standard api call to retrieve response
Dim paymentType = New paymentType()
paymentType.Item = creditCard
Dim transactionRequest = New transactionRequestType()
transactionRequest.transactionType = transactionTypeEnum.authCaptureTransaction.ToString()
transactionRequest.amount = Replace(lblTotal.Text, "$", "")
transactionRequest.merchantDescriptor = "My Order"
transactionRequest.payment = paymentType
transactionRequest.billTo = billingAddress
Dim request = New createTransactionRequest()
request.transactionRequest = transactionRequest
'instantiate the controller that will call the service
Dim controller = New createTransactionController(request)
controller.Execute()
Solved! Go to Solution.
10-04-2018 04:38 AM
Before your controller.execute put this line of code to force TLS 1.2:
ServicePointManager.SecurityProtocol = CType(3072, SecurityProtocolType)
in C#:
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
-pcmatt@IDP.Net
10-10-2018 03:02 PM
Before your controller.execute put this line of code to force TLS 1.2:
ServicePointManager.SecurityProtocol = CType(3072, SecurityProtocolType)
in C#:
ServicePointManager.SecurityProtocol = (SecurityProtocolType)3072;
-pcmatt@IDP.Net
10-10-2018 03:02 PM
Thanks I will try that.
10-11-2018 03:43 PM