I need to figure out if user entered valid authorize.net Login and Transaction Key which we store in our application. In order to do this, I'm thinking of passing the credentials the user entered to authorize.net and do a 0.01 authOnlyTransaction payment to a test bank account. It seems to be working against my test account, but not sure if it will with a real account. (sorry code is vb.net)
Dim merchantType As New merchantAuthenticationType() With {
.name = USER_Entered_LoginID,
.Item = USER_Entered_Key,
.ItemElementName = ItemChoiceType.transactionKey
}
Dim bankAccount As New bankAccountType With {
.accountType = bankAccountTypeEnum.checking,
.nameOnAccount = "Test",
.routingNumber = "125008547",
.accountNumber = "856667",
.echeckType = echeckTypeEnum.WEB
}
''https://help.chargeover.com/en/articles/105-test-credit-card-numbers-and-test-ach-echeck-bank-account-numbers
Dim paymentType As New paymentType With {
.Item = bankAccount
}
Dim transactionRequest As New transactionRequestType With {
.transactionType = transactionTypeEnum.authOnlyTransaction.ToString(),
.payment = paymentType,
.amount = 0.01
}
Dim myRequest = New createTransactionRequest With {
.transactionRequest = transactionRequest
}
Dim controller = New createTransactionController(myRequest)
controller.Execute()
Dim myResponse = controller.GetApiResponse()
Any ideas if this is the proper way to do this? Couldn't find any other way to accomplish this in https://developer.authorize.net/api/reference/index.html.
If you want to verify the credentials for an Authorize.Net account (i.e. login and transactionKey), there's no need to run a transaction.
An endpoint for testing credentials exists called authenticateTestRequest
.
Request
{
"authenticateTestRequest": {
"merchantAuthentication": {
"name": "5KP3u95bQpv",
"transactionKey": "346HZ32z3fP4hTG2"
}
}
}
Response
{
"messages": {
"resultCode": "Ok",
"message": [
{
"code": "I00001",
"text": "Successful."
}
]
}