Integration and Testing

Authorize.Net API questions and help with your payment integration.

Reply
Regular Contributor
Posts: 82
Registered: ‎02-15-2013

Getting error E00002 The content-type specified is not supported

I am getting error E00002 The content-type specified is not supported. The only supported content-types are text/xml
and application/xml.

 

Does this look correct? If so then I can look somewhere else in the code.

$_ = array('<?xml version="1.0"encoding=\"utf-8\" ?>'."\n");
$_[] = '<createCustomerProfileTransactionRequest xmlns=\"https://api.authorize.net/xml/v1/request.api\">';		
$_[] = '<merchantAuthentication>';
$_[] = '<name>xxx</name>';
$_[] = '<transactionKey>xxx</transactionKey>';
$_[] = '</merchantAuthentication>';
$_[] = '<Transaction>';

$_[] = '<profileTransAuthCapture>'; ..and so on.....

 

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Getting error E00002 The content-type specified is not supported

It not the data, it is on the request

 

Regular Contributor
Posts: 82
Registered: ‎02-15-2013

Re: Getting error E00002 The content-type specified is not supported

Thanks. Do you mean the request sending to, or request response coming back?

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Getting error E00002 The content-type specified is not supported

request sending.

Regular Contributor
Posts: 82
Registered: ‎02-15-2013

Re: Getting error E00002 The content-type specified is not supported

Since I get the error then atleaset its getting to Authorize.net right?

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Getting error E00002 The content-type specified is not supported

yes. that an authorize.net error

Regular Contributor
Posts: 82
Registered: ‎02-15-2013

Re: Getting error E00002 The content-type specified is not supported

[ Edited ]

I revised my code to use curl and this is what I have. Does this look correct?

 

$Order = $this->Order;
	
$xml = '
 
<?xml version="1.0" encoding="UTF-8"?>
<createCustomerProfileTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">		
<merchantAuthentication>
<name>xxx</name>
<transactionKey>xxx</transactionKey>
</merchantAuthentication>
<Transaction>
<profileTransAuthCapture>
<amount>10.95</amount>
<tax>
<amount>1.00</amount>
<name>state sales tax</name>
<description>descstate sales tax</description>
</tax>
<lineItems>
<lineItem>
<itemId>1</itemId>
<name>widget 5</name>
<description>desc of widgt 5</description>
<quantity>2</quantity>
<unitPrice>5.00</unitPrice>
</lineItem>
<lineItem>
<itemId>2</itemId>
<name>widget 6</name>
<description>desccrition widget 6</description>
<quantity>1</quantity>
<unitPrice>8.00</unitPrice>
</lineItem>
</lineItems>
<customerProfileId>129</customerProfileId>
<customerPaymentProfileId>119</customerPaymentProfileId>
<customerShippingAddressId>120</customerShippingAddressId>
<order>
<invoiceNumber >INV000005</invoiceNumber>
<description>description of transaction</description>
<purchaseOrderNumber>PONUM000005</purchaseOrderNumber>
</order>
<taxExempt>false</taxExempt>
<recurringBilling>false</recurringBilling>
<cardCode>000</cardCode>
</profileTransAuthCapture>
</transaction>
</createCustomerProfileTransactionRequest>';
		 
		
$url = "https://apitest.authorize.net/xml/v1/request.api";
 
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_MUTE, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: text/xml'));
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
 }	

 

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Getting error E00002 The content-type specified is not supported

does it run?

Regular Contributor
Posts: 82
Registered: ‎02-15-2013

Re: Getting error E00002 The content-type specified is not supported

When I echo the $xml I just get a line on the top of the screen with the values all run together. It does't print

<?xml version="1.0" encoding="UTF-8"?>
<createCustomerProfileTransactionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">        
<merchantAuthentication>
<name>8p96LNvvGVj</name>
<transactionKey>66W332LWLW7jaGyd</transactionKey>
</merchantAuthentication>
<Transaction>
<profileTransAuthCapture>
<amount>10.95</amount>
<tax>
<amount>1.00</amount>
<name>state sales tax</name>
<description>descstate sales tax</description>
</tax>  and so on......

 

 

Instead it shows:
xxxx  xxxx 10.95 1.00 state sales tax descstate sales tax 1 widget 5 desc of widgt 5 2 5.00 2 widget 6 desccrition widget 6 1 8.00 12940902 11936459 12031425 INV000005 description of transaction PONUM000005 false false 000

Expert
Posts: 4,525
Registered: ‎03-08-2010

Re: Getting error E00002 The content-type specified is not supported

Should do it the same way as you show in on your other post

http://community.developer.authorize.net/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/3340...

 

$content = .....