When having PayPal as the payment provider, the checkout flow breaks on http://WEBSITE/commerce-paypal/checkout-approve/paypal_checkout/CARDID

Payment Plugin: "PayPal Checkout [Preferred]"
Payment flow: default [1]

I do get the PayPal button, both in the card and the checkout flow. However, when returning to the card nothing happens. The following error is in the logs:

Uncaught PHP Exception InvalidArgumentException: "Invalid header value: must be a string or array of strings; cannot be an empty array" at /DRUPALPATH/vendor/zendframework/zend-diactoros/src/MessageTrait.php line 389, referer: https://WEBSITE/cart

Trace:

Zend\Diactoros\Response->withHeader('Set-Cookie', Array) (Line: 144)
Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory->createResponse(Object) (Line: 44)
Drupal\Core\EventSubscriber\PsrResponseSubscriber->onKernelView(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('kernel.view', Object) (Line: 156)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 693)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Whereas there seem to be headers with the request:

Accept: */*
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9,nl;q=0.8
Connection: keep-alive
Content-Length: 26
Content-Type: text/plain;charset=UTF-8
Cookie: cookie-agreed=0; SESS49960de5880e8c687434170f6476605b=VbFJPkSXNG-tEIN-WgMmEmtCtIYX_fRlFCmXgJxrQIs
Host: localhost:8000
Origin: http://localhost:8000
Referer: http://localhost:8000/checkout/43/review
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.75 Safari/537.36

Also, the request does send the payment id as {id: "PAYMENTID"}

Is this a misconfiguration from my end or a bug in the module?

I'm not sure at the moment as I have gotten more errors with the form as well, in various previous configurations. I cannot reproduce them right now, but am happy to look into it if you feel it is related or known. For completeness sake:

Error: Call to a member function isNew() on null in /DRUPALPATH/web/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php on line 197
and
TypeError: Argument 1 passed to Drupal\\commerce_checkout\\Plugin\\Commerce\\CheckoutPane\\CheckoutPaneBase::validatePaneForm() must be of the type array, null given, called in /DRUPALPATH/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php on line 590 in /DRUPALPATH/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutPane/CheckoutPaneBase.php on line 222

I can provide full traces for both if needed.

Drupal Core: 8.6.13
Commerce: 8.x-2.12
Commerce PayPal: 8.x-1.0-beta4

[1] I'm not using the PayPal flow as it skips the payment step. 'Review' gives a 'Complete Checkout' button. The PayPal Payment step is included in the payment flow.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

RandomNeighbour created an issue. See original summary.

RandomNeighbour’s picture

Issue summary: View changes

Added trace

jsacksick’s picture

http://WEBSITE/commerce-paypal/checkout-approve/paypal_checkout/
This url is not related to the checkout, but it's the endpoint called by the onApprove callback..
Do you see anything in the logs?

Could you provide steps that'll help me reproduce the issue?

Is the issue occurring in both flows? (i.e both when initiating the payment from the cart page, and from the buttons displayed on the review page?)

Anything in the JS console as well?
If an exception occurs from the API call, it should be logged.

RandomNeighbour’s picture

@jsacksick: it indeed seems to be from onApprove:

Please find a screenshot of the Chromium console attached. I assume the javascript error follows the 500 error on the server.

I have also attached a screenshot containing the request and response from the network console, which yields the error and its traceback. Unfortunately no further info is given. Also nothing in the logs.

To reproduce:

Versions:
Drupal Core: 8.6.13
Commerce: 8.x-2.12
Commerce PayPal: 8.x-1.0-beta4
Commerce Shipping 8.x-2.0-beta6

Order checkout flow: Default
Default checkout flow: Multistep.
Payment Gateway:
Plugin: Paypal Checkout [Preferred]
Mode: Sandbox
Client_id + secret filled in without errors
Transaction type: capture
Nothing disabled
Shipping address: if not yet given
Smart button style: unchecked

  • Add a product to card.
  • Checkout either using default flow, which gives the PayPal button on review, or with button below card (both have the same problem)
  • Paypal:
  • Go to card, overlay disappears, but script is stuck at the error attached
  • Order status is not changed either

Let me know if you need anything else.

RandomNeighbour’s picture

Changing the PayPal Transaction type setting from capture to authorize doesn't matter.

RandomNeighbour’s picture

Following the Trace, it seems to be some kind of odd incompatibility between HttpFoundationFactory and Zend\Diactoros\MessageTrait

<?php
// Symfony\Bridge\PsrHttpMessage\Factory\HttpFoundationFactory
// line 144
$psrResponse = $psrResponse->withHeader('Set-Cookie', array());

with:

<?php
// Zend\Diactoros\MessageTrait (used in Zend\Diactoros\Response)
// line 199
public function withHeader($header, $value)
    {
        // ... line 210
        $value = $this->filterHeaderValue($value);

// .. line 382
private function filterHeaderValue($values)
// ...line 388
       if ([] === $values) {
            throw new InvalidArgumentException(
                'Invalid header value: must be a string or array of strings; '
                . 'cannot be an empty array'
            );
        }

It seems to be changed (fixed) in the latest HTTPFoundationFactory. Despite running a composer update, I apparently don't have this version.

RandomNeighbour’s picture

I have fixed this issue by adding the following to composer.json:

"conflict": {
    "zendframework/zend-diactoros": "1.8.6"
}

However, is it true that commerce_paypal is incompatible with commerce_shipping?

I did manage to have an anonymous user finish the default login flow. However, when initiating the flow while being logged in I get the following error. I didn't get this with eg. the Mollie provider:

Error: Call to a member function getEntity() on null in Drupal\commerce_shipping\Plugin\Field\FieldFormatter\ShippingMethodFormatter->viewElements() (line 29 of /app/web/modules/contrib/commerce_shipping/src/Plugin/Field/FieldFormatter/ShippingMethodFormatter.php) 

#0 /app/web/core/lib/Drupal/Core/Field/FormatterBase.php(80): Drupal\commerce_shipping\Plugin\Field\FieldFormatter\ShippingMethodFormatter->viewElements(Object(Drupal\Core\Field\EntityReferenceFieldItemList), 'en') 
#1 /app/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(263): Drupal\Core\Field\FormatterBase->view(Object(Drupal\Core\Field\EntityReferenceFieldItemList), 'en') 
#2 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(321): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) 
#3 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(263): Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'user') 
#4 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(220): Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) 
#5 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build(Array) 
#6 /app/web/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array) 
#7 /app/web/core/lib/Drupal/Core/Render/Renderer.php(450): Drupal\Core\Render\Renderer->doRender(Array) 
#8 /app/web/core/lib/Drupal/Core/Render/Renderer.php(450): Drupal\Core\Render\Renderer->doRender(Array) 
#9 /app/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false) 
#10 /app/web/core/lib/Drupal/Core/Template/TwigExtension.php(490): Drupal\Core\Render\Renderer->render(Array) 
#11 /app/web/sites/default/files/php/twig/5ca461e57643c_commerce-order-receipt.ht_wlKYol_3rZmfcy9DEWD-YvKTt/2YbNME2CxFmEt40tqE21auxqPTH85P6xCSxAOZ4hlPg.php(293): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true) 
#12 /app/vendor/twig/twig/src/Template.php(216): __TwigTemplate_de7617aea72167d0b08013c9df062757714a37de778d1700eaef12bbff83be5c->block_shipping_information(Array, Array) 
#13 /app/web/sites/default/files/php/twig/5ca461e57643c_commerce-order-receipt.ht_wlKYol_3rZmfcy9DEWD-YvKTt/2YbNME2CxFmEt40tqE21auxqPTH85P6xCSxAOZ4hlPg.php(139): Twig\Template->displayBlock('shipping_inform...', Array, Array) 
#14 /app/vendor/twig/twig/src/Template.php(427): __TwigTemplate_de7617aea72167d0b08013c9df062757714a37de778d1700eaef12bbff83be5c->doDisplay(Array, Array) 
#15 /app/vendor/twig/twig/src/Template.php(398): Twig\Template->displayWithErrorHandling(Array, Array) 
#16 /app/vendor/twig/twig/src/Template.php(406): Twig\Template->display(Array) 
#17 /app/web/core/themes/engines/twig/twig.engine(64): Twig\Template->render(Array) 
#18 /app/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/themename/t...', Array) 
#19 /app/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('commerce_order_...', Array) 
#20 /app/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false) 
#21 /app/web/modules/contrib/commerce/commerce.module(28): Drupal\Core\Render\Renderer->render(Array) 
#22 /app/web/core/lib/Drupal/Core/Mail/MailManager.php(269): commerce_mail('order_receipt', Array, Array) 
#23 /app/web/core/lib/Drupal/Core/Mail/MailManager.php(179): Drupal\Core\Mail\MailManager->doMail('commerce', 'order_receipt', 'testpp@domain...', 'en', Array, NULL, true) 
#24 /app/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Mail\MailManager->Drupal\Core\Mail\{closure}() 
#25 /app/web/core/lib/Drupal/Core/Mail/MailManager.php(180): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 
#26 /app/web/modules/contrib/mailsystem/src/MailsystemManager.php(73): Drupal\Core\Mail\MailManager->mail('commerce', 'order_receipt', 'testpp@domain...', 'en', Array, NULL, true) 
#27 /app/web/modules/contrib/commerce/src/MailHandler.php(85): Drupal\mailsystem\MailsystemManager->mail('commerce', 'order_receipt', 'testpp@domain...', 'en', Array) 
#28 /app/web/modules/contrib/commerce/modules/order/src/EventSubscriber/OrderReceiptSubscriber.php(105): Drupal\commerce\MailHandler->sendMail('testpp@domain...', Object(Drupal\Core\StringTranslation\TranslatableMarkup), Array, Array) 
#29 [internal function]: Drupal\commerce_order\EventSubscriber\OrderReceiptSubscriber->sendOrderReceipt(Object(Drupal\state_machine\Event\WorkflowTransitionEvent), 'commerce_order....', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) 
#30 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\state_machine\Event\WorkflowTransitionEvent), 'commerce_order....', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) 
#31 /app/web/modules/contrib/state_machine/src/Plugin/Field/FieldType/StateItem.php(361): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('commerce_order....', Object(Drupal\state_machine\Event\WorkflowTransitionEvent)) 
#32 /app/web/modules/contrib/state_machine/src/Plugin/Field/FieldType/StateItem.php(331): Drupal\state_machine\Plugin\Field\FieldType\StateItem->dispatchTransitionEvent('post_transition') 
#33 [internal function]: Drupal\state_machine\Plugin\Field\FieldType\StateItem->postSave(true) 
#34 /app/web/core/lib/Drupal/Core/Field/FieldItemList.php(233): call_user_func_array(Array, Array) 
#35 /app/web/core/lib/Drupal/Core/Field/FieldItemList.php(198): Drupal\Core\Field\FieldItemList->delegateMethod('postSave', true) 
#36 [internal function]: Drupal\Core\Field\FieldItemList->postSave(true) 
#37 /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(811): call_user_func_array(Array, Array) 
#38 /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(843): Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('postSave', Object(Drupal\commerce_order\Entity\Order), true) 
#39 /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(769): Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldPostSave(Object(Drupal\commerce_order\Entity\Order), true) 
#40 /app/web/modules/contrib/commerce/src/CommerceContentEntityStorage.php(92): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object(Drupal\commerce_order\Entity\Order)) 
#41 /app/web/modules/contrib/commerce/modules/order/src/OrderStorage.php(103): Drupal\commerce\CommerceContentEntityStorage->invokeHook('update', Object(Drupal\commerce_order\Entity\Order)) 
#42 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(507): Drupal\commerce_order\OrderStorage->invokeHook('update', Object(Drupal\commerce_order\Entity\Order)) 
#43 /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(658): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\commerce_order\Entity\Order), true) 
#44 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(432): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object(Drupal\commerce_order\Entity\Order), true) 
#45 /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(774): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\commerce_order\Entity\Order)) 
#46 /app/web/core/lib/Drupal/Core/Entity/Entity.php(390): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\commerce_order\Entity\Order)) 
#47 /app/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php(311): Drupal\Core\Entity\Entity->save() 
#48 /app/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php(612): Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->submitForm(Array, Object(Drupal\Core\Form\FormState)) 
#49 [internal function]: Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->submitForm(Array, Object(Drupal\Core\Form\FormState)) 
#50 /app/web/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) 
#51 /app/web/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) 
#52 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(589): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) 
#53 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('commerce_checko...', Array, Object(Drupal\Core\Form\FormState)) 
#54 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(216): Drupal\Core\Form\FormBuilder->buildForm('commerce_checko...', Object(Drupal\Core\Form\FormState)) 
#55 /app/web/modules/contrib/commerce/modules/checkout/src/Controller/CheckoutController.php(94): Drupal\Core\Form\FormBuilder->getForm(Object(Drupal\commerce_paypal\Plugin\Commerce\CheckoutFlow\PayPalCheckout), 'order_informati...') 
#56 [internal function]: Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object(Drupal\Core\Routing\RouteMatch)) 
#57 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) 
#58 /app/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#59 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 
#60 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) 
#61 /app/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#62 /app/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) 
#63 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#64 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#65 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#66 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#67 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#68 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#69 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#70 /app/web/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#71 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) 
#72 {main}.

Moreover, when using the button underneath the cart, I get the following error upon returning to the form:

Error: Call to a member function getEntity() on null in Drupal\commerce_shipping\Plugin\Field\FieldFormatter\ShippingMethodFormatter->viewElements() (line 29 of /app/web/modules/contrib/commerce_shipping/src/Plugin/Field/FieldFormatter/ShippingMethodFormatter.php) 
#0 /app/web/core/lib/Drupal/Core/Field/FormatterBase.php(80): Drupal\commerce_shipping\Plugin\Field\FieldFormatter\ShippingMethodFormatter->viewElements(Object(Drupal\Core\Field\EntityReferenceFieldItemList), 'en') 
#1 /app/web/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(263): Drupal\Core\Field\FormatterBase->view(Object(Drupal\Core\Field\EntityReferenceFieldItemList), 'en') 
#2 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(321): Drupal\Core\Entity\Entity\EntityViewDisplay->buildMultiple(Array) 
#3 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(263): Drupal\Core\Entity\EntityViewBuilder->buildComponents(Array, Array, Array, 'user') 
#4 /app/web/core/lib/Drupal/Core/Entity/EntityViewBuilder.php(220): Drupal\Core\Entity\EntityViewBuilder->buildMultiple(Array) 
#5 [internal function]: Drupal\Core\Entity\EntityViewBuilder->build(Array) 
#6 /app/web/core/lib/Drupal/Core/Render/Renderer.php(378): call_user_func(Array, Array) 
#7 /app/web/core/lib/Drupal/Core/Render/Renderer.php(450): Drupal\Core\Render\Renderer->doRender(Array) 
#8 /app/web/core/lib/Drupal/Core/Render/Renderer.php(450): Drupal\Core\Render\Renderer->doRender(Array) 
#9 /app/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false) 
#10 /app/web/core/lib/Drupal/Core/Template/TwigExtension.php(490): Drupal\Core\Render\Renderer->render(Array) 
#11 /app/web/sites/default/files/php/twig/5ca461e57643c_commerce-order-receipt.ht_wlKYol_3rZmfcy9DEWD-YvKTt/2YbNME2CxFmEt40tqE21auxqPTH85P6xCSxAOZ4hlPg.php(293): Drupal\Core\Template\TwigExtension->escapeFilter(Object(Drupal\Core\Template\TwigEnvironment), Array, 'html', NULL, true) 
#12 /app/vendor/twig/twig/src/Template.php(216): __TwigTemplate_de7617aea72167d0b08013c9df062757714a37de778d1700eaef12bbff83be5c->block_shipping_information(Array, Array) 
#13 /app/web/sites/default/files/php/twig/5ca461e57643c_commerce-order-receipt.ht_wlKYol_3rZmfcy9DEWD-YvKTt/2YbNME2CxFmEt40tqE21auxqPTH85P6xCSxAOZ4hlPg.php(139): Twig\Template->displayBlock('shipping_inform...', Array, Array) 
#14 /app/vendor/twig/twig/src/Template.php(427): __TwigTemplate_de7617aea72167d0b08013c9df062757714a37de778d1700eaef12bbff83be5c->doDisplay(Array, Array) 
#15 /app/vendor/twig/twig/src/Template.php(398): Twig\Template->displayWithErrorHandling(Array, Array) 
#16 /app/vendor/twig/twig/src/Template.php(406): Twig\Template->display(Array) 
#17 /app/web/core/themes/engines/twig/twig.engine(64): Twig\Template->render(Array) 
#18 /app/web/core/lib/Drupal/Core/Theme/ThemeManager.php(384): twig_render_template('themes/themename/t...', Array) 
#19 /app/web/core/lib/Drupal/Core/Render/Renderer.php(437): Drupal\Core\Theme\ThemeManager->render('commerce_order_...', Array) 
#20 /app/web/core/lib/Drupal/Core/Render/Renderer.php(195): Drupal\Core\Render\Renderer->doRender(Array, false) 
#21 /app/web/modules/contrib/commerce/commerce.module(28): Drupal\Core\Render\Renderer->render(Array) 
#22 /app/web/core/lib/Drupal/Core/Mail/MailManager.php(269): commerce_mail('order_receipt', Array, Array) 
#23 /app/web/core/lib/Drupal/Core/Mail/MailManager.php(179): Drupal\Core\Mail\MailManager->doMail('commerce', 'order_receipt', 'testpp@domain...', 'en', Array, NULL, true) 
#24 /app/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\Mail\MailManager->Drupal\Core\Mail\{closure}() 
#25 /app/web/core/lib/Drupal/Core/Mail/MailManager.php(180): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 
#26 /app/web/modules/contrib/mailsystem/src/MailsystemManager.php(73): Drupal\Core\Mail\MailManager->mail('commerce', 'order_receipt', 'testpp@domain...', 'en', Array, NULL, true) 
#27 /app/web/modules/contrib/commerce/src/MailHandler.php(85): Drupal\mailsystem\MailsystemManager->mail('commerce', 'order_receipt', 'testpp@domain...', 'en', Array) 
#28 /app/web/modules/contrib/commerce/modules/order/src/EventSubscriber/OrderReceiptSubscriber.php(105): Drupal\commerce\MailHandler->sendMail('testpp@domain...', Object(Drupal\Core\StringTranslation\TranslatableMarkup), Array, Array) 
#29 [internal function]: Drupal\commerce_order\EventSubscriber\OrderReceiptSubscriber->sendOrderReceipt(Object(Drupal\state_machine\Event\WorkflowTransitionEvent), 'commerce_order....', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) 
#30 /app/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\state_machine\Event\WorkflowTransitionEvent), 'commerce_order....', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher)) 
#31 /app/web/modules/contrib/state_machine/src/Plugin/Field/FieldType/StateItem.php(361): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('commerce_order....', Object(Drupal\state_machine\Event\WorkflowTransitionEvent)) 
#32 /app/web/modules/contrib/state_machine/src/Plugin/Field/FieldType/StateItem.php(331): Drupal\state_machine\Plugin\Field\FieldType\StateItem->dispatchTransitionEvent('post_transition') 
#33 [internal function]: Drupal\state_machine\Plugin\Field\FieldType\StateItem->postSave(true) 
#34 /app/web/core/lib/Drupal/Core/Field/FieldItemList.php(233): call_user_func_array(Array, Array) 
#35 /app/web/core/lib/Drupal/Core/Field/FieldItemList.php(198): Drupal\Core\Field\FieldItemList->delegateMethod('postSave', true) 
#36 [internal function]: Drupal\Core\Field\FieldItemList->postSave(true) 
#37 /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(811): call_user_func_array(Array, Array) 
#38 /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(843): Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldMethod('postSave', Object(Drupal\commerce_order\Entity\Order), true) 
#39 /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(769): Drupal\Core\Entity\ContentEntityStorageBase->invokeFieldPostSave(Object(Drupal\commerce_order\Entity\Order), true) 
#40 /app/web/modules/contrib/commerce/src/CommerceContentEntityStorage.php(92): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook('update', Object(Drupal\commerce_order\Entity\Order)) 
#41 /app/web/modules/contrib/commerce/modules/order/src/OrderStorage.php(103): Drupal\commerce\CommerceContentEntityStorage->invokeHook('update', Object(Drupal\commerce_order\Entity\Order)) 
#42 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(507): Drupal\commerce_order\OrderStorage->invokeHook('update', Object(Drupal\commerce_order\Entity\Order)) 
#43 /app/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(658): Drupal\Core\Entity\EntityStorageBase->doPostSave(Object(Drupal\commerce_order\Entity\Order), true) 
#44 /app/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(432): Drupal\Core\Entity\ContentEntityStorageBase->doPostSave(Object(Drupal\commerce_order\Entity\Order), true) 
#45 /app/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(774): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\commerce_order\Entity\Order)) 
#46 /app/web/core/lib/Drupal/Core/Entity/Entity.php(390): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save(Object(Drupal\commerce_order\Entity\Order)) 
#47 /app/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowBase.php(311): Drupal\Core\Entity\Entity->save() 
#48 /app/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php(612): Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowBase->submitForm(Array, Object(Drupal\Core\Form\FormState)) 
#49 [internal function]: Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->submitForm(Array, Object(Drupal\Core\Form\FormState)) 
#50 /app/web/core/lib/Drupal/Core/Form/FormSubmitter.php(111): call_user_func_array(Array, Array) 
#51 /app/web/core/lib/Drupal/Core/Form/FormSubmitter.php(51): Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object(Drupal\Core\Form\FormState)) 
#52 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(589): Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object(Drupal\Core\Form\FormState)) 
#53 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('commerce_checko...', Array, Object(Drupal\Core\Form\FormState)) 
#54 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(216): Drupal\Core\Form\FormBuilder->buildForm('commerce_checko...', Object(Drupal\Core\Form\FormState)) 
#55 /app/web/modules/contrib/commerce/modules/checkout/src/Controller/CheckoutController.php(94): Drupal\Core\Form\FormBuilder->getForm(Object(Drupal\commerce_paypal\Plugin\Commerce\CheckoutFlow\PayPalCheckout), 'order_informati...') 
#56 [internal function]: Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object(Drupal\Core\Routing\RouteMatch)) 
#57 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) 
#58 /app/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#59 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 
#60 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) 
#61 /app/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#62 /app/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) 
#63 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#64 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#65 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#66 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#67 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#68 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#69 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#70 /app/web/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#71 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) 
#72 {main}.

Sorry for the lengthy traces, but I'm really lost getting this to work in a stable way.

jsacksick’s picture

Could you try unchecking the "Update shipping customer profiles with address information the customer enters at PayPal." setting and see if that makes a difference?

RandomNeighbour’s picture

The checkboxes don't seem to make a difference. I discovered however the following:

The error is preceded by two warnings (full traces below)

Warning: Illegal string offset 'target_id' in Drupal\entity_reference_revisions\Plugin\DataType\EntityReferenceRevisions->setValue() (line 116 of /app/web/modules/contrib/entity_reference_revisions/src/Plugin/DataType/EntityReferenceRevisions.php) Warning: Illegal string offset 'target_revision_id' in Drupal\entity_reference_revisions\Plugin\DataType\EntityReferenceRevisions->setValue() (line 116 of /app/web/modules/contrib/entity_reference_revisions/src/Plugin/DataType/EntityReferenceRevisions.php)

Also, if I use the browser to go back to the shipping form. Fill it in again, with the same data, it works. It is very consistently: fill form -> broken page -> return a page -> fill in the form -> review page works -> paypal payment works!

In both cases my payment information form does look a bit odd though. See attached image. Could that be hint? Thanks!


Full traces:

Warning: Illegal string offset 'target_id' in Drupal\entity_reference_revisions\Plugin\DataType\EntityReferenceRevisions->setValue() (line 116 of /app/web/modules/contrib/entity_reference_revisions/src/Plugin/DataType/EntityReferenceRevisions.php) 
#0 /app/web/core/includes/bootstrap.inc(584): _drupal_error_handler_real(2, 'Illegal string ...', '/app/web/module...', 116, Array) 
#1 /app/web/modules/contrib/entity_reference_revisions/src/Plugin/DataType/EntityReferenceRevisions.php(116): _drupal_error_handler(2, 'Illegal string ...', '/app/web/module...', 116, Array) 
#2 /app/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php(83): Drupal\entity_reference_revisions\Plugin\DataType\EntityReferenceRevisions->setValue('shipping_inform...', false) 
#3 /app/web/core/lib/Drupal/Core/Field/FieldItemBase.php(111): Drupal\Core\TypedData\Plugin\DataType\Map->setValue(Array, false) 
#4 /app/web/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php(175): Drupal\Core\Field\FieldItemBase->setValue(Array, false) 
#5 /app/web/modules/contrib/entity_reference_revisions/src/Plugin/Field/FieldType/EntityReferenceRevisionsItem.php(162): Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->setValue(Array, false) 
#6 /app/web/core/lib/Drupal/Core/TypedData/TypedDataManager.php(200): Drupal\entity_reference_revisions\Plugin\Field\FieldType\EntityReferenceRevisionsItem->setValue(Array, false) 
#7 /app/web/core/lib/Drupal/Core/Field/FieldTypePluginManager.php(82): Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object(Drupal\entity_reference_revisions\EntityReferenceRevisionsFieldItemList), 0, Array) 
#8 /app/web/core/lib/Drupal/Core/Field/FieldItemList.php(41): Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object(Drupal\entity_reference_revisions\EntityReferenceRevisionsFieldItemList), 0, Array) 
#9 /app/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php(66): Drupal\Core\Field\FieldItemList->createItem(0, Array) 
#10 /app/web/core/lib/Drupal/Core/Field/FieldItemList.php(107): Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, false) 
#11 /app/web/core/lib/Drupal/Core/TypedData/TypedDataManager.php(200): Drupal\Core\Field\FieldItemList->setValue(Array, false) 
#12 /app/web/core/lib/Drupal/Core/Field/FieldTypePluginManager.php(74): Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object(Drupal\Core\Entity\Plugin\DataType\EntityAdapter), 'shipping_profil...', Array) 
#13 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(603): Drupal\Core\Field\FieldTypePluginManager->createFieldItemList(Object(Drupal\commerce_shipping\Entity\Shipment), 'shipping_profil...', Array) 
#14 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(567): Drupal\Core\Entity\ContentEntityBase->getTranslatedField('shipping_profil...', 'x-default') 
#15 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(638): Drupal\Core\Entity\ContentEntityBase->get('shipping_profil...') 
#16 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(661): Drupal\Core\Entity\ContentEntityBase->getFields() 
#17 /app/web/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(223): Drupal\Core\Entity\ContentEntityBase->getIterator() 
#18 /app/web/modules/contrib/commerce_shipping/src/Plugin/Commerce/CheckoutPane/ShippingInformation.php(300): Drupal\Core\Entity\Entity\EntityFormDisplay->extractFormValues(Object(Drupal\commerce_shipping\Entity\Shipment), Array, Object(Drupal\Core\Form\FormState)) 
#19 /app/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php(590): Drupal\commerce_shipping\Plugin\Commerce\CheckoutPane\ShippingInformation->validatePaneForm(Array, Object(Drupal\Core\Form\FormState), Array) 
#20 [internal function]: Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->validateForm(Array, Object(Drupal\Core\Form\FormState)) 
#21 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array(Array, Array) 
#22 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(275): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState)) 
#23 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'commerce_checko...') 
#24 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(575): Drupal\Core\Form\FormValidator->validateForm('commerce_checko...', Array, Object(Drupal\Core\Form\FormState)) 
#25 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('commerce_checko...', Array, Object(Drupal\Core\Form\FormState)) 
#26 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(216): Drupal\Core\Form\FormBuilder->buildForm('commerce_checko...', Object(Drupal\Core\Form\FormState)) 
#27 /app/web/modules/contrib/commerce/modules/checkout/src/Controller/CheckoutController.php(94): Drupal\Core\Form\FormBuilder->getForm(Object(Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\MultistepDefault), 'order_informati...') 
#28 [internal function]: Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object(Drupal\Core\Routing\RouteMatch)) 
#29 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) 
#30 /app/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#31 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 
#32 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) 
#33 /app/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#34 /app/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) 
#35 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#36 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#37 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#38 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#39 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#40 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#41 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#42 /app/web/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#43 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) 
#44 {main}.

Warning: Illegal string offset 'target_revision_id' in Drupal\entity_reference_revisions\Plugin\DataType\EntityReferenceRevisions->setValue() (line 116 of /app/web/modules/contrib/entity_reference_revisions/src/Plugin/DataType/EntityReferenceRevisions.php) 
#0 /app/web/core/includes/bootstrap.inc(584): _drupal_error_handler_real(2, 'Illegal string ...', '/app/web/module...', 116, Array) 
#1 /app/web/modules/contrib/entity_reference_revisions/src/Plugin/DataType/EntityReferenceRevisions.php(116): _drupal_error_handler(2, 'Illegal string ...', '/app/web/module...', 116, Array) 
#2 /app/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/Map.php(83): Drupal\entity_reference_revisions\Plugin\DataType\EntityReferenceRevisions->setValue('shipping_inform...', false) 
#3 /app/web/core/lib/Drupal/Core/Field/FieldItemBase.php(111): Drupal\Core\TypedData\Plugin\DataType\Map->setValue(Array, false) 
#4 /app/web/core/lib/Drupal/Core/Field/Plugin/Field/FieldType/EntityReferenceItem.php(175): Drupal\Core\Field\FieldItemBase->setValue(Array, false) 
#5 /app/web/modules/contrib/entity_reference_revisions/src/Plugin/Field/FieldType/EntityReferenceRevisionsItem.php(162): Drupal\Core\Field\Plugin\Field\FieldType\EntityReferenceItem->setValue(Array, false) 
#6 /app/web/core/lib/Drupal/Core/TypedData/TypedDataManager.php(200): Drupal\entity_reference_revisions\Plugin\Field\FieldType\EntityReferenceRevisionsItem->setValue(Array, false) 
#7 /app/web/core/lib/Drupal/Core/Field/FieldTypePluginManager.php(82): Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object(Drupal\entity_reference_revisions\EntityReferenceRevisionsFieldItemList), 0, Array) 
#8 /app/web/core/lib/Drupal/Core/Field/FieldItemList.php(41): Drupal\Core\Field\FieldTypePluginManager->createFieldItem(Object(Drupal\entity_reference_revisions\EntityReferenceRevisionsFieldItemList), 0, Array) 
#9 /app/web/core/lib/Drupal/Core/TypedData/Plugin/DataType/ItemList.php(66): Drupal\Core\Field\FieldItemList->createItem(0, Array) 
#10 /app/web/core/lib/Drupal/Core/Field/FieldItemList.php(107): Drupal\Core\TypedData\Plugin\DataType\ItemList->setValue(Array, false) 
#11 /app/web/core/lib/Drupal/Core/TypedData/TypedDataManager.php(200): Drupal\Core\Field\FieldItemList->setValue(Array, false) 
#12 /app/web/core/lib/Drupal/Core/Field/FieldTypePluginManager.php(74): Drupal\Core\TypedData\TypedDataManager->getPropertyInstance(Object(Drupal\Core\Entity\Plugin\DataType\EntityAdapter), 'shipping_profil...', Array) 
#13 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(603): Drupal\Core\Field\FieldTypePluginManager->createFieldItemList(Object(Drupal\commerce_shipping\Entity\Shipment), 'shipping_profil...', Array) 
#14 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(567): Drupal\Core\Entity\ContentEntityBase->getTranslatedField('shipping_profil...', 'x-default') 
#15 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(638): Drupal\Core\Entity\ContentEntityBase->get('shipping_profil...') 
#16 /app/web/core/lib/Drupal/Core/Entity/ContentEntityBase.php(661): Drupal\Core\Entity\ContentEntityBase->getFields() 
#17 /app/web/core/lib/Drupal/Core/Entity/Entity/EntityFormDisplay.php(223): Drupal\Core\Entity\ContentEntityBase->getIterator() 
#18 /app/web/modules/contrib/commerce_shipping/src/Plugin/Commerce/CheckoutPane/ShippingInformation.php(300): Drupal\Core\Entity\Entity\EntityFormDisplay->extractFormValues(Object(Drupal\commerce_shipping\Entity\Shipment), Array, Object(Drupal\Core\Form\FormState)) 
#19 /app/web/modules/contrib/commerce/modules/checkout/src/Plugin/Commerce/CheckoutFlow/CheckoutFlowWithPanesBase.php(590): Drupal\commerce_shipping\Plugin\Commerce\CheckoutPane\ShippingInformation->validatePaneForm(Array, Object(Drupal\Core\Form\FormState), Array) 
#20 [internal function]: Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->validateForm(Array, Object(Drupal\Core\Form\FormState)) 
#21 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(82): call_user_func_array(Array, Array) 
#22 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(275): Drupal\Core\Form\FormValidator->executeValidateHandlers(Array, Object(Drupal\Core\Form\FormState)) 
#23 /app/web/core/lib/Drupal/Core/Form/FormValidator.php(118): Drupal\Core\Form\FormValidator->doValidateForm(Array, Object(Drupal\Core\Form\FormState), 'commerce_checko...') 
#24 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(575): Drupal\Core\Form\FormValidator->validateForm('commerce_checko...', Array, Object(Drupal\Core\Form\FormState)) 
#25 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(318): Drupal\Core\Form\FormBuilder->processForm('commerce_checko...', Array, Object(Drupal\Core\Form\FormState)) 
#26 /app/web/core/lib/Drupal/Core/Form/FormBuilder.php(216): Drupal\Core\Form\FormBuilder->buildForm('commerce_checko...', Object(Drupal\Core\Form\FormState)) 
#27 /app/web/modules/contrib/commerce/modules/checkout/src/Controller/CheckoutController.php(94): Drupal\Core\Form\FormBuilder->getForm(Object(Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\MultistepDefault), 'order_informati...') 
#28 [internal function]: Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object(Drupal\Core\Routing\RouteMatch)) 
#29 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) 
#30 /app/web/core/lib/Drupal/Core/Render/Renderer.php(582): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#31 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) 
#32 /app/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) 
#33 /app/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() 
#34 /app/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) 
#35 /app/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#36 /app/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#37 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(99): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#38 /app/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(78): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#39 /app/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#40 /app/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#41 /app/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#42 /app/web/core/lib/Drupal/Core/DrupalKernel.php(693): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) 
#43 /app/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) 
#44 {main}.
jsacksick’s picture

The screenshot from the last comment shows the order information step, right after coming back from PayPal? After being redirected from the cart page?

When initiating the payment from the cart page, once the payment is approved, it should be using the "PayPal Checkout" checkout flow plugin that is provided by the module.
This is the "shortcut" flow, and this flow should be configured to have less steps, and the payment information pane shouldn't be placed on that flow, and you shouldn't be able to place it btw.

My guess, based on the error you're describing is that an incomplete shipment is being saved (that's why I asked you to uncheck the "Update shipping customer profiles with address information the customer enters at PayPal." option since it's creating shipments based on the info we get from PayPal).

So is it failing with both flows? Both when initiating the payment from the cart page and from using the PayPal gateway when in the regular flow?

RandomNeighbour’s picture

The screenshot from the last comment shows the order information step, right after coming back from PayPal? After being redirected from the cart page?

No, this image is in fact the default checkout flow which crashes with errors I mention above. When Paypal is my only payment option, it gives this empty "payment information" pane.

Please see the attached image for the default checkout flow configuration. I'm not sure how to proceed debugging from here.

Although it seems that starting the PayPal checkout flow straight from the cart now works. Although I will need to test this better the coming week to see how this would work with shipment information for an anonymous user.

On the side: the review page in the Paypal flow has a button saying "pay and complete purchase", while it has already has been paid.

jsacksick’s picture

On the side: the review page in the Paypal flow has a button saying "pay and complete purchase", while it has already has been paid.

Not really, the payment is either captured or authorized once you click on the button.
When you come back from PayPal, the order total could vary (A promotion could be applied for instance, or a shipping service selection...).

No, this image is in fact the default checkout flow which crashes with errors I mention above. When Paypal is my only payment option, it gives this empty "payment information" pane.

There's a Commerce issue for that, See #2907504: Display payment method in the CheckoutPane Payment informations even if only single payment gateway available.

jsacksick’s picture

@RandomNeighbour: Can we discuss this on Slack sometime? https://www.drupal.org/slack

  • jsacksick committed 5076139 on 8.x-1.x
    Issue #3045306: Fix a bad use statement.
    
jsacksick’s picture

@RandomNeighbour: I realized Checkout.php had a bad use statement which was probably causing the issue in comment #1.

RandomNeighbour’s picture

Hi @jsacksick. Thanks a lot for the follow up. Let's indeed continue on Drupal Slack.

jsacksick’s picture

Status: Active » Closed (outdated)

@RandomNeighbour: Are you still experiencing issues? Could you try updating to the latest dev version? In the meantime, closing this as the initial issue reported is no longer relevant. (Feel free to open new ones if you find new issues).