Skip to content

Cannot create subscription without payment source, even with free trial period #106

@GaryReckard

Description

@GaryReckard

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:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions