Skip to content

CoinPay hosted checkout sessions: any coin or PayPal - #229

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

ralyodio merged 1 commit into
mainfrom
feat/coinpay-checkout-sessions

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

Moves every NicheDB checkout (Premium terms, Pro on /pro and via OpenSaaS /api/v1/billing/subscribe, Data dumps) onto CoinPay hosted checkout sessions.

  • packages/payments/src/index.js is now the shared v2 file (byte-identical with genrewatch/tipoffwatch/bg0ne/typeheard/pwamart/wx93/tleehealth/watchnews), replacing the older 143-line SDK fork. createCheckout posts /api/checkout/sessions with customer_email, account_id, property (nichedb.dev) and our metadata. The buyer picks any coin the business has a wallet for, or PayPal.
  • Pending rows are keyed by the cs_ session id; settlement matches session id or payment id, so old in-flight payments still settle. forwarded now counts as paid (CoinPay retries a failed forwarded for a day, a failed confirmed only ~12 min). An unknown payment answers 200 instead of throwing.
  • Webhook: recordReferral only runs when grantMembership actually inserted a term (it is idempotent on payment_id), so confirmed + forwarded cannot count a referral twice.
  • All four call sites pass email + accountId, drop blockchain (COINPAY_BLOCKCHAIN is now unused), and get success/cancel URLs (/premium, /pro, /dumps).
  • Copy: "any major coin or PayPal" on /premium, /pro, /dumps and llms.txt. The x402 crawl pass (USDC) is unchanged.
  • Tests: new test/payments-checkout-sessions.test.js; premium/data route tests assert email, account, no chain, success URL. Full suite 2539 pass, 0 fail.

CoinPay business 2ccb4a79 has 15 wallets; PayPal connected today (house app, self-serve).

🤖 Generated with Claude Code

Replaces the older SDK-based payments fork with the shared v2 file:
createCheckout opens POST /api/checkout/sessions with customer_email,
account_id and property (nichedb.dev). Premium, Pro (web + OpenSaaS) and
Data checkouts pass the buyer's email and id, no longer pin BTC, and get
success/cancel URLs back to their page. The webhook settles by session or
payment id (old in-flight payments still settle), counts forwarded as
paid, and a referral is only recorded on a fresh membership grant so a
confirmed+forwarded pair cannot count it twice.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ralyodio
ralyodio merged commit b3b7d22 into main Oct 21, 2026
3 checks passed
@ralyodio
ralyodio deleted the feat/coinpay-checkout-sessions branch October 21, 2026 13:35
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