#fractalskwish
1 messages ยท Page 1 of 1 (latest)
Hey there
When you say "end a trial Sub" do you mean cancel the sub?
Or do something else?
Yeah, I'm thinking cancel the subscription before it becomes "past due"
You can always cancel a Sub immediately using https://stripe.com/docs/api/subscriptions/cancel
I basically don't want to attempt to charge them at the end of the trial if they still haven't added a payment method
yeah, i think I understand I can cancel them immediately, and I was thinking of doing this when I get the invoice.created event which happens right around when the trial subscription ends
Hmm you won't want to wait for that
but then I'd also need to nullify that invoice before it's actually charged, I think
Are you using a send_invoice Sub or charge_automatically?
It sounds like charge_automatically, correct?
yes, I think so, but not 100% if that's really what I want
Gotcha. So with charge_automatically the invoice is going to finalize immediately upon renewal
So you don't want to wait for the invoice.created
You likely want to just set cancel_at_period_end on your Subs
ok, I think I need to read more before I can really understand what you're saying. fwiw, I do want other customer trials to be charged, but only if they have a payment method added by the time the trial ends
Right
So I think you create your Sub with cancel_at_period_end, then if PaymentMethod is collected you update the Sub to remove that
cool, I'll ready more about cancel_at_period_end and test it out
thank you!!
oh, just double checking the state of my subscription, it does say "'cancel_at_period_end': False"
but not sure if that changed at the trial period end, or was like that at the time of creation ๐
oh, sorry, I misread, so you're saying I should set it, which you're right, I'm probably not currently
Yep exactly
perfect, thanks again!
so I think I now understand what you're saying, but initially, I'm a bit hessitant with this approach. If for some reason I fail to act on whatever event that tells me the customer added a payment, I will end up losing the customer's business. If I understand this correctly.
Yes that's correct. But why would you fail to action it?
Also, you could always set up a "backup" of sorts and check if they have a set PaymentMethod ~1 hour before the trial ends
I guess it's more of a personal problem, I'm new at this company, and their backend handlers for routing webhook events is in a language I don't know yet (Kotlin hosted on AWS lambda)
Ah well yes you are going to need to write backend code here to do any of this ๐
I kinda like the idea of if we fail to act on an event, the worst that will happen is the customer will get a failed billing message (which is what currently happens)
I wouldn't implement cancel_at_period_end unless you are confident in writing the code to handle the webhook for when a PaymentMethod is added and then updating the Sub to remove that cancellation
if this is the best way to do it, I will strive to become more confident! but I guess I'm still at the point of making sure this is best way
what do you think about my first suggestion of watching for the first non-free invoice.created event, checking if customer/subscription has no billing method, and ending the subscription at that point, before the 1-hour period when stripe will attempt to proceess/charge the invoice?
(oh, and nullify the invoice too)
I guess I'm just longing for a feature like: I wish there was a subscription.end_at_trial_end_when_no_billing_method
Hi there. bismarck had to step out, so I'm taking over. Give me a bit to catch up on context
Yeah I think that approach should work
It's up to you
ok, thank you!
if you take feature requests, I'd like a subscription setting like "end_at_trial_end_if_no_payment_method = True" ๐
We do take feature requests! No guarantees something like this would be implemented though
It would be up to the owning team (who'd have to prioritize, etc)
of course, all I can do is ask ๐ maybe someone else would be happy it's implemented, if you guys think it's a good idea
For sure. Thanks!
before I dig in any further on other options, do you think a subscription tier setup might give us what we are looking for? or maybe it's called subscription "phases"?
Ah I think you're referring to subscription schedules?
You just want to know if cancellation if a payment method isn't provided would be achieved easier with sub schedules?
yes, I think so
I guess I'm just searching for a method that doesn't require me to act on events, and more of a pre-defined configuration/option at the time we create a new trial subscription
Yeah unfortunately there's no way to define that logic
Without having you act on events
ok, cool, thank you again. just to confirm, in the method I'm probably going to attempt, I will need to both cancel the subscription AND find/nullify the non-free invoice at the trial end date
at least, this is my current understanding, and makes sense to me
Yup. That invoice will be on the latest_invoice param: https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Then you can void it: https://stripe.com/docs/api/invoices/void
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
awesome, thank you!