after form submission the page redirect payment gateway page. after success or failure page redirect corresponding page /success or /failure
script
$http({ url: "https://secure.payu.in/_payment", method: "get", }).success(function(data, status, headers, config) { console.log(data) console.log(status) }).error(function(data, status, headers, config) { $scope.status = status; console.log(status) }); $scope.payemntproceed=function(checkout){ $scope.payment.txnid=math.floor(100000000000+(math.random()*900000000000)); $scope.payment.salt="hseuiosb" $scope.payment.key="whlkgc"; $scope.payment.amount=1; $scope.payment.productinfo=$rootscope.cartlist $scope.payment.firstname=$rootscope.userinfo.name; $scope.payment.email=$rootscope.userinfo.email $scope.payment.phone=$rootscope.userinfo.contactno; $scope.payment.surl="http://localhost/august1stzustshop/#/home" $scope.payment.furl="http://localhost/august1stzustshop/#/checkout" $scope.payment.service_provider="payu_paisa" var string = $scope.payment.key + '|' + $scope.payment.txnid + '|' + $scope.payment.amount + '|' + $scope.payment.productinfo + '|' + $scope.payment.firstname + '|' + $scope.payment.email + '|||||||||||' + $scope.payment.salt; $scope.payment.hash = $scope.sha512(string); }
console shows this:
xmlhttprequest cannot load https://secure.payu.in/_payment. no 'access- control-allow-origin' header present on requested resource. origin 'http://localhost' therefore not allowed access. status -1.
it executing failure code.displaying status -1.
form.html
<form action="https://secure.payu.in/_payment" method="post" ng-submit="payemntproceed(checkout)"> <input type="text" ng-model="payment.txnid" name="txnid" > <input type="text" ng-model="payment.key" name="key" > <input type="text" ng-model="payment.amount" name="amount" > <input type="text" ng-model="payment.productinfo" name="productinfo" > <input type="text" ng-model="payment.firstname" name="firstname" > <input type="text" ng-model="payment.email" name="email" > <input type="text" ng-model="payment.phone" name="phone" > <input type="text" ng-model="payment.hash" name="hash" > <input type="text" ng-model="payment.surl" name="surl" > <input type="text" ng-model="payment.furl" name="furl"> <input type="text" ng-model="payment.service_provider" name="service_provider"> <button type="submit">submit</button>
please tell me how remove cross-origin problem.i using payu-money payment gateway.
the way stop xhr cross-origin error client side, while still making request, not use xhr.
get rid of javascript calls $http
, submit form normally.
Comments
Post a Comment