PHP - AdaptivePaymentsService::pay() - 总是返回错误:520002

标签 php paypal paypal-adaptive-payments

我正在尝试使用 Paypal 进行非常简单的付款,从示例来看这似乎非常简单。但我得到的只是一个信息量非常小的“内部错误”/520002 响应:(。

$config = array(
                'mode' => 'sandbox',
                'acct1.UserName' => 'myUsername',
                'acct1.Password' => 'myPassword',
                'acct1.Signature' => "mySignature"
                );
$service = new AdaptivePaymentsService($config);

$requestEnvelope = new RequestEnvelope("en_US");

$receiver = new Receiver();
$receiver->email = "aValidEmailAddress@test.net";
$receiver->amount = 4;
$receiverList = new ReceiverList(array($receiver));


$payRequest = new PayRequest($requestEnvelope, "PAY", "http://somehost/cancel", "EUR", $receiverList, "http://somehost/return");
$payRequest->senderEmail = "anotherValidEmailAddress@test.net";
$payRequest->ipnNotificationUrl = "http://somehost/ipn2";

$response = $service->pay($payRequest);

回复:

{
"responseEnvelope":
{
"timestamp":"2014-12-27T21:58:18.816-08:00",
"ack":"Failure",
"correlationId":"5da19d03caba3",
"build":"13414382"
},
"payKey":null,
"paymentExecStatus":null,
"payErrorList":null,
"paymentInfoList":null,
"sender":null,
"defaultFundingPlan":null,
"warningDataList":null,
"error":
[
{
"errorId":"520002",
"domain":"PLATFORM",
"subdomain":"Application",
"severity":"Error",
"category":"Application",
"message":"Internal Error",
"exceptionId":null,
"parameter":null
}
]
}

凭据似乎是正确的,因为我似乎设法克服了与身份验证相关的错误。

如有任何帮助,我们将不胜感激。

这是我从本地 Web 服务器运行的原始代码。 我只是将凭据和个人数据更改为垃圾。

已经尝试了一些东西,比如不同的货币、没有发件人电子邮件等(比如来自 Paypal 的示例代码)

干杯!

最佳答案

查看上面的代码,我唯一能看到缺少的是应用程序 ID:

“X-PAYPAL-APPLICATION-ID”。

如果您处于沙盒模式,则需要传递默认应用 ID,即:APP-80W284485P519543T

您需要确保也在您的代码中传递它。您可以在以下网址引用示例请求:

https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-payments/Pay_API_Operation/

关于PHP - AdaptivePaymentsService::pay() - 总是返回错误:520002,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27674134/

相关文章:

php - 什么会导致 PayPal Adaptive Payments API 返回 "internal server error. please check the server logs for details"?

android - "your account is restricted or locked. Go to www.paypal.com to resolve this issue."尝试进行高额付款时显示此错误

php - 如何为 Laravel 4 包创建命令?

PHP 和 PostgreSQL - 从 SQL 文件插入行

Paypal SOAP 请求 : How to test a serviece in soapui with good header parameters?

php - subscr_payment 使用 paypal ipn 模拟器

javascript - PHP - 从文本区域中删除换行符

php - 如何在 codeIgniter 中自定义表单验证错误

Paypal IPN 不适用于另一个 paypal 帐户

paypal - 自适应支付 : Unilateral receiver not allowed in chained payment is restricted