Reputation: 13
I'm looking to set up our billing and we have a bit of a unique case. We want to do the following:
This seems to be working for subsequent charges of the subscription. However, we've found that the first invoice is always immediately charged without waiting for the webhook to process succesfully. Any idea what we can do to get around this?
Read through Stripe API doc. Nothing relevant. Reached out to support and didn't get a satisfactory answer
Upvotes: 1
Views: 524
Reputation: 2784
To provide some context, the first invoice for subscriptions that use collection_method=charge_automatically
is immediately finalized and charged. So there is no one hour period in which a user can update the invoice before finalization. All subsequent invoices generated for subscription renewals will have the one hour draft period
There are two workarounds :
You can create the subscription with trial_end
set a couple of seconds into the future. Unfortunately, you can't use Checkout Sessions for this since Checkout Sessions require trial_end
to be 48 hours in the future. The subscription will first generate a $0 invoice, and once the trial is over a non-zero invoice will be created with a one hour draft period. The initial status of this subscription will be trialing and will transition to either active or past_due depending on the payment outcome.
Create the subscription through a subscription schedule. Subscription schedules cannot be created using Checkout Sessions. You will need to collect the PaymentMethod first then create a subscription schedule. When the schedule starts, the subscription’s initial status will be active with an initial draft invoice that is scheduled to finalize in an hour. Depending on whether payment of the initial invoice is successful or not, the subscription will either stay active or transition to past_due.
You will likely want to use the Payment Element to collect payment instead, these guides may be useful :
Upvotes: 1