I am working on payu API integration using nodejs. In a test environment where I am getting the response like:
{"status":-1,"rows":0,"message":"Something went Wrong guid 3hnlpif04nu9nbascn1mom27le sessionId null","result":null,"guid":"3hnlpif04nu9nbascn1mom27le","sessionId":"null","errorCode":null}
Here is my code
let url = `https://test.payumoney.com/treasury/merchant/refundPayment`;
url = `${url}?paymentId=${paymentID}&refundAmount=${transaction["amount"]}&merchantKey=${config['PAYU_MONEY'].merchantKey}`;
logger.debug("PayuService: initiateRefund: Refund attempt url: ", { url } );
let res = await request.post(url, {
headers: {
'authorization': config['PAYU_MONEY'].authHeader,
'cache-control': 'no-cache',
'Content-Type': 'application/json'
}
})
Where, paymentID is from payu transaction response 'payuMoneyId'.
Refund API doesn't work in test/sandbox environment.
Please find the Refund API below for live environment:
Please pass the Merchant Key, Payment ID, Amount
in Params and Authorization Header in Headers.