#bugkiller.
1 messages ยท Page 1 of 1 (latest)
Hello! A trial can be added to a Subscription independently, regardless of the trial data on the Plan. In fact, we no longer recommend setting trials on Plans and instead recommend setting trial periods directly on Subscriptions themselves.
then what is best way to check if subscription had trial or not
Had? As in ever had a trial in the past? Or currently has a trial period?
That's something we recommend you track on your end if you want to know about past trial activity. If you don't store it on your end you would likely need to look at the Subscription's previous Invoices to determine if any of them mention a trial period.
A Subscription can have multiple trial periods, and they can happen at any time between other paid periods.
hmm, so no easy way to tract it?
if my subscriptoin doesn't have trial, what data are you sending on field 'trial_end'?
The easiest way would be to set up a Webhook Endpoint to listen for customer.subscription.updated Events and record any change that starts or ends a trial in your system: https://stripe.com/docs/api/events/types#event_types-customer.subscription.updated
If there's no trial trial_end will be null.
in my check, I got timestamp so asking
That means there's a trial.
Can you give me the Subscription's ID so I can take a look?
You created that Subscription with a Price that had trial data, and you specified trial_from_plan, so a trial period exists for that Subscription: https://dashboard.stripe.com/logs/req_wVDPAReoYD8hMO
hmm, then this plan is updating existing plan maybe?
Not sure I understand?
anyway, one other question. can I get last paid amount for subscription easily?
Yeah, you can look at the Subscription's latest_invoice: https://stripe.com/docs/api/subscriptions/object#subscription_object-latest_invoice
You can expand it if you want the full Invoice object: https://stripe.com/docs/expand
when I retreive the subsccription, can I get latest invoice detail together somehow?
You mean you want to get the Subscription and the latest Invoice in one API request?
yes
Yep, that's what expansion is for.
You can expand the latest_invoice property to get the full Invoice object instead of just the Invoice ID.
super!!
your api is like heaven if it's compared to paypal api ๐
let me try
I expand , but no latest invoice then it will be null?
one more question
๐ฆ
Not sure I understand. You have a Subscription with no latest Invoice?