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') %}

<form method="POST">
  {{ csrfInput() }}
  {{ actionInput('commerce/payments/pay') }}

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

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


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

2 Answers 2



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.

  • Indeed my example missed the params variable but that was not the issue. I copy past the wrong code I gues. Commented Mar 20 at 20:24

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.

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.