Cant refund payment with API

n0oB
Contributor
Contributor

So I have the capture ID.

But when I try to refund the order I get an error.

I have tried with the node.js SDK and also with the web API.

 

Node.js code:

            const request = new paypal.payments.CapturesRefundRequest(orderId);
            request.requestBody({
                "amount": {
                    "value": "9.37",
                    "currency_code": "EUR"
                }
            });
            const response = await client.execute(request); 

 

Through Web API:

(

                method: "POST"
                url: `https://api-m.sandbox.paypal.com/v2/payments/captures/${orderId}/refund`,
                data: {
                    "amount": {
                        "value": "9.37",
                        "currency_code": "EUR"
                    }

                },
                headers: {
                    'Content-Type': 'application/json',
                    'Authorization': 'Bearer ' + token
                }
)
 
And here my error info (its long so I put some of it):
...
response: {
status: 404,
statusText: 'Not Found',
...
data: {
name: 'RESOURCE_NOT_FOUND',
message: 'The specified resource does not exist.',
debug_id: 'b7b872481d61',
details: [Array],
links: [Array]
}
...
},
 
 
Login to Me Too
0 REPLIES 0

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.