Hello,
I am a newbie here so please forgive me if I make any mistakes in adhering to the rules of this forum.
The issue i am facing is :
"Error processing request: E00007 - User authentication failed due to invalid authentication values"
I am using a proper value of API Login Id and Transaction key.
But I get this auth error.
Code sample provided below:
**************************************************
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AuthorizeNet;
namespace SampleReporting
{
class Program
{
static void Main(string[] args)
{
var gate = new ReportingGateway("MY API ", "MY Transaction Key");
//Get all the batches settled
var batches = gate.GetSettledBatchList(); //<--- The code fails here
Console.WriteLine("All Batches in the last 30 days");
foreach (var item in batches)
{
Console.WriteLine("Batch ID: {0}, Settled On : {1}", item.ID, item.SettledOn.ToShortDateString());
}
Console.WriteLine("*****************************************************");
Console.WriteLine();
var transactions = gate.GetTransactionList();
foreach (var item in transactions)
{
Console.WriteLine("Transaction {0}: Card: {1} for {2} on {3}", item.TransactionID, item.CardNumber, item.SettleAmount.ToString("C"), item.DateSubmitted.ToShortDateString());
}
Console.Read();
}
}
}
*******************************************************
I am using Visula Studio and creating a console application in C# for the above code.
I have also referenced the AuthorizeNet.dll in my solution.
Any help will be highly appreciated.
Thanks in Advance!!!
โ10-25-2012 12:36 AM
Hi,
The error seems to be due to the fact that the Gateway is pointing to the test site and I am using production credentials.
TEST_URL "https://apitest.authorize.net/xml/v1/request.api"
URL "https://api.authorize.net/xml/v1/request.api"
At runtime its is taking the value from the TEST_URL.
Any ideas on how to make the gateway point to the Prod url as the value of the ServiceURL?
โ10-25-2012 03:06 AM
Change
var gate = new ReportingGateway("MY API ", "MY Transaction Key");
To
var gate = new ReportingGateway("MY API ", "MY Transaction Key", ServiceMode.Live);
โ10-25-2012 04:15 AM - edited โ10-25-2012 04:16 AM
Many many Thanks for the reply RaynorC1emen7.!!
Now it is taking the prod URL for the connecting to the gateway. But the error still persists.
"Error processing request: E00007 - User authentication failed due to invalid authentication values."
Is there a way to check if the API Login ID and Transaction Key are consistent? I have no other creds but these.
Thanks in Advance!!!
โ10-25-2012 04:54 AM
Both are case sensitive, and make sure there is no spaces.
You can login to the account - settings to see the API login id. The transactionKey is not viewable, but you can regenerate it at the account settings.
โ10-25-2012 05:25 AM
I get this usually when I'm processing a CIM transaction and passing an ID generated within the Sandbox to the Live API key values.
โ06-08-2015 03:18 PM
define("AUTHORIZENET_LOG_FILE","/tmp/phplog"); // Common setup for API credentials $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName("45dW3UnkACq"); $merchantAuthentication->setTransactionKey("732fkpfR8X23Q9hY"); $refId = 'ref' . time(); // Create the payment object for a payment nonce $opaqueData = new AnetAPI\OpaqueDataType(); $opaqueData->setDataDescriptor($_POST["dataDescriptor1"]); $opaqueData->setDataValue($_POST["dataValue1"]); // $creditCard->setCardNumber("4111111111111111"); // $creditCard->setExpirationDate( "2038-12"); // $creditCard->setCardCode("123"); // Add the payment data to a paymentType object $paymentOne = new AnetAPI\PaymentType(); $paymentOne->setOpaqueData($opaqueData); // $paymentOne = new AnetAPI\PaymentType(); // $paymentOne->setCreditCard($creditCard); // Create order information $order = new AnetAPI\OrderType(); // $order->setInvoiceNumber("10101"); $order->setDescription("Trip for ".$_SESSION["tour"]); // Set the customer's Bill To address $customerAddress = new AnetAPI\CustomerAddressType(); $customerAddress->setFirstName($_SESSION["fname"]); $customerAddress->setLastName($_SESSION["lname"]); $customerAddress->setCompany(""); $customerAddress->setAddress($_SESSION["street"]); $customerAddress->setCity($_SESSION["city"]); $customerAddress->setState($_SESSION["state"]); $customerAddress->setZip($_SESSION["zip"]); $customerAddress->setCountry($_SESSION["country"]); // Set the customer's identifying information $customerData = new AnetAPI\CustomerDataType(); $customerData->setType("individual"); $customerData->setId($contactid); $customerData->setEmail($_SESSION["email"]); // Add values for transaction settings $duplicateWindowSetting = new AnetAPI\SettingType(); $duplicateWindowSetting->setSettingName("duplicateWindow"); $duplicateWindowSetting->setSettingValue("60"); // Add some merchant defined fields. These fields won't be stored with the transaction, // but will be echoed back in the response. $merchantDefinedField1 = new AnetAPI\UserFieldType(); $merchantDefinedField1->setName("customerLoyaltyNum"); $merchantDefinedField1->setValue(time()); $merchantDefinedField2 = new AnetAPI\UserFieldType(); $merchantDefinedField2->setName("favoriteColor"); $merchantDefinedField2->setValue("blue"); // Create a transaction $transactionRequestType = new AnetAPI\TransactionRequestType(); $transactionRequestType->setTransactionType("authCaptureTransaction"); $transactionRequestType->setAmount($_SESSION['bookprice']); $transactionRequestType->setOrder($order); $transactionRequestType->setPayment($paymentOne); $transactionRequestType->setBillTo($customerAddress); $transactionRequestType->setCustomer($customerData); $transactionRequestType->addToTransactionSettings($duplicateWindowSetting); $transactionRequestType->addToUserFields($merchantDefinedField1); $transactionRequestType->addToUserFields($merchantDefinedField2); $request = new AnetAPI\CreateTransactionRequest(); $request->setMerchantAuthentication($merchantAuthentication); $request->setRefId( $refId); $request->setTransactionRequest($transactionRequestType); $controller = new AnetController\CreateTransactionController($request); $response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX); print_r($response);
โ11-08-2019 06:44 AM