Search code examples
http-redirectmeteoriron-router

Redirect to other than App url


I'm currently working on e-commerce based website for our country.I need to integrate a local payment gateway solution. The architecture of that system is actually to based on REST. so I need to post several data to a specific url and they response back with a content of another url where my app should be redirected. After the transaction either success/failed/canceled, the third party system redirects back to my app url.

now I'm having problem with redirecting to the third-party url from my app.

var result =  HTTP.post(url,{params:data_me});
console.log(result.content+' ....');

The post method is synchronous and i recieve the url properly. how do I now redirect my app to their response url. Note: these statements are written in a server method. And I'm using iron router for my app.


Solution

  • Since you're doing the integration on the server, have the server method return the new url to the client. Then on the client simply do:

     window.location=url;
    

    iron-router won't take you to an offsite url because it only manages internal routes.

    docs