在ASP.NET Core中从Paypal执行付款时发生INTERNAL_SERVICE_ERROR

问题描述

执行Paypal付款时出现以下错误:

{“名称”:“ INTERNAL_SERVICE_ERROR”,“消息”:“内部服务错误 具有 发生”,“信息链接”:“ https://developer.paypal.com/docs/api/payments/#errors”,“ debug_id”:“ a997a9f72d8f6”}

以下是执行付款的代码:

var apiContext = PaypalConfiguration.GetAPIContext();
            var paymentExecution = new PaymentExecution() { payer_id = payerId };
            var payment = new Payment() { id = paymentId };
            // Execute authorization.
            var executedPayment = payment.Execute(apiContext,paymentExecution);// Execute the payment
            if (executedPayment.state.ToLower() == "approved")
            {
                var auth = payment.transactions[0].related_resources[0].authorization;

                var capture = new Capture()
                {
                    amount = amount,is_final_capture = true
                };

                var responseCapture = auth.Capture(apiContext,capture);
                return responseCapture;
            }

解决方法

虽然有许多可能的原因导致INTERNAL_SERVICE_ERROR,但其中一些是暂时的,在这种情况下,此时此刻可能是沙盒错误,导致无法确认沙盒帐户电子邮件。

通过以下方式确认电子邮件:

  1. https://www.sandbox.paypal.com/businessprofile/settings/email-使用沙盒收件人电子邮件登录,然后重新发送确认消息。
  2. https://www.paypal.com/signin?intent=developer&returnUri=https%3A%2F%2Fdeveloper.paypal.com%2Fdeveloper%2Fnotifications%2F-使用真实帐户登录,以从“通知”标签中检索确认。

与上述情况分开,似乎您正在集成不推荐使用的v1付款API。您应该使用v2 / checkout / orders API,在此处记录:https://developer.paypal.com/docs/checkout/reference/server-integration/

您需要执行“设置交易”和“捕获交易”步骤。带有intent:authorize的中间授权步骤(在捕获之前)是可选的,只有在您对该额外步骤有非常特定且明确定义的业务需求的情况下,才执行此操作。

用于客户批准的最佳前端UI是:https://developer.paypal.com/demo/checkout-v4/#/pattern/server,因为它不使用重定向并保持您的网站在后台加载。这提供了最现代的“上下文”体验。

,

这是Paypal的内部错误。

我会将带有debug_id的票证提交给https://www.paypal-techsupport.com/app/home

下面是一些具有相同错误的链接。也许会帮助您指出正确的方向。

https://www.paypal-community.com/t5/REST-APIs/INTERNAL-SERVICE-ERROR-REST-v1-payments-payment/td-p/1480048#

PayPal REST Sandbox API giving INTERNAL_SERVICE_ERROR

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...