1

I am new in angularjs, integrating paytm wallet in my web app. when i am sending request paytm server from my angular js function , it is showing this error:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://pguat.paytm.com/oltp-web/processTransaction?orderid=data.ORDER_ID. (Reason: CORS request failed).

here is my function

function sendDataToPaytm(data)
{
    var defer = $q.defer();
    console.log(data);

    $http.defaults.headers.common['Access-Control-Allow-Origin'] =  "*";
    $http.defaults.headers.common['Access-Control-Allow-Methods'] = "POST, GET, OPTIONS, PATCH, DELETE";
    $http.defaults.headers.common['Access-Control-Allow-Headers'] = "Origin, X-Requested-With, Content-Type, Accept";
    console.log($http);
    console.log();

    var url = 'https://pguat.paytm.com/oltp-web/processTransaction?orderid=data.ORDER_ID';
    $http.post(url, data, headers)
    .success(function(data, status, headers, config){
        defer.resolve([status, data]);
    })
    .error(function(data, status, headers, config){
        //console.log("Error in getting sellers info");
        defer.resolve([status, data]);
    });

    return defer.promise;
}

please help me to solve this

2
  • Were you able to solve it? I am facing the same issue. Commented Oct 22, 2016 at 8:15
  • I am also the same issue. It seems like somehow we need to configure IP of the testing system on paytm business site. Commented Sep 8, 2022 at 14:40

1 Answer 1

0

The Access-Control-Allow-Origin header is a response header that has to be set server side. That is, if the respective server doesn't send this header, the browser prevents you from requesting information from this server due to cross server (domain, subdomain and protocol) infringement.

It would allow requests only if the originating page was served by the same server (domain, subdomain and protocol).

Sign up to request clarification or add additional context in comments.

1 Comment

Paytm server is not in our control. The calling server or calling client only needs to do some modification on there side in order to avoid this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.