Search code examples
node.jssails.jsbitcoincoinbase-api

How to Handle a Coinbase Callback in NodeJS?


How to Handle a Coinbase Callback in NodeJS to Recieve Instant Bit Coin Payment Notifications ?

Please I need example.

Note : I'm using SailsJS MVC Framework.


Solution

  • OK, based on your comment, I will give it a go.

    I am assuming you have (or will have) an ExpressJs app.

    UPDATE Sorry, I just noticed you're using sailsjs. The below should still be valid but you'll need to adapt it to work with the sails routing engine.

    In your app, you need to define the post route:

    // the app variable is the express js server
    
    // name the route better than this...
    app.post('/coinbase', function(req, res){
    
        var data = req.body;
    
        var orderId = data.order.id; 
    
        // etc...      
    
    });