Meteor(React) - HTTP Post call returning html page as a result


#1

I am trying to integrate payflow using meteor-ios application. Things is I was trying to redirect to payflow url from clientside, but it results in frequent reloading. As a result I am stuck with this refresh thing.

After going through some links I came to know: From the error code “999”, it looks like you are loading or reloading a second url before the UIWebView finished loading the first url. therefore, the system cancelled the first one and is trying to load the second url you passed to it. Or may be The problem I hit was that Cordova 2.7 didn’t handle client side redirect during startup correctly.

<form method="POST" action="https://pilot-payflowlink.paypal.com" target="_self">
<input type="hidden" name="LOGIN" value="XXXX"/>
<input type="hidden" name="PARTNER" value="XXXX"/>
<input type="hidden" name="DESCRIPTION" value="Order description here"/>
<input type="hidden" name="AMOUNT" value={this.props.post.amtToPay}/>
<input type="hidden" name="TYPE" value="S"/>
<input type="hidden" name="RETURNURL" value="link" />
<input type="hidden" name="CANCELURL" value="link" />
<input type="submit" className="btn btn col-lg-12 col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12 btn-Btn" value="Pay Now"/>
</form>

Now, I am trying to redirect to payflow from server side. But as a result I am getting HTML page. How to display it?

<form onSubmit={this.pay.bind(this)}>
<input type="submit" className="btn btn col-lg-12 col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12 btn-Btn" value="Pay Now"/>
</form>

pay(event){
    event.preventDefault();
    var amt = this.props.post.amtToPay;
    Meteor.call('paymentGateway',amt, (error,result)=>{
        if(error){
            console.log("client error"+error);
        }else{
            Session.set("paymentContent",result);
            FlowRouter.go("/paymentPage");
            console.log('result from client = ', result);
        }
    });     
}

  paymentGateway: function (amt) {

  if (Meteor.isServer) {
      var payflowInput = {
           "LOGIN"         :   "xxx",
           "PARTNER"       :   "xxx",
           "DESCRIPTION"   :   "Order description here",
           "AMOUNT"        :   amt,
           "TYPE"          : 'S',
           "RETURNURL"     : 'link',
           "CANCELURL"     : 'link',
      };


    try{
      const result = HTTP.call("POST", "https://pilot-payflowlink.paypal.com",
                             {params: payflowInput});

      console.log("result = ", result);
      if(result.statusCode == 200){
        return result;
      }
    }catch (e) {
      return false;
    }
  }
}

How to deal with this stuff?

Thanks in advance!