尝试使用自适应简单付款但得到空白屏幕

时间:2015-02-27 01:19:52

标签: php json curl paypal

我正在尝试弄清楚如何将自适应简单付款与Paypal API一起使用并尝试测试其默认代码:

$payRequest = new PayRequest();

$receiver = array();
$receiver[0] = new Receiver();
$receiver[0]->amount = "1.00";
$receiver[0]->email = "platfo_1255170694_biz@gmail.com";
$receiverList = new ReceiverList($receiver);
$payRequest->receiverList = $receiverList;

$requestEnvelope = new RequestEnvelope("en_US");
$payRequest->requestEnvelope = $requestEnvelope; 
$payRequest->actionType = "PAY";
$payRequest->cancelUrl = "https://devtools-paypal.com/guide/ap_simple_payment/php?cancel=true";
$payRequest->returnUrl = "https://devtools-paypal.com/guide/ap_simple_payment/php?success=true";
$payRequest->currencyCode = "USD";
$payRequest->ipnNotificationUrl = "http://replaceIpnUrl.com";

$sdkConfig = array(
    "mode" => "sandbox",
    "acct1.UserName" => "reznik.demarket-facilitator_api1.gmail.com",
    "acct1.Password" => "BV5GBSV7QBPXJUNR",
    "acct1.Signature" => "AcK.GqlanslGMma1L2TIOPx.t0xQApMepP-Rt7jundLbNOzkwOhrqbJ4",
    "acct1.AppId" => "APP-80W284485P519543T"
);

$adaptivePaymentsService = new AdaptivePaymentsService($sdkConfig);
$payResponse = $adaptivePaymentsService->Pay($payRequest); 

它应该给我这样的json答案:

{"responseEnvelope":{"timestamp":"2015-02-26T17:14:06.242-08:00","ack":"Success","correlationId":"aae1f46492b42","build":"15089777"},"payKey":"AP-0SN13003KN641223K","paymentExecStatus":"CREATED"}

为什么我会在没有任何错误或成功消息的情况下出现空白屏幕?

1 个答案:

答案 0 :(得分:1)

听起来好像您收到了PHP错误,但您没有在服务器上显示错误。尝试将其添加到脚本的顶部...

error_reporting(E_ALL);
ini_set('display_errors', '1');

这应该允许您查看正在发生的错误,以便您可以修复它。