我试图使用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中的示例代码)
干杯!
答案 0 :(得分:3)
查看上面的代码,我唯一看不到的是APPLICATION ID:
“X-PAYPAL-APPLICATION-ID”。
如果您处于沙箱模式,则需要传递默认的应用ID: APP-80W284485P519543T
您还需要确保在代码中传递它。您可以在以下网址引用示例请求:
https://developer.paypal.com/webapps/developer/docs/classic/api/adaptive-payments/Pay_API_Operation/