1

I am using cybersource as the payment gateway for my application. The payment information is sent correctly if we post the form without using an Ajax request.

Now we need to implement this by using an Ajax request. I tried passing the information to cybersource but got a javascript error "access denied" when I tried to submit the form using Ajax post request.

When I tried to debug this issue the line "mypostrequest.open("POST", "theUrl", true);" was giving the error.

Is there any reason why a site might block a post request through Ajax and not block a request from the usual form post ?

Thanks in advance.

Pawan Rao
  • 1,135
  • 2
  • 10
  • 11

1 Answers1

0

There should be no difference, from the perspective of the CyberSource server, between a post via AJAX or a normal form submit, so the server would not have a basis for deciding to block a post via AJAX. The "access denied" problem might be due to the fields and values you included in your post. Make sure all required fields are included.

dlaliberte
  • 3,250
  • 2
  • 25
  • 22
  • 1
    The "access denied" error is not produced by CyberSource, but buy the browser. See http://stackoverflow.com/questions/1681470/access-to-restricted-uri-denied-code-1012-cross-domain-ajax-request – Diego Jul 18 '12 at 22:16
  • 1
    Diego's comment is actually the correct answer. This is a CORS problem; I'm currently looking into this, but it doesn't appear that Cybersource offer a CORS-enabled endpoint. Instead they seem to require the use of an iframe, a la 2005. – Conan Nov 13 '15 at 16:14