I'm just starting to test and am getting the error: (13) The merchant login ID or password is invalid or the account is inactive.
I am using a live account and have put it in test mode. If I put the same varriables into a html form everything works fine however if post them via php using curl I get the error. The example I'm using below is pretty straight forward but maybe I've overlooked something that someone can spot. Perhaps I have to actually activate the account in some way I've missed, is this possible? Any help would be greatly apprecated. Again I am not using the developer account but the live account in test mode.
Thanks,
Joe
<?php
$data = array(
'x_login' => 'omitted',
'x_tran_key' => 'omitted',
'x_type' => 'CAPTURE_ONLY',
'x_amount' => '27.00',
'x_card_num' => '4007000000027',
'x_exp_date' => '04-15'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://secure.authorize.net/gateway/transact.dll');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
?>
Solved! Go to Solution.
05-23-2012 03:32 PM
From Sample Code
your $data is $post_values in the sample code
$post_string = "";
foreach( $post_values as $key => $value ) { $post_string .= "$key=" . urlencode( $value ) . "&"; } $post_string = rtrim( $post_string, "& " );
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
From http://www.php.net/manual/en/function.curl-setopt.php
Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data, while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded.
05-23-2012 04:22 PM
From Sample Code
your $data is $post_values in the sample code
$post_string = "";
foreach( $post_values as $key => $value ) { $post_string .= "$key=" . urlencode( $value ) . "&"; } $post_string = rtrim( $post_string, "& " );
curl_setopt($request, CURLOPT_POSTFIELDS, $post_string);
From http://www.php.net/manual/en/function.curl-setopt.php
Passing an array to CURLOPT_POSTFIELDS will encode the data as multipart/form-data, while passing a URL-encoded string will encode the data as application/x-www-form-urlencoded.
05-23-2012 04:22 PM
Thanks!!!
I new I had overlooked something.
05-23-2012 04:36 PM