currently if Auto collection ON and Dunning is set to "mark invoice as Not paid" function ChargeBee_Subscription::createForCustomer for NOT TRIAL fails with error "no valid card on file".
If turn off Auto collection subscription can be created, with invoice marked as Payment due.
Isn't reasonable to allow subscription creation in such case and set invoice to Not payed?
Dunning management comes into action only when there's a payment method on file. In the absence of a payment method, dunning settings won't be considered as there won't be any reference to retry payment collection on.
In these cases, setting Auto Collection to Off the recommended option as this would make the system treat it as an Offline transaction and not cancel the account.
I noticed that my colleague has already created it as a feature request to collect existing invoices automatically when a card is added.
However it's not possible to create an active subscription with Auto Collection On as the system would then try to charge the invoice immediately. In this case, the card wouldn't be present, the charge wouldn't go through, and thus, the subscription wouldn't be created. Changing this behavior would affect the renewal behavior as well.
Auto Collection is automatically set to On when a card is added so that subsequent renewals can be charged automatically.
As explained earlier in this thread, Dunning management comes into action only when there's a payment method on file. Dunning cannot happen when there's no payment method reference.
To make Offline dunning run (i.e. send reminder emails if enabled), Auto Collection must be turned Off
I'll pass the feedback to our Engineering team for their future consideration Vlad. However, at the moment it's not possible to change this behavior as this would affect a large number of existing integrations and the dunning logic in the system. We'll let you know if the behavior is changed in future.