Is there any way to determine the exact date and time when an the event
invoice.created occurred, given that Invoice?
inv = Stripe::Invoice.retrieve(....)
# when did `invoice.created ` occurred for "inv"?
As far I know,
period_end reflects the date-time of
invoice.payment_succeeded. I guess I can take
period_end and subtract 1 hour (as the documentation says), but 1 hour isn't exact time, somewhere I read it was a few hours, what's more is that there might be the failing attempts to charge the user, thus there's might an additional delay between them so just subtracting 1 hour doesn't give me the exact time of
The easiest solution here would be to listen to the
invoice.created event with a webhook and store the
created value (or at least the event id) in your database.
You are correct that the invoice would be closed after an hour but only once all the webhooks have successfully returned a
200 response code to the request. Otherwise the webhook would be resent every hour up to 3 days until success before the invoice could be closed .
You could otherwise use the List Events API and filter events by date with the
created parameter and
type where you would put
invoice.created and would allow you to find the event after the fact and retrieve the
You could also look into the
webhooks_delivered_at field on the Invoice object but that would not work if you webhooks failed for some reason on first delivery.