#deland_webhooks
1 messages · Page 1 of 1 (latest)
đź‘‹ Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
đź”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1328315584215121962
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- deland_best-practices, 4 days ago, 16 messages
- deland_api, 4 days ago, 7 messages
- deland_webhooks, 4 days ago, 23 messages
- deland_webhooks, 6 days ago, 20 messages
Just for some context, here is how subscriptions generally work for my booking application:
- Buyer makes a reservation request & we create an uncaptured PaymentIntent
- Seller accepts request, we capture the PaymentIntent, and create a Subscription
- The subscription
trial_endis set to the reservation's start time.
hi!
It would be even better if I could prevent an invoice from creating from a trial subscription.
that's not possible.
I don't understand the issue, the first invoice of a subscription (the one created when you create the subscription, like this $0 at the start of a trial) will be immediately finalized, you don't need to manually finalize it.
I use webhook and listen to invoice.created event, which runs some side effects
maybe ignore invoices in that event that are billing_reason:'subscription_create' then https://docs.stripe.com/api/invoices/object#invoice_object-billing_reason
I want to ignore it for invoices created from trial—and since I already use a PaymentIntent in order to create this request system, I also need to ignore the invoice created when subscription starts
Oh okay thats works thanks
And is there a better way to handle ignoring that invoice created when trial ends?
Right now I just create a new invoice line item with a negative amount to make amount_due = $0
I don't really understand. When the trial ends a new billing cycle starts and we generate an invoice yes. Why are you adding a negative item to that?
Since I already had the customer pay using a PaymentIntent, I don't want to double charge
I only create a subscription when the Seller accepts a request—otherwise the customer is refunded or we dont capture
does billing_reason have some sort of trial_ended or first_invoice kinda thing?
here's how I understand your timeline.
Jan 13 - PI for $100 ; create trial Subscription , $0 invoice
Feb 13 — subscription trial ends, $100 invoice for the upcoming month
I don't see how a) that's a trial if you're paying for it and b) why you'd think this is a double charge.
does billing_reason have some sort of trial_ended or first_invoice kinda thing
no. You could look and see if the value oftrial_endon the Subscription is equal to the current_period_start at the time of handling this event to see if the trial has just ended.
This is my timeline:
Jan 13 - Customer creates a monthly reservation request for $100 (PI), to start on Jan 15
Jan 13 - Seller accepts and we capture the PI. Trial subscription is created and ends on Jan 15 so the billing cycle anchor is set correctly. Ignore trial sub invoice.
Jan 13-14 - If either party cancels, the Customer gets refunded.
Jan 15 - Trial subscription ends and invoice generated for $100
If i didn't cancel out that trial end invoice, then the Customer would be paying $200 for the first month.
It's not paying for a trial, we just use the trial behavior to make this request system and payment management work the way we need it to.
I tried setting the billing_anchor but using trials worked better for tracking subscrip. status
I see. Then yeah, you can just add the negative -$100 item at any time, including when handling the invoice.created yes. There's various ways to determine that invoice is the first one after the trial, like checking the timestamps I mentioned, or calling https://docs.stripe.com/api/invoices/list#list_invoices-subscription and counting, or storing a flag in your database, and so on
Ok great thanks for the help! I apprecaite it