Followed all instructions in the Stripe for Commerce plugin docs. When submitting a payment locally and in staging environment, I get the "Payment Method Id cannot be blank" error.

Yii Debug Tool > requests > parameters:

'action' => 'commerce/payments/pay'
'redirect' => '7de704ae79dafea4539dba5fae42b0e2476e8ac95101f5df1d07d1bc70b1e811https://test-site.ddev.site:8443/shop/checkout/order-confirmation?number=5c7b900b16fca5edc20afb301d064f43&success=true'
'cancelUrl' => 'e4c7231e9b5a0ceb5d41dd6452205412126499871d0881d527ca8e064eaf12ddhttps://test-site.ddev.site:8443/shop/checkout/payment'
'gatewayId' => '2'
'orderEmail' => '[email protected]'
'CRAFT_CSRF_TOKEN' => '••••••••••••••••'
'accept-terms' => 'on'
'firstName' => 'FIRSTNAME'
'lastName' => 'LASTNAME'
'paymentMethodId' => 'pm_1LQYCMBrPbSFOQ6o99VI3vYp'

Yii Debug Tool > requests > session:

xxxxxx__flash: 'error' => 1
error: 'Invalid payment or order. Please review.'

Can't figure out where it fails. The payment method id seems to be there, but somehow fails to get through.

Craft CMS Pro Craft Commerce PRO 4.1.0 Stripe for Craft Commerce 3.0.1

  • Is it hitting Stripe? If so, I'd look at the Stripe logs to see the error. There is usually much more helpful information there than from Commerce.
    – CraftQuest
    Commented Aug 5, 2022 at 14:16
  • @jjem Did you ever figure this out?
    – Seb
    Commented Oct 17, 2022 at 17:23

1 Answer 1


Looks like the example in the sample code in the doc of the Stripe Gateway plugin is wrong - cf https://github.com/craftcms/commerce-stripe/issues/220

The parameter should be paymentForm[stripe][paymentMethodId] not paymentMethodId

  • 1
    THANK YOU! Spent the better part of a couple hours trying to figure out why my payment form wasn't working even though the code I was using was from another project where it was already confirmed working. I think it was the upgrade to Craft 4. Commented Jan 26, 2023 at 6:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.