<p>Looks like the example in the sample code in the doc of the Stripe Gateway plugin is wrong - cf <a href="https://github.com/craftcms/commerce-stripe/issues/220" rel="nofollow noreferrer">https://github.com/craftcms/commerce-stripe/issues/220</a></p>
<p>The parameter should be <code>paymentForm[stripe][paymentMethodId]</code> not <code>paymentMethodId</code></p>

CC BY-SA 4.0
2023-01-26T06:15:40.327Z
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.
stevecomrie
CC BY-SA 4.0
2022-10-17T17:34:02.097Z
2022-10-17T17:34:02.097Z
Seb
<p>Followed all instructions in the Stripe for Commerce plugin docs.
When submitting a payment locally and in staging environment, I get the &quot;Payment Method Id cannot be blank&quot; error.</p>
<p>Yii Debug Tool &gt; requests &gt; parameters:</p>
<pre><code>'action' =&gt; 'commerce/payments/pay'
'redirect' =&gt; '7de704ae79dafea4539dba5fae42b0e2476e8ac95101f5df1d07d1bc70b1e811https://test-site.ddev.site:8443/shop/checkout/order-confirmation?number=5c7b900b16fca5edc20afb301d064f43&amp;success=true'
'cancelUrl' =&gt; 'e4c7231e9b5a0ceb5d41dd6452205412126499871d0881d527ca8e064eaf12ddhttps://test-site.ddev.site:8443/shop/checkout/payment'
'gatewayId' =&gt; '2'
'orderEmail' =&gt; 'email@site.com'
'CRAFT_CSRF_TOKEN' =&gt; '••••••••••••••••'
'accept-terms' =&gt; 'on'
'firstName' =&gt; 'FIRSTNAME'
'lastName' =&gt; 'LASTNAME'
'paymentMethodId' =&gt; 'pm_1LQYCMBrPbSFOQ6o99VI3vYp'
</code></pre>
<p>Yii Debug Tool &gt; requests &gt; session:</p>
<pre><code>xxxxxx__flash: 'error' =&gt; 1
error: 'Invalid payment or order. Please review.'
</code></pre>
<p>Can't figure out where it fails. The payment method id seems to be there, but somehow fails to get through.</p>
<p>Craft CMS Pro 4.2.0.1
Craft Commerce PRO 4.1.0
Stripe for Craft Commerce 3.0.1</p>

CC BY-SA 4.0
2022-08-05T14:16:29.880Z
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
CC BY-SA 4.0
2022-10-17T17:23:50.860Z
@jjem Did you ever figure this out?
Seb
<stripe><commerce4>
Stripe for Craft Commerce 4: Payment Method Id cannot be blank
# Stripe for Craft Commerce 4: Payment Method Id cannot be blank

(Asked by: username_0 on 2022-07-28)

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@site.com'
'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 4.2.0.1
Craft Commerce PRO 4.1.0
Stripe for Craft Commerce 3.0.1

**Tags:** stripe, commerce4
> **Comments:**
> **username_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.  
> **username_2**: @jjem Did you ever figure this out?  

---

## 1 answers

### Answer by username_2 on 2022-10-17. Score: 2

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`

> **Comments:**
> **username_3**: 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.  

---

