-
Notifications
You must be signed in to change notification settings - Fork 49
Description
I am trying to create a subscription for a user when they register. However, I am getting an error saying that a payment source is necessary.
In the Stripe docs (https://stripe.com/docs/billing/subscriptions/trials) it says:
When creating a subscription with a trial period, no payment method is required for the customer. An immediate invoice is still created, but for $0.
However, in the Commerce docs (https://docs.craftcms.com/commerce/v3/subscription-templates.html#subscribing) it says:
Subscribing a user to a plan requires the user to have a stored payment source. If a user doesn’t have one, you can add it by displaying the payment form.
In this repo, here is where it is checking for payment methods:
commerce-stripe/src/gateways/PaymentIntents.php
Lines 295 to 297 in 7d45f4e
| if (\count($paymentMethods->data) === 0) { | |
| throw new PaymentSourceException(Craft::t('commerce-stripe', 'No payment sources are saved to use for subscriptions.')); | |
| } |
Perhaps it should only check for payment methods after checking if the subscription plan has a trial period, or if trial_end or trial_period_days has a truthy value?
This StackOverflow answer suggests the same: https://stackoverflow.com/a/41999174/2441459