Race conditions
Webhooks are sent chronologically by Treezor, but Treezor cannot guarantee that your servers will receive them in the same order.
In some situations, you could receive a payin.update
before the associated payin.create
for instance.
Therefore, your code must not rely on the order in which webhooks are received.
Identifying the latest webhook
To identify which of two or more webhooks were sent last, you must compare their webhook_created_at
attribute with your locally stored values. Most webhook-contained objects also have a createdDate
and modifiedDate
attribute. You may also use these when they exist.
This is of critical importance for CardTransactions as they go through many steps and only the latest is authoritative. Failure to do so implies displaying outdated and erroneous information to the user.