1

My subscription process with stripe payment form is not showing up anymore in Craft V4.
CraftCMS 4.6.1 + Craft Commerce 4.4.1.1 + Stripe for Craft Commerce 4.1.2.3.

I got this message now:
Can not use the Stripe payment form to subscribe. Please create a payment source first.

Here the code of my signup page:

{% set plan1 = craft.commerce.getPlans().getPlanByHandle('membershipPlan5MonthlyTest') %}
{% set paymentSources = craft.commerce.getPaymentSources().getAllGatewayPaymentSourcesByCustomerId(plan1.gateway.id, currentUser.id ?? null) %}

<div class="paymentForm">
  {{ plan1.gateway.getPaymentFormHtml({})|raw }}
</div>

For info I mounted an old version of the project with Craft V3 and it is still working.
So the problem does not come from Stripe...

Any ideas as to how to fix this?

1 Answer 1

1

If you have a look at the docs here, from v4 onwards the way Subscriptions work has been updated quite significantly. Have a more thorough read through and make sure you've made all the necessary changes. We had quite a few similar issues when we upgraded, and we had missed some of the detail in the docs. Stuff like...

  1. The API version in Stripe will likely need changing to a more modern version (2022-11-15 is now the minimum). We updated to the very latest version and that works fine.
  2. You aren't able to use the commerce/subscriptions/subscribe to also add payment sources. You need to have already added the Payment Source to Stripe before you use it to subscribe.

Also take a look at the example templates and see if there's any differences to what you have. If you're able to, see if you can use the templates as-is in your project to see if they work. There were some small details in there that we'd missed, such as the payment forms being namespaced. One final thing, make sure you've got an update-billing-details template setup (it's in the example templates linked) and added to your Commerce settings. If any of your subscribers have issues with their cards (expired, run out of money, need 3DS verification (in UK), this page will help with that.

Hopefully, there's something in amongst this lot that might help, best of luck.

[Edit] Failing all of that, you might be as well to post the issue on Github. In the end we've ended up using a dev branch of the Commerce Stripe plugin to resolve our issues (it was 3DS related, so might not be relevant to you).

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.