#bondsmith_webhooks

1 messages · Page 1 of 1 (latest)

honest ermineBOT
#

đź‘‹ 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/1303097597422076026

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

frail mesa
slim verge
#

Hi @frail mesa checking as we speak! Will get back in a second, thanks for the quick reply!

#

I'm redeploying my code to log both created params to check. The one I can see in the dashboard is the created for the invoice which shows the same value for all events so I can't use it for comparissons.

Is there a way to see the created param you pointed out in the link? The only created I can see in the link is the one in the event's object.

frail mesa
#

Yes, it's under the 'Webhook Attempts' > 'Request to your endpoint' > "created": 1730726580,

slim verge
#

Thanks for pointing me in the right direction, I redeployed and did a new invoice flow from scratch and found this:

"baseCreated" is the event.created field and "eventCreated" is the one from event.data.object.created it seems the event.created field is the time when the event was created not the entity in the payload.

I must have picked 2 events that had the same event.created as seen in the screenshot for invoice.updated and invoice.finalized where the update probably triggered both and therefore that is the same created.

I could not find the "Webhooks" menu where you saw the Event Base created field unfortunately. Also my Dashboard changed webhooks to "Event destinations" so the UI might be different now.

#

Knowing that the event.created field determines the time where the event was created, would there be a case where this timestamp shows as later for an event that came before in the process?

frail mesa
#

Nice!

On your follow up question, can you clarify what you mean by 'this timestamp shows as later for an event that came before in the process?'?

slim verge
#

For sure, this is going to be confusing hhaah

The docs say that event ordering is not guaranteed, which is standard, but since I don't know how or when this field gets created I wanted to ask if the event.created field could be wrong for ex:

Scenario 1: TS Gets generated at Send Time

In order of delivery

  • invoice.created event with ts 10 comes in
  • invoice.paid event with ts 20 comes in
  • invoice.finalized event with ts 25 comes in

This case would cause an issue because an invoice needs to be finalized before it can be paid but it can if the event.created at field is based on the delivery order.

Scenario 2: TS Gets generated at event creation and is canonical

In order of delivery

  • invoice.created event with ts 10 comes in
  • invoice.paid event with ts 20 comes in
  • invoice.finalized event with ts 15 comes in

In this case the events did not come in order but I can rely on the event.created data to disregard the invoice.finalized event data as I have already processed a more recent event.

If scenario 2 is what happens, I can recieve the event hours afterwards and not overwrite with stale data.

frail mesa
#

It would be scenario one, https://docs.stripe.com/webhooks#event-ordering. You would need to handle this on your end. The recommendation is that when you see the ordering of event not what you expect, you then make a request via the API to GET the object to confirm. You do not need to make the GET request for every invoices, but only when the ordering is misplaced.

slim verge
#

Thank you, I have a follow up on those docs

Stripe doesn’t guarantee delivery of events in the order in which they’re generated. For example, creating a subscription might generate the following events:

customer.subscription.created
invoice.created
invoice.paid
charge.created (if there’s a charge)

With the wording "in the order in which they’re generated", would the generation be the value in the event.created param?

frail mesa
#

Yes!

slim verge
#

Alright, so I can reliably use the event.created param safely regardless of the order I get the events in

#

Fantastic! Cheers @frail mesa 🚀

frail mesa
#

Happy to help!