在 Rest API 中为销售退款PayPal 使用 C# 捕获了内部服务错误 500

本文关键字:内部 错误 服务 使用 PayPal API Rest | 更新日期: 2023-09-27 18:36:37

我正在尝试退还PayPal的销售。我正在使用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 new退款 = 销售。Refund(apiContext, Refund);"它说:远程服务器返回错误:(500) 内部服务器错误。

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

在 Rest API 中为销售退款PayPal 使用 C# 捕获了内部服务错误 500

如果您使用的是 .Net SDK,请将其更新到最新版本(刚刚发布,IINM 版本 1.2.1),Sale.Refund中存在错误并已修复

呵呵......