Nothing Happens When Paying With PayPal Payflow
-
14-04-2021 - |
Question
Trying to test the checkout on my Magento 2.0.7 site. When I enter credit card information and hit the "place order" button, the ajax loader appears and remains there without any discernible response.
Opening the debug.log I can see the following arrays logged by the transaction, but I can't make heads or tails on what the problem is:
main.DEBUG: array (
'request' =>
array (
'user' => '****',
'vendor' => 'Bukuysk',
'partner' => 'PayPal',
'pwd' => '****',
'verbosity' => 'HIGH',
'BNCODE' => 'Magento_Cart_Community',
'tender' => 'C',
'trxtype' => 'A',
'amt' => 0,
'createsecuretoken' => 'Y',
'securetokenid' => '0b50e95b762a30710ab71db50cf751f8',
'returnurl' => 'http://tm34commerce.com/paypal/transparent/response/',
'errorurl' => 'http://tm34commerce.com/paypal/transparent/response/',
'cancelurl' => 'http://tm34commerce.com/paypal/transparent/cancel/',
'disablereceipt' => 'TRUE',
'silenttran' => 'TRUE',
'firstname' => 'Ryan',
'lastname' => 'Miller',
'street' => '3587 South Federal Hwy Apt B',
'city' => 'Boynton Beach',
'state' => 'FL',
'zip' => '33435',
'country' => 'US',
'email' => 'ryanmiller732@gmail.com',
'shiptofirstname' => 'Ryan',
'shiptolastname' => 'Miller',
'shiptostreet' => '3587 South Federal Hwy Apt B',
'shiptocity' => 'Boynton Beach',
'shiptostate' => 'FL',
'shiptozip' => '33435',
'shiptocountry' => 'US',
),
'result' =>
array (
'result' => '0',
'respmsg' => 'Approved',
'securetoken' => '985uWjaVg9UWaTmOzC0UIjQrH',
'securetokenid' => '0b50e95b762a30710ab71db50cf751f8',
'result_code' => '0',
),
) {"is_exception":false} []
I've placed a test order using the check/money order option, so the checkout itself works. It's paypal that's the problem. Is there anything in the debug log that indicates what the problem would be and how to fix this?
Solution
There were a few problems, all of which are now fixed:
- SSL was not installed
- Payment Action needed to be set to Authorization
- All return URLs in PayPal Manager need to be set to POST
Now all's working fine.
OTHER TIPS
I have faced the same error and fixed it by made few changes in following core file of vendor folder.
vendor/magento/module-paypal/Model/Payflow/Service/Request/SecureToken.php
- Added
use Magento\Payment\Helper\Formatter;
- After
use Magento\Quote\Model\Quote;
- Then Added
use Formatter;
- After
/**
- @var UrlInterface */ private $url;
- Last changed is in function requestToken
Orignal Line
$request->setAmt(0);
New Line
request->setAmt($this->formatPrice($quote->getGrandTotal()));
Final file will be following:
<?php
/**
- Copyright © Magento, Inc. All rights reserved.
- See COPYING.txt for license details. */ namespace Magento\Paypal\Model\Payflow\Service\Request;
use Magento\Framework\Math\Random; use Magento\Framework\DataObject; use Magento\Framework\UrlInterface; use Magento\Paypal\Model\Payflow\Transparent; use Magento\Paypal\Model\Payflowpro; use Magento\Quote\Model\Quote; use Magento\Payment\Helper\Formatter; /**
Class SecureToken / class SecureToken { /*
- @var UrlInterface */ private $url;
use Formatter;
/**
- @var Random */ private $mathRandom;
/**
- @var Transparent */ private $transparent;
/**
@param UrlInterface $url
@param Random $mathRandom
@param Transparent $transparent */ public function __construct( UrlInterface $url, Random $mathRandom, Transparent $transparent ) {
$this->url = $url; $this->mathRandom = $mathRandom; $this->transparent = $transparent; }
/**
Get the Secure Token from Paypal for TR
@param Quote $quote
@return DataObject
@throws \Exception */ public function requestToken(Quote $quote) { $this->transparent->setStore($quote->getStoreId()); $request = $this->transparent->buildBasicRequest(); $request->setTrxtype(Payflowpro::TRXTYPE_AUTH_ONLY); $request->setVerbosity('HIGH'); $request->setAmt($this->formatPrice($quote->getGrandTotal()));
$request->setCurrency($quote->getBaseCurrencyCode()); $request->setCreatesecuretoken('Y'); $request->setSecuretokenid($this->mathRandom->getUniqueHash()); $request->setReturnurl($this->url->getUrl('paypal/transparent/response')); $request->setErrorurl($this->url->getUrl('paypal/transparent/response')); $request->setCancelurl($this->url->getUrl('paypal/transparent/cancel')); $request->setDisablereceipt('TRUE'); $request->setSilenttran('TRUE');$this->transparent->fillCustomerContacts($quote, $request);
$result = $this->transparent->postRequest($request, $this->transparent->getConfig());
return $result; } }