Skip to content

Invoices: payer/payee/property to CoinPay, read the nested webhook - #322

Merged
ralyodio merged 1 commit into
masterfrom
feat/coinpay-payer-fields
Oct 21, 2026
Merged

ralyodio merged 1 commit into
masterfrom
feat/coinpay-payer-fields

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Keeps the peer-invoice model (OAuth + payment to the payee's own wallet via merchant_wallet_address). Only adds who pays and who is paid:

  • src/core/coinpay.ts createPayment sends customer_email (payer email), account_id (payer id) and property: agenticjobs.work top-level on /api/payments/create (CoinPay takes them optionally), and the same plus payee_id in metadata.
  • src/core/invoices.ts requestPayment looks up the payer's email and passes payer id + payee id.
  • Bug fix: applyWebhook read event / payment_id flat, so a real CoinPay webhook (nested: {id: evt_..., type, data: {payment_id, status}}) was always ignored; invoices only settled when someone reloaded the page. New readWebhook reads data first, flat as fallback; confirmed/forwarded settle, detected does not.
  • Tests: create-call body (top-level + metadata fields), nested + flat webhook settle via a fake pool. pnpm test: 886 pass; prettier clean.

🤖 Generated with Claude Code

…ested webhook

requestPayment now passes customer_email (payer email), account_id
(payer id) and property agenticjobs.work top-level on
/api/payments/create, and the same plus payee_id in metadata. The
peer-invoice model is unchanged: the payer still pays the payee's own
wallet via merchant_wallet_address.

applyWebhook read event/payment_id flat, so a real nested CoinPay
webhook ({id: evt_..., type, data: {payment_id, status}}) was always
ignored and invoices only settled on the next page load. It now reads
data first with the flat shape as a fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 6e9897d into master Oct 21, 2026
4 checks passed
@ralyodio
ralyodio deleted the feat/coinpay-payer-fields branch October 21, 2026 13:06
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.

1 participant