Mark
Mark

Reputation: 100

Refund a Sale in Paypal Rest API caught an INTERNAL SERVICE ERROR 500 using C#

I'm trying to refund a sale in a Paypal. I'm using Paypal REST API.

Here's my sample code:

APIContext apiContext = APiConfig();

Sale sale = Sale.Get(apiContext, "0D952456WY462504J");
Amount refundAmount = new Amount();
refundAmount.total = "0.01";
refundAmount.currency = currency;

Refund refund = new Refund();
refund.amount = refundAmount;

var newRefund = sale.Refund(apiContext, refund);

response = new PaypalResponse() {
       amount = newRefund.amount,
       create_time = Convert.ToDateTime(newRefund.create_time),
       update_time = Convert.ToDateTime(newRefund.update_time),
       state = newRefund.state,
       parent_payment = newRefund.parent_payment,
       id = newRefund.id
       };

Getting error on this line: "var newRefund = sale.Refund(apiContext, refund);" It said that: The remote server returned an error: (500) Internal Server Error.

Can anyone answer this? Thanks!

Upvotes: 2

Views: 501

Answers (1)

EdSF
EdSF

Reputation: 12361

If you're using the .Net SDK, update it to the latest version (just released, IINM version 1.2.1), there was a bug in Sale.Refund and was fixed

Hth....

Upvotes: 1

Related Questions