Skip to content

Implement outbound webhooks for merchants with retries - #604

Closed
Ade-Pheebs wants to merge 4 commits into
The-Engineer-Network:mainfrom
Ade-Pheebs:main
Closed

Ade-Pheebs wants to merge 4 commits into
The-Engineer-Network:mainfrom
Ade-Pheebs:main

Conversation

@Ade-Pheebs

Copy link
Copy Markdown
Contributor

Closes #481

Summary

This implementation adds outbound webhook support for merchants, allowing them to:

  • Register webhook endpoints and choose which events they want to be notified about
  • Receive signed webhook deliveries with HMAC signature verification
  • Get retry attempts with exponential backoff on delivery failures
  • Store every delivery attempt for audit and manual replay
  • Deduplicate webhook events to prevent processing the same event twice

Changes

  • Added table for endpoint registration
  • Added table for storing every send attempt
  • Implemented webhook subscription API routes (subscribe, toggle, replay, list)
  • Implemented webhook sending service with HMAC signing and exponential backoff retries
  • Added tests covering success, retries, signature verification, and replay

Issue Reference

Closes #481 Signed outbound webhooks for merchants with retries

Ade-Pheebs and others added 3 commits October 22, 2026 03:21
- Add replica_database_url config option read from REPLICA_DATABASE_URL env var
- Add replica_database field to AppState
- Create DatabaseRouter struct with read_with_fallback and write_with_primary methods
- Update get_balances to use DatabaseRouter for replica-aware reads
- Write operations (transfers, deposits, etc.) always go to primary database

Co-Authored-By: Codebuff <noreply@codebuff.com>
…ion Act (closes The-Engineer-Network#499)

- Add GET /v1/export endpoint producing machine-readable JSON archive of user data
- Add POST /v1/deletion-request endpoint that anonymises personal data while keeping ledger history intact
- Ledger balances remain reconciled after deletion (append-only postings)
- Follows existing codebase patterns for formatting and authentication
- Add merchant_webhook_subscriptions table for endpoint registration and event selection
- Add merchant_webhook_delivery_attempts table for storing every send attempt
- Implement webhook subscription API routes (subscribe, toggle, replay, list)
- Implement webhook sending service with HMAC signing and exponential backoff retries
- Write tests covering success, retries, signature verification, and replay
- Closes The-Engineer-Network#481
@vercel

vercel Bot commented Oct 22, 2026

Copy link
Copy Markdown

@Ade-Pheebs is attempting to deploy a commit to the emmanuel adewunmi's projects Team on Vercel.

A member of the Team first needs to authorize it.

…ngineer-Network#509)

- Update DatabaseRouter::should_use_replica() to accept is_money_operation parameter
- Money-moving paths (balance checks, active holds) always use primary database
- Lag-tolerant endpoints (feeds, statements) can use replica with 5 second lag tolerance
- Added is_money_operation=true to balance and holds queries in routes/balances.rs

This ensures consistency: all money decisions read from primary to prevent stale data
that could lead to double-spending or incorrect balances.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Signed outbound webhooks for merchants with retries

2 participants