invoice_payment_completed: from owned boundary to trusted query
Treat invoice_payment_completed as a durable analytical contract: the owner emits one documented grain, a fixture proves the fields, and a reviewed query answers the stated question.
- 1
Outcome becomes final
Billing webhook handler after idempotent processing emits only after the provider event is verified and persisted.
- 2
Contract is bounded
8 required fields preserve the declared grain: One terminal payment attempt.
- 3
Fixture is verified
Check types, UTC time, alternate outcomes, idempotency, and every pseudonymous or review-classified field.
- 4
Question is answered
Which billed amounts succeed, fail, or recover?
Grain
One terminal payment attempt.
Owner
Billing webhook handler after idempotent processing
Emit when
After the provider event is verified and persisted.
Field contract
Typed fields with explicit privacy boundaries
Keep existing field names and types stable after production queries depend on them. Optional context should remain bounded, documented, and justified by a specific decision.
| Field | Type | Required | Privacy | Meaning |
|---|---|---|---|---|
| timestamp_utc | timestamp | yes | non-sensitive | UTC time at the outcome boundary. |
| event_id | string | yes | non-sensitive | Stable unique identifier used for deduplication. |
| release | string | yes | non-sensitive | Application or service version that emitted the event. |
| account_id | string | yes | pseudonymous | Stable internal account identifier, never an email or name. |
| invoice_id | string | yes | pseudonymous | Internal or hashed provider invoice identifier. |
| amount_usd | number | yes | non-sensitive | Normalized amount with currency rules documented. |
| attempt_count | number | yes | non-sensitive | Payment attempt sequence number. |
| status | string | yes | non-sensitive | Paid, failed, or recovered outcome. |
| failure_category | string | no | review | Coarse provider-safe category, never card or bank details. |
Synthetic JSON event
{
"timestamp_utc": "2026-07-28T14:24:51Z",
"event_id": "evt_payment_01",
"account_id": "acct_8f31",
"release": "2026.07.2",
"invoice_id": "invoice_67ad",
"amount_usd": 2400,
"attempt_count": 1,
"status": "paid"
}Privacy review
Review identifiers before ingestion
This example uses synthetic identifiers. Pseudonymous values can still be personal data, and review fields can expose business or provider context. Apply your own consent, retention, access, residency, and deletion requirements.
account_id: pseudonymousinvoice_id: pseudonymousfailure_category: review
Validation checklist
Prove the contract before building a dashboard
- Send one known invoice_payment_completed fixture after the documented outcome boundary.
- Verify all 8 required fields arrive with the documented types.
- Retry the same event identifier and confirm the chosen deduplication behavior.
- Send a controlled failure or alternate outcome when the workflow supports one.
- Run the related SQL over a fixed window and reconcile the result to the fixture.
Common mistakes
Keep one row equal to one durable outcome
- Emitting invoice_payment_completed before billing webhook handler after idempotent processing knows the final outcome.
- Mixing several grains in one table, which makes counts and rates ambiguous.
- Replacing controlled categories with raw URLs, payloads, prompts, or error text.
- Changing a field type in place after saved queries and dashboards depend on it.
- Adding identifiers without a documented investigation, access, and retention need.
Use the contract
Query and operationalize the event
Related contracts
Send a fixture before production traffic
Create a free API key, send the synthetic event, and inspect the inferred table before connecting a live workflow.