Open harry2909 opened 2 months ago
Also experiencing this with Commerce 4.6.11 and Stripe for Craft Commerce 4.1.5.
I've got a form on my payment page like;
<form method="post" id="payment-form" action="">
{{ csrfInput() }}
{{ actionInput('commerce/payments/pay') }}
{{ redirectInput(siteUrl('/shop/checkout/order?number=' ~ cart.number) )}}
{{ hiddenInput('cancelUrl', siteUrl('/shop/checkout/payment')|hash) }}
{{ hiddenInput('orderEmail', cart.email) }}
{{ cart.gateway.getPaymentFormHtml({})|raw }}
</form>
And with asyncCsrfInputs
set to true in general config, the Stripe element doesn't render but shows 'Unable to verify your data submission'.
@jonnykates
Does using {{ csrfInput({ async: false }) }}
in the payment form fix this issue?
Description
Whenever I navigate to the payment page, the stripe form just renders a 400 error.
We're using blitz caching alongside a static caching solution, but this page should be omitted from the cache.
I can see in the request, the craft CSRF token is not added to the automatic post to the endpoint.
Payment form code:
It is worth noting that this worked absolutely fine until I set
enableCsrfProtection
to true in the general config, which does make sense. We needed this true so thatasyncCsrfInputs
would work.I've tested and setting asyncCsrfInputs to false does make it work, so it could be to do with this.
Please let me know if you need any more information.
Steps to reproduce
1. 2.
Additional info