Repository navigation
Cookbook PDF: CoinPay hosted checkout sessions - #137
Merged
Merged
Conversation
/book/buy offered a hardcoded list of 15 chains and opened /api/payments/create with no return URL and no buyer, so a buyer was left on CoinPay's page and the download link only ever appeared in the webhook response. It now asks for a receipt email and opens POST /api/checkout/sessions (customer_email, account_id = the email, since the site has no accounts, property hqtui.com, metadata product/reference), stores the cs_ id as the purchase key and redirects to the hosted page: any coin the business holds a wallet for, or PayPal. CoinPay returns the buyer to /book/thanks?session=cs_..., which shows the download link once the purchase is paid, asks CoinPay with the business key when the buyer is back before the webhook, and otherwise refreshes itself. The webhook settles by checkout_session_id, then payment_id for purchases opened before sessions; confirmed and forwarded both settle and markPaid stays idempotent. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
/book/buy: the 15-chain picker is replaced by a receipt email field; checkout opensPOST /api/checkout/sessionswithcustomer_email,account_id(the email: guests, no accounts),property: hqtui.com, metadata{property, product, reference, email}, success/book/thanks?session={CHECKOUT_SESSION_ID}, cancel/book/buy?cancelled=1. The cs_ id is the purchase key inbook_purchases; the buyer is redirected to the hosted page (any wallet coin or PayPal)./book/thanks: shows the 48h download link once paid. If the buyer is back before the webhook it asks CoinPay (GET /api/checkout/sessions/:idwith the business key); otherwise it refreshes every 10 s. Before this the link only existed in the webhook response, so a buyer never got it.checkout_session_id, falling back topayment_idfor purchases opened before sessions (one old pending row from 2026-09). confirmed and forwarded settle;markPaidstays idempotent.Checks
bun test packages/hqtui/test apps/demo/test apps/web/test,node --testfor the web tests,bun run build+bun run --cwd apps/web buildgreen locally.🤖 Generated with Claude Code