--- uc_authorizenet.module	Tue Oct 20 15:58:08 2009
+++ uc_authorizenet.module.new	Sat Nov 21 03:52:51 2009
@@ -8,6 +8,8 @@
  * Development sponsored by Digital Dollhouse - http://www.digitaldollhouse.com
  */
 
+define('UC_AUTHORIZENET_TEST_GATEWAY_URL', 'https://test.authorize.net/gateway/transact.dll');
+define('UC_AUTHORIZENET_LIVE_GATEWAY_URL', 'https://secure.authorize.net/gateway/transact.dll');
 
 /**
  * Implementation of hook_menu().
@@ -107,6 +109,18 @@ function uc_authorizenet_settings_form()
     '#title' => t('Transaction Key'),
     '#default_value' => variable_get('uc_authnet_api_transaction_key', ''),
   );
+  $form['api_id_key']['uc_authnet_api_test_gateway_url'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Authorize.net Test Gateway URL'),
+    '#default_value' => variable_get('uc_authnet_api_test_gateway_url',
+                                     UC_AUTHORIZENET_TEST_GATEWAY_URL),
+  );
+  $form['api_id_key']['uc_authnet_api_live_gateway_url'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Authorize.net Live Gateway URL'),
+    '#default_value' => variable_get('uc_authnet_api_live_gateway_url',
+                                     UC_AUTHORIZENET_LIVE_GATEWAY_URL),
+  );
 
   $form['aim_settings'] = array(
     '#type' => 'fieldset',
@@ -508,10 +522,12 @@ function _uc_authorizenet_charge($order,
 
   // Determine the correct URL based on the transaction mode.
   if (variable_get('uc_authnet_aim_txn_mode', 'live_test') == 'developer_test') {
-    $post_url = 'https://test.authorize.net/gateway/transact.dll';
+    $post_url = variable_get('uc_authnet_api_test_gateway_url',
+                             UC_AUTHORIZENET_TEST_GATEWAY_URL);
   }
   else {
-    $post_url = 'https://secure.authorize.net/gateway/transact.dll';
+    $post_url = variable_get('uc_authnet_api_live_gateway_url',
+                             UC_AUTHORIZENET_LIVE_GATEWAY_URL);
   }
 
   // Translate the data array into a string we can POST.
