<p>The issue was that I used an older version of the Stripe plugin that not supported the elements functionality of Stripe. After upgrading to 4.1.1 the problem was solved.</p>

CC BY-SA 4.0
2024-03-20T20:21:58.943Z
2024-03-20T20:21:58.943Z
Maarten Heideman
<p><a href="https://github.com/craftcms/commerce-stripe/tree/4.0?tab=readme-ov-file#customizing-the-stripe-payment-form" rel="nofollow noreferrer">https://github.com/craftcms/commerce-stripe/tree/4.0?tab=readme-ov-file#customizing-the-stripe-payment-form</a></p>
<p>It looks like you may not have passed the params you defined?</p>
<p><code>{{ cart.gateway.getPaymentFormHtml(params)|raw }}</code></p>
<p>Otherwise, Id make sure your payment methods are setup in Stripe and that your API keys are for the same environment (dev v. live) for the one you edited payment methods for. Easy to turn them on in dev but be accidentally using the live keys.</p>
<p>You may want to use:</p>
<pre><code>{% set params = {
  paymentFormType: 'checkout',
} %}

{{ gateway.getPaymentFormHtml(params)|raw }}
</code></pre>
<p>... if you want the stripe hosted checkout / redirect.</p>

CC BY-SA 4.0
2024-03-20T20:24:40.823Z
Indeed my example missed the params variable but that was not the issue. I copy past the wrong code I gues.
Maarten Heideman
CC BY-SA 4.0
2024-03-19T07:43:00.217Z
2024-03-19T07:43:00.217Z
cherrykoda
<p>I'll working on a project where users can buy a subscription to recieve extra features in their account. In the Stripe dashboard I'll set up 2 different products year en monthly payment. In craft commerce I connected the products to the subscription plans. I'll set up 4 payment methods in Stripe. But rendering the form for handeling the payment only show a creditcard option. I'll use:</p>
<pre><code>{% set gateway = craft.commerce.gateways.getGatewayByHandle('stripe') %}

&lt;form method=&quot;POST&quot;&gt;
  {{ csrfInput() }}
  {{ actionInput('commerce/payments/pay') }}

  {# Include *outside* the namespaced form inputs: #}
  {{ hiddenInput('gatewayId', gateway.id) }}

  {% namespace gateway.handle|commercePaymentFormNamespace %}
    {{ gateway.getPaymentFormHtml({})|raw }}
  {% endnamespace %}

  &lt;button&gt;Pay&lt;/button&gt;
&lt;/form&gt;
</code></pre>
<p>Also tried working with custom params like:</p>
<pre><code>{% set params = {
  paymentFormType: 'elements',
} %}
</code></pre>
<p>But no difference there. Someone has suggestions ho to show all payment methods?</p>
<p><em>The project runs on Craft 4 and Commerce 4</em></p>

<plugin-craftcommerce><stripe><plugin-commerce-stripe>
Stripe gateway only display creditcard for subscription plans
# Stripe gateway only display creditcard for subscription plans

(Asked by: username_0 on 2024-03-08)

I'll working on a project where users can buy a subscription to recieve extra features in their account. In the Stripe dashboard I'll set up 2 different products year en monthly payment. In craft commerce I connected the products to the subscription plans. I'll set up 4 payment methods in Stripe. But rendering the form for handeling the payment only show a creditcard option. I'll use:
{% set gateway = craft.commerce.gateways.getGatewayByHandle('stripe') %}


  {{ csrfInput() }}
  {{ actionInput('commerce/payments/pay') }}

  {# Include *outside* the namespaced form inputs: #}
  {{ hiddenInput('gatewayId', gateway.id) }}

  {% namespace gateway.handle|commercePaymentFormNamespace %}
    {{ gateway.getPaymentFormHtml({})|raw }}
  {% endnamespace %}

  Pay


Also tried working with custom params like:
{% set params = {
  paymentFormType: 'elements',
} %}

But no difference there. Someone has suggestions ho to show all payment methods?
The project runs on Craft 4 and Commerce 4

**Tags:** plugin-craftcommerce, stripe, plugin-commerce-stripe

---

## 2 answers

### Answer by username_0 on 2024-03-20. Score: 1 | Accepted answer

The issue was that I used an older version of the Stripe plugin that not supported the elements functionality of Stripe. After upgrading to 4.1.1 the problem was solved.


---

### Answer by username_1 on 2024-03-19. Score: 1

https://github.com/craftcms/commerce-stripe/tree/4.0?tab=readme-ov-file#customizing-the-stripe-payment-form
It looks like you may not have passed the params you defined?
{{ cart.gateway.getPaymentFormHtml(params)|raw }}
Otherwise, Id make sure your payment methods are setup in Stripe and that your API keys are for the same environment (dev v. live) for the one you edited payment methods for. Easy to turn them on in dev but be accidentally using the live keys.
You may want to use:
{% set params = {
  paymentFormType: 'checkout',
} %}

{{ gateway.getPaymentFormHtml(params)|raw }}

... if you want the stripe hosted checkout / redirect.

> **Comments:**
> **username_0**: Indeed my example missed the params variable but that was not the issue. I copy past the wrong code I gues.  

---

