# Take webhooks, and backfill what the stream missed

[Choose a reporting strategy](https://devportal-simpay-sbx.winkpg.io/docs/decide/reporting-strategy.md): Whether to ask this platform for payment data on a schedule, or to have it sent to you as it happens, and what each one costs you to run.

Webhooks keep the system of record current, and a backfill sweep keeps it complete.

**Your answers so far**

- What does your reporting need from each payment? Every payment on its own, with its own detail.
- How soon after a payment do you need it? Within seconds of the payment.
- Where do these payments end up on your side? In a reporting system of ours that has to hold every payment.

**What to build**

Subscribe to the transaction events and write each one into your system of record as it arrives, then run a periodic query for the window you have already covered and insert anything missing. Check the delivery log when a gap shows up, because it says whether the delivery was never attempted or was attempted and refused, and those have different fixes on your side.

**Worth knowing**

- Delivery is at least once. Record the event id you have already handled and ignore a repeat, because a retry after a slow acknowledgement is an ordinary event rather than a fault.
- Acknowledge within five seconds. Put the raw body on a queue and process it after you have answered, because slow handling is retried and a retry is a duplicate you then have to discard.
- Store the event id alongside the payment. It's what lets you tell a redelivery from a second payment, and what the delivery log is searchable by when you are reconciling one.
- Verify the signature before you trust the body. A system of record is exactly the thing worth writing a forged event into.

**Where to go next**

- [Webhook integration](https://devportal-simpay-sbx.winkpg.io/docs/guides/webhook-integration.md)
- [Blueprint: receive and verify webhooks](https://devportal-simpay-sbx.winkpg.io/docs/blueprints/receive-and-verify-webhooks.md)
- [Webhook delivery log](https://devportal-simpay-sbx.winkpg.io/docs/api/notificationsGetWebhookEvents.md)
- [List transactions, for the backfill sweep](https://devportal-simpay-sbx.winkpg.io/docs/api/transactionsGetList.md)

- [Start over](https://devportal-simpay-sbx.winkpg.io/docs/decide/reporting-strategy.md): go back to the first question.

## See also

- [All documentation](https://devportal-simpay-sbx.winkpg.io/llms.txt): the machine-readable index of every public page on this site.
