#meteograms-trial

1 messages · Page 1 of 1 (latest)

hollow dust
#

@analog mason you can use trial_end on Subscription creation to control exactly when to end a trial and it can end in a minute or 10 or 3 days + 1 hour, etc.

analog mason
#

I'm creating the subscription via a Checkout, so am setting the trial period in the checkout session creation:

#

Docs say "Has to be at least 48 hours in the future."

hollow dust
#

yeah that just can't work, create a Subscription without Checkout instead to test the events

analog mason
#

Is there any way of triggering this webhook at another time before trial ends, e.g. 12 hours, or 1 day?

#

Or it has to be 3 days? Just that my trial period is 3 days!

hollow dust
#

it needs to be more than 3 days for it to trigger

#

so you need to create a subscription with trial_end set to a timestamp that is for example 3 days + 1 hour and then wait for it to happen

analog mason
#

OK, but I was hoping to use this webhook event to add an item to the invoice, but only do this near the end of the trial period... but with an actual trial period of 3 days in reality, there's no way to achieve what I want?

#

That period before end of trial isn't configurable, it seems?

hollow dust
#

correct you can't configure that time today

#

you can add an item to the invoice when you get the invoice.created event. Only the first invoice can't be edited, so when the trial ends you get invoice.created and add the invoice item to it

analog mason
#

"Only the first invoice can't be edited" -- is that the one that is issued right at the start? So the invoice that issues at the end of the trial period is the second invoice?

hollow dust
#

yes!

analog mason
#

And I edit an invoice with this?

#

How do I add a line_item to the invoice with this?

analog mason
#

Excellent, thanks 👍

hollow dust
#

of course!

analog mason
#

Quick follow-up... if the customer cancels the sub during the trial, will this second invoice be created still, and if so, will the subscription status be 'canceled' I assume... so I can check this status and not add the invoice item if canceled... hopefully?

#

Also, if they haven't cancelled, will the status be 'trialling' or 'active? I'd like to add this invoice item only once, at the end of a non-cancelled trial period... so maybe I can check if status is 'trialling' and if so then add the item?

hollow dust
#

no if they cancel no future invoice will be created, either they cancel immediately, subscription ends, nothing else happen, or you configure it to cancel at the end of the period (end of the trial in your case) in which case the subscription stays active (or trialling for you) and cancels at the end (no more invoices)

#

and status is trialing in your case

#

you can test all of this really easily in Test mode which I strongly recommend

#

By the time you get the invoice though the subscription will have moved off of the trial and will be active

#

(sorry only understood your question after I replied)

analog mason
#

OK. But if they cancel during the free trial, there is definitely no invoice created... so I'm not at risk of adding a charge to a customer that just cancelled? (there will be no invoice items at that point to mop up)

hollow dust
#

correct

#

(remember you control if they cancel or not with your own code so you'd know if they do)

analog mason
#

True enough. Then the only thing I need to do is distinguish between the end-of-trial invoice (invoice item to be added) and subsequent end-of-subscription-period invoices (no invoice item to be added)

hollow dust
#

yeah there isn't really a way to do this at the invoice level today. Only way is to track this in your database

analog mason
#

OK, thanks. The subscription field in the invoice.created webhook object (event.data.object) is just an id... is there any way to have this expanded (to get details), without just retrieving the subscription in a separate call?

kindred fox
#

Hello! There is no way to expand properties in an Event, you would need to make another API call to get that info.