pawan-delhi / payumoney-node

5 stars 7 forks source link

Response is undefined #7

Open schezwansoftware opened 5 years ago

schezwansoftware commented 5 years ago

I am getting response as undefined.

 [](paymoneyService.setKeys(PAYU_MERCHANT_KEY, PAYU_MERCHANT_SALT, PAYU_AUTH_HEADER);

paymoneyService.isProdMode(true); console.log(PAYU_MERCHANT_KEY, PAYU_MERCHANT_SALT, PAYU_AUTH_HEADER); paymentRequest.txnid = uuid(); //this needs to be saved. paymentRequest.surl = http://localhost:3000/api/v1/wallet/payment/success/${paymentRequest.customerId}/${paymentRequest.amount}; paymentRequest.furl = 'http://localhost:3000/api/v1/wallet/payment/failure'; )

imdkbj commented 5 years ago

Same here! Any help?

chrisstone07 commented 4 years ago

Getting the same error as well, @pawan-delhi u need to have a look at this or at least update the repo saying that it isn't supported anymore.

sachin5424 commented 3 years ago

step 1 exports.makePayment = (req,res) =>{

    var txnId =uuidv4()
    var orderId = req.body.orderId
    payumoney.makePayment({
        productinfo: orderId,
        txnid: txnId,
        amount: "1",
        email: "arr014@gmail.com",
        phone: "7836922129",
        lastname: "sagar",
        firstname: "sagar",
        surl: `http://localhost:3000/private/wallet/payment/success/${txnId}/${req.activeUser.userId}/${orderId}`,
        furl: "http://www.facebook.com", //"http://localhost:3000/payu/fail"
    }, function(error, response) {
      if (error) {
        // Some error
        res.status(400).json{error:error}
      } else {
        // Payment redirection link
        res.send(response);
      }
    });

} step : 2 router.post('/wallet/payment/success/:txnId/:userId/:orderId',payemnet.paymenrResponse)

step 3 exports.paymenrResponse = async (req,res)=>{ try { var profile_id = req.params.userId; var orderId = req.params.orderId; var txnId = req.params.txnId; console.log(profile_id,orderId,txnId); console.log(profile_id, req.activeUser.userId); const check_txnId = await userPaymentModel.findOne({txnId:txnId}); if(check_txnId){ return res.json({ status:"400", error:"txnId same" }) } if(profile_id === req.activeUser.userId){ let options = new userPaymentModel ({ profileId:profile_id, orderId:orderId, txnId:txnId }); await options.save() res.json({ status:"200", message:"done " }) } else{ res.send("faild payment") }

} catch (error) {
    res.json({
        status:"500",
        error:error
    })
}

}