Paypal partial refund on sale

We are trying to implement paypal partial refund method using REST API. It doesn’t seems to workeven when we have provided the needed arguments and have already implemented the method described in paypal docs. We need help for partial refund in node js.

Script:
// get refund amount l
et refund_details =
{
“amount”:
{
total: “50.00”,
currency: “CAD”
},
“invoice_number”: “INV-1234567”
};
// get sale id
let saleId = “xxxx123”;
paypal.sale.refund(saleId, refund_details, (error, refund) => {
if (error) {
console.log(error.response);
} else {
console.log(“Get Refund Response”);
}
});

Response:
{
“response”: {
“name”: “TRANSACTION_REFUSED”,
“message”: “Request was refused.You can not do a partial refund on this transaction”,
“information_link”: “https://developer.paypal.com/webapps/developer/docs/api/#TRANSACTION_REFUSED”,
“debug_id”: “ac4cf1a2f1737”,
“httpStatusCode”: 400
},
“response_stringified”: "{“name”:“TRANSACTION_REFUSED”,“message”:“Request was refused.You can not do a partial refund on this transaction”,“information_link”:“https://developer.paypal.com/webapps/developer/docs/api/#TRANSACTION_REFUSED",“debug_id”:"ac4cf1…}”,
“httpStatusCode”: 400
}