Stripe: Allow subscription without payment method
You can also use default_incomplete
as the payment_behavior
value. It allows to create a subscription for a customer with no payment method attached.
Stripe's documentation says:
Use default_incomplete to create Subscriptions with status=incomplete when the first invoice requires payment, otherwise start as active.
Our subscription didn’t provide any trial period and it did the job in our case.
I ran into the same problem as @Jordi. My plan had a default trial period, but I was still getting the error mentioned in the question.
Instead of setting trial_end
as @Ywain suggests, I set trial_from_plan
to true
when creating the subscription. That way I didn't have to set and/or calculate the length of the trial in my API call.
You can create a subscription for a customer with no payment source, as long as there is nothing to bill immediately (e.g. because of a trial period, or because the plan is free, or because of a negative invoice item or coupon that reduces the first invoice's total to $0).
If you're getting this error message:
This customer has no attached payment source.
it means that Stripe is trying to bill the customer, so you must be using a non-free plan without a trial period. I'd recommend checking your code and the plan's properties to make sure that this plan has a default trial period, or make sure that you include the trial_end
parameter when creating the subscription.