I've searched a while for a awnser or hint to my problem. Whenever I send a request using CIM and CURL, I get a Bad Request error back.
The request Im sending is as follows (Merchant info X'ed out).
<?xml version="1.0" encoding="UTF-8"?> <createCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"> <merchantAuthentication> <name>XXXXXXXXXX</name> <transactionKey>XXXXXXXXXX</transactionKey> </merchantAuthentication> <profile> <merchantCustomerId>1</merchantCustomerId> <description>Jerrod Davenport</description> <email>1@gmail.com</email> <paymentProfiles> <customerType>individual</customerType> <payment> <creditCard> <cardNumber>3451562436918418</cardNumber> <expirationDate>2021-10</expirationDate> </creditCard> </payment> </paymentProfiles> </profile> <validationMode>none</validationMode> </createCustomerProfileRequest>
My CURL code
$curl_request = curl_init();
curl_setopt($curl_request, CURLOPT_URL, "https://apitest.authorize.net/xml/v1/request.api");
curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl_request, CURLOPT_HTTPHEADER, Array("Content-Type: text/xml"));
curl_setopt($curl_request, CURLOPT_HEADER, 0);
curl_setopt($curl_request, CURLOPT_POSTFIELDS, $xml);
curl_setopt($curl_request, CURLOPT_POST, 1);
curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($curl_request, CURLOPT_CAINFO, '/URL_PATH/authroize/ssl/cert.pem');
$curl_response = curl_exec($curl_request);
curl_close($curl_request);
I've tried turning verify host to true and false. No luck. Tried several pem files which where linked on these forums.
The esacted response I get is:
Bad Request
Your browser sent a request that this server could not understand.
Reference #7.d5600c50.1459784729.2100bd1)
Solved! Go to Solution.
04-04-2016 09:08 AM
My bad, the XML writer function I was using was empty. Problem solved :)
04-04-2016 09:57 AM
My bad, the XML writer function I was using was empty. Problem solved :)
04-04-2016 09:57 AM