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.....
03-20-2013 12:05 PM
It not the data, it is on the request
03-20-2013 01:03 PM
Thanks. Do you mean the request sending to, or request response coming back?
03-20-2013 01:47 PM
request sending.
03-20-2013 04:06 PM
Since I get the error then atleaset its getting to Authorize.net right?
03-21-2013 05:06 AM
yes. that an authorize.net error
03-21-2013 05:19 AM
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); }
03-21-2013 07:03 AM - edited 03-21-2013 07:03 AM
does it run?
03-21-2013 07:06 AM
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
03-21-2013 07:15 AM
Should do it the same way as you show in on your other post
$content = .....
03-21-2013 07:30 AM