cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Drupal recurring payment works only with sandbox not live

I am using the Drupal moneyscripts module for recurring payments, everything works as it should, when I am using my Authorize.net sandbox account, but when I enter my live API key login
the module fails. meaning the user is not created in Drupal and the role is not assigned. but the catch is that the transaction does go through to authorize.net and gets approved there.
Only the Drupal side fails (a user is supposed to be created and role assigned) this works 100% using the authorize.net sandbox account, and the only thing I change is switching from sandbox to live.


I have included response messages from authorize from both and the line of error in the module. First is the response I get from the live account when Drupal fails second is the response from the sandbox when everything works 100%.


Authorize.Net AIM: Payment for Order 66 failed.
<pre>Authnet Object ( [login:Authnet:private] => [transkey:Authnet:private] => [params:Authnet:private] => Array ( [x_delim_data] => TRUE [x_delim_char] => | [x_relay_response] => FALSE [x_url] => FALSE [x_version] => 3.1 [x_method] => CC [x_type] => AUTH_CAPTURE [x_login] => 724Vs5JQht [x_tran_key] => xxxxxxvg5dX [x_card_num] => xxxxxx46 [x_exp_date] => 07/2014 [x_amount] => 0.01 [x_po_num] => [x_tax] => [x_card_code] => 484 [x_invoice_num] => [x_description] => The Calorie Myth - Monthly Membership - $0.01 every Month [x_first_name] => Davide [x_last_name] => ededd [x_address] => teststreet [x_city] => New York [x_zip] => 10538 [x_country] => US [x_email] => test@gmail.com [x_cust_id] => 0 [x_customer_ip] => 37.55.241.139 [x_email_customer] => FALSE [x_duplicate_window] => 0 ) [results:Authnet:private] => Array ( [0] => [1] => 1 [2] => [3] => [4] => 1 [5] => [6] => [7] => 1 [8] => [9] => [10] => This transaction has been approved. [11] => [12] => [13] => 228479 [14] => [15] => [16] => Z [17] => [18] => [19] => 5841731972 [20] => [21] => [22] => [23] => [24] => [25] => The Calorie Myth - Monthly Membership - $0.01 every Month [26] => [27] => [28] => 0.01 [29] => [30] => [31] => CC [32] => [33] => [34] => auth_capture [35] => [36] => [37] => 0 [38] => [39] => [40] => Davide [41] => [42] => [43] => ededd [44] => [45] => [46] => [47] => [48] => [49] => teststreet [50] => [51] => [52] => New York [53] => [54] => [55] => [56] => [57] => [58] => 10538 [59] => [60] => [61] => US [62] => [63] => [64] => [65] => [66] => [67] => [68] => [69] => [70] => test@gmail.com [71] => [72] => [73] => [74] => [75] => [76] => [77] => [78] => [79] => [80] => [81] => [82] => [83] => [84] => [85] => [86] => [87] => [88] => [89] => [90] => [91] => [92] => [93] => [94] => [95] => [96] => [97] => [98] => [99] => [100] => [101] => [102] => [103] => [104] => [105] => [106] => [107] => [108] => [109] => [110] => [111] => [112] => EA83CEE11EEFD957C634417DE9EEA716 [113] => [114] => [115] => M [116] => [117] => [118] => [119] => [120] => [121] => [122] => [123] => [124] => [125] => [126] => [127] => [128] => [129] => [130] => [131] => [132] => [133] => [134] => [135] => [136] => [137] => [138] => [139] => [140] => [141] => [142] => [143] => [144] => [145] => [146] => [147] => [148] => [149] => [150] => [151] => XXXX6646 [152] => [153] => [154] => MasterCard [155] => [156] => [157] => [158] => [159] => [160] => [161] => [162] => [163] => [164] => [165] => [166] => [167] => [168] => [169] => [170] => [171] => [172] => [173] => [174] => [175] => [176] => [177] => [178] => [179] => [180] => [181] => [182] => [183] => [184] => [185] => [186] => [187] => [188] => [189] => [190] => [191] => [192] => [193] => [194] => [195] => [196] => [197] => [198] => [199] => [200] => [201] => [202] => [203] => [204] => [205] => FALSE [206] => ) [approved:Authnet:private] => [declined:Authnet:private] => [error:Authnet:private] => 1 [test:Authnet:private] => [fields:Authnet:private] => x_delim_data=TRUE&x_delim_char=%7C&x_relay_response=FALSE&x_url=FALSE&x_version=3.1&x_method=CC&x_type=AUTH_CAPTURE&x_login=REMOVEDt&x_tran_key=REMOVEDX&x_card_num=REMOVED&x_exp_date=07%2F2014&x_amount=0.01&x_po_num=&x_tax=&x_card_code=484&x_invoice_num=&x_description=The+Calorie+Myth+-+Monthly+Membership+-+%240.01+every+Month&x_first_name=Davide&x_last_name=ededd&x_address=teststreet&x_city=New+York&x_zip=10538&x_country=US&x_email=test%40gmail.com&x_cust_id=0&x_customer_ip=37.55.241.139&x_email_customer=FALSE&x_duplicate_window=0& [response:Authnet:private] => |1|||1|||1|||This transaction has been approved.|||228479|||Z|||5841731972||||||The Calorie Myth - Monthly Membership - $0.01 every Month|||0.01|||CC|||auth_capture|||0|||Davide|||ededd||||||teststreet|||New York||||||10538|||US|||||||||test@gmail.com||||||||||||||||||||||||||||||||||||||||||EA83CEE11EEFD957C634417DE9EEA716|||M||||||||||||||||||||||||||||||||||||XXXX6646|||MasterCard|||||||||||||||||||||||||||||||||||||||||||||||||||FALSE| [url] => https://secure.authorize.net/gateway/transact.dll ) </pre>
Logged at /srv/bindings/1ea944aacfa249279fb86d3581f0d3b7/code/sites/all/modules/ms_core/gateways/ms_authorizenet/ms_authorizenet.module line 2098

 

this is the array from the debug message that I input on line 2098 the problem seems to be inside inside ms_authorizenet_charge() function. After $aim->proccess.


<pre>|1|||1|||1|||This transaction has been approved.|||00000|||Z|||00000||||||The Calorie Myth - Monthly Membership - $0.01 every Month|||0.01|||CC|||auth_capture|||0|||Davidee|||Dadadaee||||||teststreet|||New York||||||10538|||US|||||||||test@gmail.com||||||||||||||||||||||||||||||||||||||||||Eremoved0E2BA239F|||M||||||||||||||||||||||||||||||||||||XXXX6646|||MasterCard|||||||||||||||||||||||||||||||||||||||||||||||||||FALSE|</pre><pre>|1|||1|||1|||This transaction has been approved.|||095650|||Z|||5841959304||||||The Calorie Myth - Monthly Membership - $0.01 every Month|||0.01|||CC|||auth_capture|||0|||Davidee|||Dadadaee||||||teststreet|||New York||||||10538|||US|||||||||test@gmail.com||||||||||||||||||||||||||||||||||||||||||DD3B1A2B05FD7441BC3E972A0DC966ED|||M||||||||||||||||||||||||||||||||||||XXXX6646|||MasterCard|||||||||||||||||||||||||||||||||||||||||||||||||||FALSE|</pre><pre>|1|||1|||1|||This transaction has been approved.|||102322|||Z|||removed||||||The Calorie Myth - Monthly Membership - $0.01 every Month|||0.01|||CC|||auth_capture|||0|||Davidee|||Dadadaee||||||teststreet|||New York||||||10538|||US|||||||||test@gmail.com||||||||||||||||||||||||||||||||||||||||||removed|||M||||||||||||||||||||||||||||||||||||XXXX6646|||MasterCard|||||||||||||||||||||||||||||||||||||||||||||||||||FALSE|</pre>

 

This is the response from sandbox when everything works 100%


Authnet Object
(
[login:Authnet:private] =>
[transkey:Authnet:private] =>
[params:Authnet:private] => Array
(
[x_delim_data] => TRUE
[x_delim_char] => |
[x_relay_response] => FALSE
[x_url] => FALSE
[x_version] => 3.1
[x_method] => CC
[x_type] => AUTH_CAPTURE
[x_login] => 8xxxxxx8
[x_tran_key] => 4xxxxxxx
[x_card_num] => 4111111111111111
[x_exp_date] => 10/2014
[x_amount] => 0.01
[x_po_num] =>
[x_tax] =>
[x_card_code] => 111
[x_invoice_num] =>
[x_description] => The Calorie Myth - Monthly Membership - $0.01 every Month
[x_first_name] => David
[x_last_name] => Bacham
[x_address] => sadds
[x_city] => chicago
[x_zip] => 15151
[x_country] => US
[x_email] => test@gmail.com
[x_cust_id] => 0
[x_customer_ip] => 37.55.241.139
[x_email_customer] => FALSE
)

[results:Authnet:private] => Array
(
[0] => 1
[1] => 1
[2] => 1
[3] => This transaction has been approved.
[4] => SRFO9I
[5] => Y
[6] => 2204549942
[7] =>
[8] => The Calorie Myth - Monthly Membership - $0.01 every Month
[9] => 0.01
[10] => CC
[11] => auth_capture
[12] => 0
[13] => David
[14] => Bacham
[15] =>
[16] => sadds
[17] => chicago
[18] =>
[19] => 15151
[20] => US
[21] =>
[22] =>
[23] => test@gmail.com
[24] =>
[25] =>
[26] =>
[27] =>
[28] =>
[29] =>
[30] =>
[31] =>
[32] =>
[33] =>
[34] =>
[35] =>
[36] =>
[37] => C58xxxxxxxx546B37A
[38] => P
[39] => 2
[40] =>
[41] =>
[42] =>
[43] =>
[44] =>
[45] =>
[46] =>
[47] =>
[48] =>
[49] =>
[50] => XXXX1111
[51] => Visa
[52] =>
[53] =>
[54] =>
[55] =>
[56] =>
[57] =>
[58] =>
[59] =>
[60] =>
[61] =>
[62] =>
[63] =>
[64] =>
[65] =>
[66] =>
[67] =>
[68] => FALSE
)

[approved:Authnet:private] => 1
[declined:Authnet:private] =>
[error:Authnet:private] =>
[test:Authnet:private] => 1
[fields:Authnet:private] => x_delim_data=TRUE&x_delim_char=%7C&x_relay_response=FALSE&x_url=FALSE&x_version=3.1&x_method=CC&x_type=AUTH_CAPTURE&x_login=8Cxxxx&x_tran_key=xxxxx49vP&x_card_num=4111111111111111&x_exp_date=10%2F2014&x_amount=0.01&x_po_num=&x_tax=&x_card_code=111&x_invoice_num=&x_description=The+Calorie+Myth+-+Monthly+Membership+-+%240.01+every+Month&x_first_name=David&x_last_name=Bacham&x_address=sadds&x_city=chicago&x_zip=15151&x_country=US&x_email=test%40gmail.com&x_cust_id=0&x_customer_ip=37.55.241.139&x_email_customer=FALSE&
[response:Authnet:private] => 1|1|1|This transaction has been approved.|SRFO9I|Y|2204549942||The Calorie Myth - Monthly Membership - $0.01 every Month|0.01|CC|auth_capture|0|David|Bacham||sadds|chicago||15151|US|||test@gmail.com||||||||||||||C58104D65E4F190912F1D9CCD546B37A|P|2|||||||||||XXXX1111|Visa|||||||||||||||||FALSE
[url] => https://test.authorize.net/gateway/transact.dll
)

 

 


Here is the code from the module that is throwing the error, I left in the watchdog debug statement so you can see what line 2098 is.

 

if ($response['approved'] == TRUE) {
// Insert the Payment to the database for the Free Trial
$payment = ms_core_new_payment($order->oid, 'ms_authorizenet_cim', 'rec_signup');
$payment->transaction = $response['data']['txn_id'];
$payment->currency = 'USD';
$payment->data = $payment_profile;
$payment->recurring_schedule = $order->recurring_schedule;

// Update the address
$payment->billing_address = array(
'street' => trim($v['billing_address1']) .'\n'. trim($v['billing_address2']),
'city' => trim($v['billing_city']),
'state' => trim($v['billing_state']),
'zip' => trim($v['billing_zip']),
'country' => trim($v['billing_country']),
'phone' => trim($v['billing_phone']),
);
$payment->shipping_address = $payment->billing_address;

// Update the contact details
$payment->first_name = trim($v['cc_first_name']);
$payment->last_name = trim($v['cc_last_name']);
$payment->recurring_id = $order->oid;

// Add the Payment to the Order
ms_core_enter_payment($payment, FALSE);

// Save the CIM profiles
if (variable_get('ms_authorizenet_cim_profile', FALSE)) {
$order = ms_core_order_load($order->oid);
// Create the profile without validating since the AIM is valid
$cim_result = ms_authorizenet_create_cim_profiles_from_order($order, $v, FALSE);
if ($cim_result['success']) {
// Add the payment to the order
$form_state['values']['ms_oid'] = $order->oid;
$form_state['values']['ms_order_charged'] = TRUE;
}
else {
form_set_error('ccnumber', t('Error') . ': ' . $cim_result['error']);
}
}
else {
form_set_error('ccnumber', t('Error: There was a configuration error in the settings.'));
}
}
else { // The Credit Card was not approved, set an error on the form
form_set_error('ccnumber', t('Error') .': '. $response['message']);
}
}
else {
// Check if there is a trial
$amount = ($order->recurring_schedule['trial_length']) ? $order->recurring_schedule['trial_amount'] : $order->recurring_schedule['main_amount'];

//my debug message line 2098
watchdog('ms', '2-V<pre>' . print_r($v , 1) . '</pre>', array(), WATCHDOG_WARNING);
$response = ms_authorizenet_charge($order, $amount, $v);
watchdog('ms', '2-ORDER<pre>' . print_r($response , 1) . '</pre>', array(), WATCHDOG_WARNING);



// Use AIM for the first charge

if ($response['approved'] == TRUE) {
// Insert the Payment to the database for the Free Trial
$payment = ms_core_new_payment($order->oid, 'ms_authorizenet_cim', 'rec_signup');
$payment->transaction = $response['data']['txn_id'];
$payment->currency = 'USD';
$payment->data = $payment_profile;
$payment->recurring_schedule = $order->recurring_schedule;

// Update the address
$payment->billing_address = array(
'street' => trim($v['billing_address1']) .'\n'. trim($v['billing_address2']),
'city' => trim($v['billing_city']),
'state' => trim($v['billing_state']),
'zip' => trim($v['billing_zip']),
'country' => trim($v['billing_country']),
'phone' => trim($v['billing_phone']),
);
$payment->shipping_address = $payment->billing_address;
$payment->recurring_id = $order->oid;

// Update the contact details
$payment->first_name = trim($v['cc_first_name']);
$payment->last_name = trim($v['cc_last_name']);

// Add the Payment to the Order
ms_core_enter_payment($payment, FALSE);

// Save the CIM profiles
if (variable_get('ms_authorizenet_cim_profile', FALSE)) {
$order = ms_core_order_load($order->oid);
// Create the profile without validating since the AIM is valid
$cim_result = ms_authorizenet_create_cim_profiles_from_order($order, $v, FALSE);
if ($cim_result['success']) {
// Add the rec_payment payment to the order
$payment->type = 'rec_payment';
$payment->amount = $amount;
ms_core_enter_payment($payment, FALSE);

// Add the payment to the order
$form_state['values']['ms_oid'] = $order->oid;
$form_state['values']['ms_order_charged'] = TRUE;
}
else {
form_set_error('ccnumber', t('Error') . ': ' . $cim_result['error']);
}
}
else {
form_set_error('ccnumber', t('Error: There was a configuration error in the settings.'));
}
}
else { // The Credit Card was not approved, set an error on the form

form_set_error('ccnumber', t('Error') .': '. $response['message']);
}


}

kreid86
Member
1 REPLY 1

1|1|1|This transaction has been approved.|SRFO9I|Y|2204549942||The Calorie Myth - Monthly Membership - $0.01 every Month|0.01|CC|auth_capture|0|David|Bacham||sadds|chicago||15151|US|||test@gmail.com||||||||||||||C58104D65E4F190912F1D9CCD546B37A|P|2|||||||||||XXXX1111|Visa|||||||||||||||||FALSE

 

|1|||1|||1|||This transaction has been approved.|||228479|||Z|||5841731972||||||The Calorie Myth - Monthly Membership - $0.01 every Month|||0.01|||CC|||auth_capture|||0|||Davide|||ed

edd||||||teststreet|||New York||||||10538|||US|||||||||test@gmail.com||||||||||||||||||||||||||||||||||||||||||EA83CEE11EEFD957C634417DE9EEA716|||M||||||||||||||||||||||||||||||||||||XXXX6646|||MasterCard|||||||||||||||||||||||||||||||||||||||||||||||||||FALSE|

 

 

Look to me you have the x_encap_char set on the production settings as "|"

RaynorC1emen7
Expert