Hi,
I am having an issue with Sandbox working everytime and Production failing every time.
For Sandbox I use the following code in php:
<?php
$xmlContent = '<createTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
<merchantAuthentication>
<name>327zFYy6</name>
<transactionKey>7A66szz53F6N67YK</transactionKey>
</merchantAuthentication>
<transactionRequest>
<transactionType>authCaptureTransaction</transactionType>
<amount>2.70</amount>
<payment>
<creditCard>
<cardNumber>xxxxxxxxxxxxxxxx</cardNumber> I used a real credit card
<expirationDate>1119</expirationDate>
<cardCode>002</cardCode>
</creditCard>
</payment>
<customer>
<id>Ryan Moore</id>
</customer>
<billTo>
<firstName>Ryan</firstName>
<lastName>Moore</lastName>
<address>3780 Rosin Court</address>
<city>Sacramento</city>
<state>CA</state>
<zip>95834</zip>
<country>USA</country>
</billTo>
<transactionSettings>
</transactionSettings>
</transactionRequest>
</createTransactionRequest>';
$url = 'https://apitest.authorize.net/xml/v1/request.api';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true );
curl_setopt($ch, CURLOPT_POSTFIELDS, $xmlContent);
$result = curl_exec($ch);
//echo "<pre> Result Array: <br>";
//print_r($result);
//echo "<pre>";
echo "Result: " . $result . "<br>";
echo "<br>";
$err_status = curl_error($ch);
echo "Err Status: " . $err_status . "<br>";
curl_close($ch);
echo "URL: " . $url . "<br>";
$curl_info = curl_version();
echo "SSL: " . $curl_info['ssl_version'] . "<br>";
$ch = curl_init('https://www.howsmyssl.com/a/check');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$data = curl_exec($ch);
curl_close($ch);
$json = json_decode($data);
echo "TLS: " . $json->tls_version ."<br>";
?>
I get:
Result: OkI00001Successful. 1FQ6V8EYP2400256621287ECA7D1F270049DF9846976B8B3F5A3F0XXXX0027MasterCard1This transaction has been approved.
Err Status:
URL: https://apitest.authorize.net/xml/v1/request.api
SSL: OpenSSL/1.0.2m
TLS: TLS 1.2
----------------------------------------------------------------------------------------------
For Production I changed only the following three lines. I used my live 11 digit account id and live transaction key. I changed from apitest to api for the url.
<name>xxxxxxxxxxx</name>
<transactionKey>xxxxxxxxxxxxxxxx</transactionKey>
$url = 'https://api.authorize.net/xml/v1/request.api';
I get:
Result:
Err Status: OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.authorize.net:443
URL: https://api.authorize.net/xml/v1/request.api
SSL: OpenSSL/1.0.2m
TLS: TLS 1.2