I am running ecommerce on a WP platform the recent 3.3 update left my cart not accepting Authorizenet, I was instructed by my theme support to download the new Authorizenet modules and files. after doing so I submit an order and ot brings this ERORR. I am not in TST mode and my LOG ID and Transaction Key are correct I ned to change some code somewhwre in these files can someone here help me find the code and change it ASAP? I wouod be so greatful this is a nightmare before XMAs and I can process orders.
12-19-2011 08:31 AM
Hello please help I am using AIM with PHP here is code from my AuthorizeNetAIM.php file
<?php
/**
* Easily interact with the Authorize.Net AIM API.
*
* Example Authorize and Capture Transaction against the Sandbox:
* <code>
* <?php require_once 'AuthorizeNet.php'
* $sale = new AuthorizeNetAIM;
* $sale->setFields(
* array(
* 'amount' => '4.99',
* 'card_num' => '411111111111111',
* 'exp_date' => '0515'
* )
* );
* $response = $sale->authorizeAndCapture();
* if ($response->approved) {
* echo "Sale successful!"; } else {
* echo $response->error_message;
* }
* ?>
* </code>
*
* Note: To send requests to the live gateway, either define this:
* define("AUTHORIZENET_SANDBOX", false);
* -- OR --
* $sale = new AuthorizeNetAIM;
* $sale->setSandbox(false);
*
* @package AuthorizeNet
* @subpackage AuthorizeNetAIM
* @link http://www.authorize.net/support/AIM_guide.pdf AIM Guide
*/
/**
* Builds and sends an AuthorizeNet AIM Request.
*
* @package AuthorizeNet
* @subpackage AuthorizeNetAIM
*/
class AuthorizeNetAIM extends AuthorizeNetRequest
{
const LIVE_URL = 'https://secure.authorize.net/gateway/transact.dll';
const SANDBOX_URL = 'https://test.authorize.net/gateway/transact.dll';
/**
* Holds all the x_* name/values that will be posted in the request.
* Default values are provided for best practice fields.
*/
protected $_x_post_fields = array(
"version" => "3.1",
"delim_char" => ",",
"delim_data" => "TRUE",
"relay_response" => "FALSE",
"encap_char" => "|",
);
12-19-2011 11:26 AM
* Note: To send requests to the live gateway, either define this: * define("AUTHORIZENET_SANDBOX", false); * -- OR -- * $sale = new AuthorizeNetAIM; * $sale->setSandbox(false); * * @package AuthorizeNet * @subpackage AuthorizeNetAIM * @link http://www.authorize.net/support/AIM_guide.pdf AIM Guide */
If you are using production id and key. Did you do the above?
12-19-2011 11:30 AM
no this code was written by my shopping cart theme developers. Is it not correct?
12-19-2011 11:33 AM
It look correct, and look a lot like the php SDK, but you need to do what it said.
12-19-2011 11:42 AM - edited 12-19-2011 11:44 AM
please excuse my ignorance but ypu asked "Did you do the above" ... I havent done anything and if I am to do what the code says to do where do I find this code is it on this same page or am I to read the PDF? I am a newbie to PHP :) just trying my best to fix this today
12-19-2011 11:52 AM
this code is in another file AuthorizeNetRequest.php there are many files in SDK its confusing
<?php
/**
* Sends requests to the Authorize.Net gateways.
*
* @package AuthorizeNet
* @subpackage AuthorizeNetRequest
*/
abstract class AuthorizeNetRequest
{
protected $_api_login;
protected $_transaction_key;
protected $_post_string;
public $VERIFY_PEER = true; // Set to false if getting connection errors.
protected $_sandbox = true;
protected $_log_file = false;
/**
* Set the _post_string
*/
abstract protected function _setPostString();
/**
* Handle the response string
*/
abstract protected function _handleResponse($string);
/**
* Get the post url. We need this because until 5.3 you
* you could not access child constants in a parent class.
*/
abstract protected function _getPostUrl();
/**
* Constructor.
*
* @param string $api_login_id The Merchant's API Login ID.
* @param string $transaction_key The Merchant's Transaction Key.
*/
public function __construct($api_login_id = false, $transaction_key = false)
{
$this->_api_login = ($api_login_id ? $api_login_id : (defined('AUTHORIZENET_API_LOGIN_ID') ? AUTHORIZENET_API_LOGIN_ID : ""));
$this->_transaction_key = ($transaction_key ? $transaction_key : (defined('AUTHORIZENET_TRANSACTION_KEY') ? AUTHORIZENET_TRANSACTION_KEY : ""));
$this->_sandbox = (defined('AUTHORIZENET_SANDBOX') ? AUTHORIZENET_SANDBOX : true);
$this->_log_file = (defined('AUTHORIZENET_LOG_FILE') ? AUTHORIZENET_LOG_FILE : false);
12-19-2011 11:58 AM
I'm not a php developer either:smileysad:.
But from the SDK readme.html
<?php require_once 'anet_php_sdk/AuthorizeNet.php'; define("AUTHORIZENET_API_LOGIN_ID", "YOURLOGIN"); define("AUTHORIZENET_TRANSACTION_KEY", "YOURKEY"); define("AUTHORIZENET_SANDBOX", true); $sale = new AuthorizeNetAIM; $sale->amount = "5.99"; $sale->card_num = '6011000000000012'; $sale->exp_date = '04/15'; $response = $sale->authorizeAndCapture(); if ($response->approved) { $transaction_id = $response->transaction_id; } ?>
So, I would said where you define your AUTHORIZENET_API_LOGIN_ID and AUTHORIZENET_TRANSACTION_KEY
define AUTHORIZENET_SANDBOX to false
12-19-2011 12:01 PM
You shouldn't be modifying most, if any, of the files in the PHP SDK. You're supposed to set up the configuration files with your login and transaction key, etc, and then plug in the appropriate parts to your code where the transaction occurs. All that stuff your posting shouldn't be touched.
12-19-2011 12:12 PM
Yeah I don't think I am to type in my actual LOGIN ID and Transaction Key into this PHP code that should be "protected" but I may make that _SANDBOX to false and see what happens?
12-19-2011 12:17 PM