- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sometimes I get HTTP status code 406 when trying to get approval link:
<html>
<head><title>406 Not Acceptable</title></head>
<body bgcolor="white">
<center><h1>406 Not Acceptable</h1></center>
<hr><center>nginx/1.14.0 (Ubuntu)</center>
</body>
</html>
When calling the same function with same settings directly after failing, the excpetion is mostly gone and everything works fine. Yesterday nearly every second call failed. I've nothing changed within the system for weeks. I use https://github.com/paypal/PayPal-PHP-SDK in version 1.14.0
My code (excerpt):
$payer = new \PayPal\Api\Payer();
$payer->setPaymentMethod('paypal');
$amount = new \PayPal\Api\Amount();
$amount->setTotal($orderTotal);
$amount->setCurrency('EUR');
$transaction = new \PayPal\Api\Transaction();
$transaction->setAmount($amount);
$redirectUrls = new \PayPal\Api\RedirectUrls();
$redirectUrls->setReturnUrl($returnURL)->setCancelUrl($cancelURL);
$payment = new \PayPal\Api\Payment();
$payment->setIntent('sale')
->setPayer($payer)
->setTransactions(array($transaction))
->setRedirectUrls($redirectUrls)
->setExperienceProfileId($paypalWebprofileid);
try {
$payment->create($apiContext);
$payPalURL = $payment->getApprovalLink();
header("Location: ".$payPalURL);
} catch (\PayPal\Exception\PayPalConnectionException $ex) {
$exception = $ex->getData();
return $exception;
}
It seems to me like an issue on PayPal. Same problem anyone? Hints for solving?
Thanks for every hint.
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problem Solved.
Strange Reason.
One component of my Return-URL & Cancel-URL is /bin/.
e.g. https://domain.tld/bin/frontend/something.php
When I replace bin with something else, the error is gone.
Thanks PayPal - I nearly lost my mind.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Problem Solved.
Strange Reason.
One component of my Return-URL & Cancel-URL is /bin/.
e.g. https://domain.tld/bin/frontend/something.php
When I replace bin with something else, the error is gone.
Thanks PayPal - I nearly lost my mind.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It keeps saying 406 not acceptable when I try to receive the money a customer sent me
Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.