Refund a Sale in Paypal Rest API 使用 C# 发现内部服务错误 500

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

我正在尝试通过 Paypal 退款。 我正在使用贝宝 REST API.

这是我的示例代码:

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
       };

此行出现错误:"var newRefund = sale.Refund(apiContext, refund);" 它说:远程服务器返回错误:(500)内部服务器错误。

谁能回答这个问题?谢谢!

如果您使用的是.Net SDK,请将其更新到最新版本(刚刚发布,IINM版本1.2.1),那里was a bug in Sale.Refund and was fixed

Hth....