Reputation: 2925
I'm just facing that problem for hours. This complete app works locally (OSX/MAMP/modphp/PHP 5.5.18) but for some reason on the production server the payment creation fails: White/Empty response. No Exception, no max_execution time limit reached also HTTP 200. PHP and Apache logs are just fine and also there are no errors on the screen.
Everything before $payment->create($this->apiContext);
gets executed - after that line the result is blank page.
The production server runs Ubuntu 14.04 / Apache 2.4.7 / modphp / PHP 5.5.9
Here is the code:
public function create($data)
{
$payer = new Payer();
$payer->setPaymentMethod("paypal");
$total = 0.0;
$shipping = 0.0;
foreach ($data as $key => $value) {
$item = new Item();
$item->setName($value->name)
->setDescription($value->type)
->setCurrency(Option::get('general-settings', 'currency'))
->setQuantity($value->amount)
->setPrice($value->price);
$items[] = $item;
$total += $value->price * $value->amount;
}
if ($total < 100) {
$shipping += 10;
}
$itemList = new ItemList();
$itemList->setItems($items);
$details = new Details();
$details->setShipping($shipping)
->setSubtotal($total);
$amount = new Amount();
$amount->setCurrency(Option::get('general-settings', 'currency'))
->setTotal($total+$shipping)
->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)
->setItemList($itemList)
->setDescription("JustinRein Auftag")
->setInvoiceNumber(uniqid());
$baseUrl = "http://example.ch";
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("$baseUrl/payment?success=true")
->setCancelUrl("$baseUrl/payment?success=false");
$payment = new Payment();
$payment->setIntent("sale")
->setPayer($payer)
->setRedirectUrls($redirectUrls)
->setTransactions(array($transaction));
try {
$payment->create($this->apiContext);
} catch (Exception $ex) {
td($ex);
exit(1);
}
return $payment;
}
This runs also on paypal sandbox mode. The paypal logfile is also empty.
Upvotes: 1
Views: 557
Reputation: 1065
Posting here to close out the question. Question author investigated and found a third party library that he was using which was suppressing the error that he needed to see with a '@' operator. After removing the '@' operator (temporarily?) he was able to correct the problem with the PayPal SDK that he was using.
Upvotes: 1