- Issue created by @solarDog
- πΈπΎSyria hodba Dubai
Hi,
sorry for the late reply, I was extremely busy the this month. if you're still having the issue, we can have a quick Zoom meeting to check what is happening at your end. For me, I tested it and it is working fine. Hi, I have the same issue.
Here the error in the log
TypeError: Drupal\stripe_webform_payment\StripteWebformPaymentStripe::getAllCustomers(): Argument #1 ($customerAttributes) must be of type array, null given, called in /opt/drupal/web/modules/stripe_webform_payment/src/Plugin/WebformElement/StripeWebformPayment.php on line 416 in Drupal\stripe_webform_payment\StripteWebformPaymentStripe->getAllCustomers() (linea 158 di /opt/drupal/web/modules/stripe_webform_payment/src/StripteWebformPaymentStripe.php).
#0 /opt/drupal/web/modules/stripe_webform_payment/src/Plugin/WebformElement/StripeWebformPayment.php(416): Drupal\stripe_webform_payment\StripteWebformPaymentStripe->getAllCustomers(NULL) #1 /opt/drupal/web/modules/stripe_webform_payment/src/Plugin/WebformElement/StripeWebformPayment.php(375): Drupal\stripe_webform_payment\Plugin\WebformElement\StripeWebformPayment->getCustomer(Array) #2 /opt/drupal/web/modules/stripe_webform_payment/src/Plugin/WebformElement/StripeWebformPayment.php(228): Drupal\stripe_webform_payment\Plugin\WebformElement\StripeWebformPayment->createPaymentIntent(Array) #3 /opt/drupal/web/modules/stripe_webform_payment/src/Plugin/WebformElement/StripeWebformPayment.php(201): Drupal\stripe_webform_payment\Plugin\WebformElement\StripeWebformPayment->updatePaymentForm(Array, Array, Object(Drupal\Core\Form\FormState)) #4 /opt/drupal/web/modules/stripe_webform_payment/src/Plugin/WebformElement/StripeWebformPayment.php(153): Drupal\stripe_webform_payment\Plugin\WebformElement\StripeWebformPayment->handlePaymentForm(Array, Array, Object(Drupal\Core\Form\FormState), 'pagamento_page') #5 /opt/drupal/web/modules/webform/src/WebformSubmissionForm.php(2623): Drupal\stripe_webform_payment\Plugin\WebformElement\StripeWebformPayment->alterForm(Array, Array, Object(Drupal\Core\Form\FormState)) #6 /opt/drupal/web/modules/webform/src/WebformSubmissionForm.php(2627): Drupal\webform\WebformSubmissionForm->alterElementsForm(Array, Array, Object(Drupal\Core\Form\FormState)) #7 /opt/drupal/web/modules/webform/src/WebformSubmissionForm.php(659): Drupal\webform\WebformSubmissionForm->alterElementsForm(Array, Array, Object(Drupal\Core\Form\FormState)) #8 [internal function]: Drupal\webform\WebformSubmissionForm->buildForm(Array, Object(Drupal\Core\Form\FormState)) #9 /opt/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(536): call_user_func_array(Array, Array) #10 /opt/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(375): Drupal\Core\Form\FormBuilder->retrieveForm('webform_submiss...', Object(Drupal\Core\Form\FormState)) #11 /opt/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(633): Drupal\Core\Form\FormBuilder->rebuildForm('webform_submiss...', Object(Drupal\Core\Form\FormState), Array) #12 /opt/drupal/web/core/lib/Drupal/Core/Form/FormBuilder.php(325): Drupal\Core\Form\FormBuilder->processForm('webform_submiss...', Array, Object(Drupal\Core\Form\FormState)) #13 /opt/drupal/web/core/lib/Drupal/Core/Entity/EntityFormBuilder.php(48): Drupal\Core\Form\FormBuilder->buildForm(Object(Drupal\webform\WebformSubmissionForm), Object(Drupal\Core\Form\FormState)) #14 /opt/drupal/web/modules/webform/src/Entity/Webform.php(1257): Drupal\Core\Entity\EntityFormBuilder->getForm(Object(Drupal\webform\Entity\WebformSubmission), 'add') #15 /opt/drupal/web/modules/webform/src/Controller/WebformEntityController.php(77): Drupal\webform\Entity\Webform->getSubmissionForm() #16 [internal function]: Drupal\webform\Controller\WebformEntityController->addForm(Object(Symfony\Component\HttpFoundation\Request), Object(Drupal\webform\Entity\Webform)) #17 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array) #18 /opt/drupal/web/core/lib/Drupal/Core/Render/Renderer.php(627): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #19 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure)) #20 /opt/drupal/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) #21 /opt/drupal/vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() #22 /opt/drupal/vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1) #23 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #24 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #25 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #26 /opt/drupal/web/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #27 /opt/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #28 /opt/drupal/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true) #29 /opt/drupal/web/core/modules/ban/src/BanMiddleware.php(50): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #30 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\ban\BanMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #31 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #32 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #33 /opt/drupal/web/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #34 /opt/drupal/web/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true) #35 /opt/drupal/web/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request)) #36 {main}
- π«π·France tostinni
When using the tokens, Stripe is receiving directly the token instead of its value causing an error 400 Bad Request.
name: [webform_submission:values:name] email: [webform_submission:values:email_address]
Here is what the form sends.
receipt_email: [webform:element:email:title] payment_method_data[type]: card payment_method_data[card][number]: 4242 4242 4242 4242 ...
I guess this is because those tokens aren't available when the stripe is sent (before the form submission).
Would it be possible to retrieve dynamically fields from the form ? - πΈπΎSyria hodba Dubai
Did you put the stripe payment field in the same page with the fields that you want to use as tokens? if this is the case, the tokens are not generated yet to pass their values to the stripe payment element. When you put the payment in a new page, the form builder will pass its values.
Otherwise you need to alter the webform and add ajax callback to update the values of the stripe payment element.