Showing results for 
Search instead for 
Did you mean: 

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:

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 = '';

  $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);
  print $content;
  curl_close ($ch);



Thanks for the help.

Chris W


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


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: