#selby14-webhooks-subscriptions
1 messages · Page 1 of 1 (latest)
That's a great question. Let me check
I think the best way to do this would be to get the subscription's current_period_start timestamp and compare it to when you received the event.
how is that date field encoded, do you know offhand?
I want to say UNIX timestamp but let me check
To be sure I understand, if the current_period_start is basically the same time as the webhook is received, it would be a renewal?
It's a UNIX timestamp. And yeah, that's my first thought, but let me see if anyone has any better ideas.
I'm looking at 2 events, one a renewal and one a subscription upgrade and it looks like both of the current_period_start timestamps are basically the same as the webhook
Ah, so another way to do this would be to look at the Event object source property which will be either automatic or API. If it was created automatically (e.g. an auto-renewal) then it will be automatic
Does that help?
possibly, but I'm guessing I would have to do an api call to get the event source?
event.source should be in the payload you receive when customer.subscription.update event triggers a webhook to your endpoint