magento2: PayPal Express Checkout: We can't initialize Express Checkout.

Preconditions

  1. Magento Version 2.1.6 Community Version
  2. PayPal Express Checkout in Live Mode

Steps to reproduce

  1. Go to any products details page
  2. Click PayPal Express Button
  3. Redirect to empty cart with error message: “We can’t initialize Express Checkout.

Whats working:

  1. Go to any products details page
  2. Click add to cart
  3. Click PayPal Express Button on product details page or cart or mini cart
  4. PayPal Express Checkout site came up

Expected result

  1. PayPal Express Checkout site came up

Actual result

Redirect to empty cart with error message: “We can’t initialize Express Checkout.

system.log:

[2017-05-03 15:53:46] main.CRITICAL: Exception message: We can't initialize Express Checkout.
Trace: #0 /htdocs/vendor/magento/module-paypal/Controller/Express/GetToken.php(82): Magento\Paypal\Controller\Express\AbstractExpress->_initCheckout()
#1 /htdocs/vendor/magento/module-paypal/Controller/Express/AbstractExpress/Start.php(24): Magento\Paypal\Controller\Express\GetToken->getToken()
#2 /htdocs/vendor/magento/framework/App/Action/Action.php(102): Magento\Paypal\Controller\Express\AbstractExpress\Start->execute()
#3 /htdocs/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#4 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Paypal\Controller\Express\Start\Interceptor->___callParent('dispatch', Array)
#5 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Paypal\\...', 'dispatch', Object(Magento\Paypal\Controller\Express\Start\Interceptor), Array, 'customer-app-ac...')
#6 /htdocs/vendor/magento/module-customer/Model/App/Action/ContextPlugin.php(61): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#7 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Customer\Model\App\Action\ContextPlugin->aroundDispatch(Object(Magento\Paypal\Controller\Express\Start\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#8 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Paypal\\...', 'dispatch', Object(Magento\Paypal\Controller\Express\Start\Interceptor), Array, 'contextPlugin')
#9 /htdocs/vendor/magento/module-store/App/Action/Plugin/Context.php(106): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#10 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Store\App\Action\Plugin\Context->aroundDispatch(Object(Magento\Paypal\Controller\Express\Start\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#11 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Paypal\\...', 'dispatch', Object(Magento\Paypal\Controller\Express\Start\Interceptor), Array, 'storeCheck')
#12 /htdocs/vendor/magento/module-store/App/Action/Plugin/StoreCheck.php(44): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#13 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Store\App\Action\Plugin\StoreCheck->aroundDispatch(Object(Magento\Paypal\Controller\Express\Start\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#14 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Paypal\\...', 'dispatch', Object(Magento\Paypal\Controller\Express\Start\Interceptor), Array, 'tax-app-action-...')
#15 /htdocs/vendor/magento/module-tax/Model/App/Action/ContextPlugin.php(91): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#16 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Tax\Model\App\Action\ContextPlugin->aroundDispatch(Object(Magento\Paypal\Controller\Express\Start\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#17 /htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Paypal\\...', 'dispatch', Object(Magento\Paypal\Controller\Express\Start\Interceptor), Array, 'weee-app-action...')
#18 /htdocs/vendor/magento/module-weee/Model/App/Action/ContextPlugin.php(112): Magento\Paypal\Controller\Express\Start\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#19 /htdocs/vendor/magento/framework/Interception/Interceptor.php(142): Magento\Weee\Model\App\Action\ContextPlugin->aroundDispatch(Object(Magento\Paypal\Controller\Express\Start\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#20 /htdocs/var/generation/Magento/Paypal/Controller/Express/Start/Interceptor.php(26): Magento\Paypal\Controller\Express\Start\Interceptor->___callPlugins('dispatch', Array, Array)
#21 /htdocs/vendor/magento/framework/App/FrontController.php(55): Magento\Paypal\Controller\Express\Start\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#22 /htdocs/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http))
#23 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array)
#24 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'requestPreproce...')
#25 /htdocs/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#26 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#27 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install')
#28 /htdocs/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#29 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#30 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#31 /htdocs/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(73): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http))
#32 /htdocs/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#33 /htdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...')
#34 /htdocs/vendor/magento/module-page-cache/Model/App/FrontController/VarnishPlugin.php(55): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
#35 /htdocs/vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
#36 /htdocs/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array)
#37 /htdocs/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
#38 /htdocs/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Framework\App\Http->launch()
#39 /htdocs/var/generation/Magento/Framework/App/Http/Interceptor.php(26): Magento\Framework\App\Http\Interceptor->___callPlugins('launch', Array, Array)
#40 /htdocs/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http\Interceptor->launch()
#41 /htdocs/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#42 {main} [] []

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 53 (5 by maintainers)

Most upvoted comments

Why are you still on magneto? We already moved to Shopify years! lol.

On Thu, Jun 3, 2021 at 10:06 AM aurel5542 @.***> wrote:

Hello, why is this closed? I still have this issue on 2.3.6-p2 several times a week

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/magento/magento2/issues/9497#issuecomment-854035314, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZ4W2S5G5ZYD33ZJ22R6BLTQ6ZCDANCNFSM4DJ6PRRQ .

Looks like this issue is caused by having the guest checkout disabled under Stores > Configuration > Sales > Checkout > Checkout Options > Allow Guest Checkout

Even though guest checkout was enabled under PayPal Express Checkout settings, I was getting this error because Magento guest checkout was disabled. Enabling it fixed the issue for me

I experience this problem on 2.3.2. Insane that is still an issue after more than 2 years.

Same issue with 2.2.6

After searching I found the problem that was happening with our store. Check in the table ‘sales_sequence_meta’. There is a listing of table names that magento is using. In our case the tables for store_id 2 were missing. I added these as following:

|meta_id|entity_type|store_id|sequence_table
{increment_id}|order|2|sequence_order_2
{increment_id}|invoice|2|sequence_invoice_2
{increment_id}|creditmemo|2|sequence_creditmemo_2
{increment_id}|shipment|2|sequence_shipment_2
{increment_id}|rma_item|2|sequence_rma_item_2

Make sure the sequence_tables exist in the database. Create them if needed.

After that make sure these changes are also applied in the ‘sales_sequence_profile’ table. There add the meta_id for the new ones you added previously:

|profile_id|meta_id|prefix|suffix|start_value|step|max_value|warning_value|is_active|
{increment}|{meta_id}|2|NULL|1|1|4294967295|4294967295|1

After these changes paypal worked as expected on the store with id 2.

Same issue in Magento 2.2.3

I am facing same issue in 2.2.5

ok my issue was sorted out. First turn off the minify of CSS, JS and HTML and also if you are using any cache platform like cloudflare or any other do the same in them too turn off minify of CSS, JS and HTML from cloudflare too and then clear magento and cloudflare full cache and check.

I can not confirm that setting “Stores > Configuration > Sales > Checkout > Checkout Options > Allow Guest Checkout” to “yes” will resolve this issue, my shop had this to set to yes since launch.

“Stores > Configuration > Sales > Checkout > Checkout Options > Allow Guest Checkout” Is set to yes per Magento 2 default. So unless this was set to “no” it should be enabled.

@adinca This setting was already enabled for me, and still i was getting this error, did you do anything else apart from enabling this option?.