- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
API error E00001 when calling getHostedPaymentPageRequest using example data
I've read several messages about this error but none seem to apply. I'm writing my own simple php code to make transactions. It seems easier than installing the full sdk on a server I can't control since I only need the ability to charge credit cards.
I first used the "Try it" feature from this page:
https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-credit-card
and that worked fine. So I coppied the json data from the sample on that page and now I can't get it to work.
Here is the php code I am using.
$json = "......"; // this really has the json data I coppied from the "Try it" page. $AIMURL = 'https://apitest.authorize.net/xml/v1/request.api'; $HttpHeaderArray[] = 'content-type: application/json'; $HttpHeaderArray[] = 'Content-Length: ' . strlen($json); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $AIMURL); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POSTFIELDS, $json); curl_setopt($ch, CURLOPT_HTTPHEADER, $HttpHeaderArray); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $content = curl_exec($ch); printr(curl_error($ch)); print $content; curl_close ($ch);
Thanks for the help.
Chris W
โ06-06-2018 10:53 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I decided to try it using xml instead of json (FYI I hate how much badwidth xml wastes so I try to avoid it as a means of data transfer) Anyway the xml version worked.
I noticed the url has xml as part of it. Should the url for json request be different? I tried changing the xml in the url to json but that just returned a 404 error.
The only thing I changed in the code was:
'content-type: application/json' to 'content-type: application/xml'
And of course sent the xml content I coppied from the "Try it" page was sent instead of the json text and I also set the content length to be strlen($xml) instead of $json.
So any idea why xml works but json doesn't?
Chris W
โ06-07-2018 05:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure if it was the cause in this case, but theree are certain issues with current Json APIs as they are based on the XML APIs. Fully REST Json APIs are in the pipeline.
Old issues: https://community.developer.authorize.net/t5/Integration-and-Testing/createCustomerProfileRequest-wo...
โ06-11-2018 11:48 AM - edited โ06-11-2018 11:51 AM