Problem

I've set up PayPal and Offline payments as payment gateways. Whenever I select PayPal on the "Order Information" step and click on "Continue to Review", I get a blank page with the following error:

Error: Call to a member function getEntity() on null in Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->submitPaneForm() (line 360 of /web/modules/contrib/commerce/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentInformation.php)

If I select another payment method, I am being redirected to the Order Review page without any errors/warnings.

I checked the error logs and I see that I get the following `notice` right before the above error:

Notice: Undefined index: #inline_form in Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->submitPaneForm() (line 358 of /web/modules/contrib/commerce/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentInformation.php)

I also checked the code and it seems that the:
$inline_form = $pane_form['billing_information']['#inline_form'];
is null.

I have tried the following:
- Disabling my custom theme and using Bartik which still gave me the same issue.
- Deleted and added again the PayPal payment gateways.
- Tried both live and sandbox modes for PayPal
- Uninstalled and installed Commerce PayPal
- Uninstalled and installed Commerce Payment

Steps to reproduce

1. Add a product to the cart and proceed to checkout
2. Select PayPal on the "Order Information" page/checkout step
3. Click on "Continue to Review" and on the next page the error appears.

Versions

Drupal core 8.9.7
Drupal Commerce 8.x-2.21
Commerce PayPal 8.x-1.0-beta11
Commerce Shipping 8.x-2.0-rc2
Commerce Variation Cart Form 8.x-1.2

Thank you in advance for your help.

CommentFileSizeAuthor
#17 payment-information-3177957-9.patch1.1 KByuradoc
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ntg created an issue. See original summary.

ConradFlashback’s picture

+1 Same problem

ntg’s picture

Hi ConradFlashback.
Have you managed to resolve the issue?

dvincitravis’s picture

I'm having the same problem with commerce_stripe. Same error, class, method, and line number.

ntg’s picture

@dvincitravis I can confirm that I installed `commerce_stripe` and came across the same issue as well.

Commerce payment seems to only work with offline payment gateways. Paypal and Stripe fail.

trickfun’s picture

i'm having the same problem with commerce_stripe and commerce braintree

jsacksick’s picture

I have Braintree and Paypal configured on a dev instance, and never experienced this... Is there anything I'm missing?

Which PayPal gateway/plugin were you using? PayPal Checkou (a.k.a PayPal Commerce platform?) How is it configured?

dvincitravis’s picture

Could this be related?

https://www.drupal.org/project/commerce/issues/3079973

I'm getting this error while trying to add Stripe checkout to an existing site (which currently uses PayPal). PayPal checkout still works fine. I only get the error with Stripe.

If I set up Stripe checkout in a fresh Drupal install, I don't get the error. So it seems like something about my Commerce configuration – or some code in another module – might be causing the issue.

I tried updating drupal/commerce and all of its dependencies to the latest versions, but that didn't help.

jsacksick’s picture

Status: Active » Closed (cannot reproduce)

@dvincitravis: Could you copy/paste the exact error message? If this doesn't happen on a fresh install... I cannot really help... Unless you give me exact steps to be able to reproduce the issue, or you could try writing a failing test... Feel free to reopen the issue with any of that.

trickfun’s picture

I get this error with both stripe and braintree:

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getEntity() on null in Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->submitPaneForm() (line 360 of modules/contrib/commerce/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentInformation.php).

Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->submitPaneForm(Array, Object, Array) (Line: 607)
Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('commerce_checkout_flow_multistep_default', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 219)
Drupal\Core\Form\FormBuilder->getForm(Object, 'order_information') (Line: 94)
Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
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: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

All modules and core are up-to-date to latest version.
commerce_braintree 8.x-1.x-dev
commerce_stripe:1.x-dev@dev

I notice that the billing information field hides when i select a payment method.

trickfun’s picture

Same error with paypal.
Only onsite payment method works.

With paypal, stripe, braintree Payment information fields disappear.

I think this bug is critical.
Thank

dvincitravis’s picture

I've given up on Stripe, and have switched to PayPal Commerce Platform. Now I'm getting a similar error with that gateway, as well.

Given the number of people who have reported very similar errors in the last two months, in a variety of different scenarios, there is clearly a bug here.

Below is the error that I'm now getting with PayPal Commerce Platform. This happens when I click on the "Confirm Purchase" button on the order information pane.

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getEntity() on null in Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->submitPaneForm() (line 360 of modules/contrib/commerce/modules/payment/src/Plugin/Commerce/CheckoutPane/PaymentInformation.php).
Drupal\commerce_payment\Plugin\Commerce\CheckoutPane\PaymentInformation->submitPaneForm(Array, Object, Array) (Line: 607)
Drupal\commerce_checkout\Plugin\Commerce\CheckoutFlow\CheckoutFlowWithPanesBase->submitForm(Array, Object)
call_user_func_array(Array, Array) (Line: 114)
Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 52)
Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 593)
Drupal\Core\Form\FormBuilder->processForm('commerce_checkout_flow_multistep_default', Array, Object) (Line: 321)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 219)
Drupal\Core\Form\FormBuilder->getForm(Object, 'order_information') (Line: 94)
Drupal\commerce_checkout\Controller\CheckoutController->formPage(Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
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: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 49)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->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: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
dvincitravis’s picture

I honestly understand very little about the internals of Drupal in general (much less the Commerce framework in particular) – so this could very well be a red herring.

But, in Googling about this problem, I came across this issue, which could shine some light:

https://www.drupal.org/project/commerce/issues/3003121

jsacksick’s picture

@dvincitravis: Are you using the latest version of Commerce PayPal?

dvincitravis’s picture

@jsacksick: I was running Commerce 8.x-2.20 when I got the error that I cited in #12. But I have previously tried upgrading to the latest version (8.x-2.21), and I still saw very similar errors.

I just re-upgraded to 8.x-2.21, and tried Stripe again. I got an error identical to the one in #12 (I did a diff between the two).

Then I switched back to the "PayPal - Express Checkout [LEGACY-DEPRECATED]" gateway, and that works.

dvincitravis’s picture

yuradoc’s picture

Solution that works for me is in the patch.
Sorry, wrong comment id in patch name.

jsacksick’s picture

I committed the patch from #17, thanks!

penyaskito’s picture

Status: Closed (cannot reproduce) » Fixed

Changing status. Somehow drupal.org didn't get the link to https://git.drupalcode.org/project/commerce/-/commit/512ee55a07b565b9f42...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.