0

I'm implementing PayU payment module in my Meteor app. Flow works well, it shows proper order view and it redirects to proper continueUrl. In PayU API there is also notifyUrl and PayU can send POST request to that url if there is change in order's status. When there is, for example COMPLETED status I should execute update in mongoDB and change user's account type.

But I don't have any idea how to make it. Should I make html file on meteor's server side? If it's possible what link should I pass in notifyUrl to make PayU request pass to that html file?

Mossar
  • 425
  • 1
  • 5
  • 14

1 Answers1

0

Did you try with the HTTP? package? something like this.

First add it.

meteor add http

Then create a method like this.

Meteor.methods({
  someMethodName: function() {
    return HTTP.call("POST", "http://payuIrl", {
        data: {
          idk "data",
            stuff: JSON.stringify(myObject);
        }
      });
  }
});

and then on the client you can create a Meteor.call on the client.

Meteor.call('someMethodName',function(erro,result){
 if(error){
   //show some error
  }else{
   if(_.isEqual(result.status,'status200'){
      //run update here
    }
  }
});

Or you can run the update on the server without the Meteor.methods and Meteor.calls

Ethaan
  • 11,291
  • 5
  • 35
  • 45