Skip to content

feat(billing): CoinPay hosted checkout sessions + nested webhook - #194

Merged
ralyodio merged 1 commit into
mainfrom
coinpay-checkout-sessions
Oct 21, 2026
Merged

ralyodio merged 1 commit into
mainfrom
coinpay-checkout-sessions

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Turns checkout on for outreachgraph.com and moves it to CoinPay hosted checkout sessions.

  • packages/payments/src/coinpay.ts: createCheckoutSession, getCheckoutSession, checkoutSessionBody, readWebhookEvent (nested data first, flat fallback; confirmed/forwarded = paid).
  • apps/api/src/billing.ts: session with property outreachgraph.com, account_id = user id, customer_email = user email, metadata {purchase_id, organization_id, workspace_id, user_id, pack_id}. Row keyed by cs_...; webhook matches checkout_session_id then payment_id; credits on confirmed or forwarded, once.
  • UI: chain picker removed (buyer picks coin or PayPal on CoinPay). API accepts but ignores blockchain.
  • Server: client built from COINPAY_API_KEY + COINPAY_WEBHOOK_SECRET (business id optional).
  • Prod: keys provisioned with coinpay-onboard site outreachgraph.com --webhook https://outreachgraph.com/api/v1/coinpay/callback into vault outreachgraph-com--prod; the dev2 deploy now syncs app.env from it.

Tests: billing.test.ts 20 pass (session body, no-email refusal, nested confirmed, confirmed+forwarded once, forwarded alone, expired, unsigned). tsc clean.

🤖 Generated with Claude Code

…forwarded = paid

Credit packs now open a CoinPay checkout session (POST /checkout/sessions)
instead of a single-chain payment: property outreachgraph.com, account_id =
user id, customer_email = user email, org/workspace/pack/purchase ids in
metadata. The buyer picks any coin or PayPal on CoinPay's page, so the chain
picker is gone and the API ignores a sent blockchain. Rows are keyed by the
session id; the webhook reads data first, matches checkout_session_id then
payment_id, and credits on confirmed or forwarded (idempotent on the row key).
The client needs only COINPAY_API_KEY + COINPAY_WEBHOOK_SECRET now.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit 89abd41 into main Oct 21, 2026
4 checks passed
@ralyodio ralyodio mentioned this pull request Oct 21, 2026
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