getting “INTERNAL_SERVICE_ERROR” with paypal refund operation

illusionist__
Contributor
Contributor

I'm trying to execute a refund with PayPal's API in sandbox. I'm getting another internal service error. I am trying to run the following code :
 
pays.PAYID = _useDoc.client_doc_ref;
//pays.OPERATION = Request["OPERATION"];
if (!string.IsNullOrEmpty(pays.PAYID))
{

    RefundRequest refreq = new RefundRequest()
    {
        //invoice_number = _useDoc.document,
        amount = new Amount()
        {
            currency = "EUR",
            total = pays.AMOUNT
        }

    };

    var payment = Payment.Get(apiContext, pays.PAYID);
    var transactionId = payment.transactions[0].related_resources[0].sale.id;
    var response = Sale.Refund(apiContext, transactionId, refreq);  

I am getting the following error:

 

{"name":"INTERNAL_SERVICE_ERROR","message":"An internal service error occurred.","information_link":"https://developer.paypal.com/docs/api/payments/#errors","debug_id":"fc27b41e6b6aa"}

It will be very appreciated if someone helps me in this regard.

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.