docs: explain Bitcoin Connect payment flow lifecycle #24#26
docs: explain Bitcoin Connect payment flow lifecycle #24#26naveendhaterwal wants to merge 1 commit intogetAlby:masterfrom
Conversation
📝 WalkthroughWalkthroughAdded a "Payment Flow Lifecycle" documentation section to Bitcoin Connect explaining the four-stage user flow: Start/Idle, Requesting Invoice, Paying, and Showing Success Screen. Included details on UI transitions, WebLN/NWC/QR code paths, and paid status surfacing behavior. Also added a clarification on sats vs millisats under Units. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@rolznz sir could you please check this |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@references/bitcoin-connect/bitcoin-connect.md`:
- Around line 76-79: Update the documentation text to state that setPaid
requires a SendPaymentResponse object rather than being called without
arguments; specifically, replace the phrase "call setPaid()" with guidance to
call setPaid(...) passing a SendPaymentResponse (e.g., { preimage: "..." }) so
it matches the API signature and aligns with the example and the onPaid /
bc:onpaid event behavior.
🧹 Nitpick comments (1)
references/bitcoin-connect/bitcoin-connect.md (1)
46-80: Consider noting cancel/error paths in the lifecycle.The flow is clear for the happy path; adding a brief note about cancellation or failures (e.g., user closes modal, payment rejected) would round out the mental model without adding much complexity.
| ### 4. Showing Success Screen | ||
| - **Automatic**: For WebLN payments, the modal transitions to the success screen automatically. | ||
| - **Manual**: For QR code payments, the app must poll for payment status and then call `setPaid()` to show the success screen in the modal. | ||
| - **Completion**: The `onPaid` (React) or `bc:onpaid` (Web Components) event fires, providing the `preimage`. |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check if the file exists and read the relevant section
if [ -f "references/bitcoin-connect/bitcoin-connect.md" ]; then
cat -n "references/bitcoin-connect/bitcoin-connect.md" | sed -n '70,85p'
else
find . -name "*bitcoin-connect*" -type f | head -20
fiRepository: getAlby/alby-agent-skill
Length of output: 941
🏁 Script executed:
# Search for all setPaid usage patterns in the repository
rg "setPaid" --context 3 -A 2 -B 2Repository: getAlby/alby-agent-skill
Length of output: 2604
🏁 Script executed:
# Look for TypeScript definitions or type files that might define the API
fd -e "\.d\.ts" -e "\.ts" | xargs rg "setPaid" 2>/dev/null | head -20Repository: getAlby/alby-agent-skill
Length of output: 686
🏁 Script executed:
# Search for SendPaymentResponse definition to understand the required payload
rg "SendPaymentResponse" --context 5Repository: getAlby/alby-agent-skill
Length of output: 14945
🏁 Script executed:
# Check the full API documentation section in bitcoin-connect.md to see all examples
cat -n references/bitcoin-connect/bitcoin-connect.md | sed -n '40,120p'Repository: getAlby/alby-agent-skill
Length of output: 3414
Clarify setPaid() requires a payload to match the API signature.
Line 78 says "call setPaid()," but the API requires passing a SendPaymentResponse object. The example at line 122 correctly shows setPaid({ preimage: "..." }). Update the text to match:
Suggested change
-- **Manual**: For QR code payments, the app must poll for payment status and then call `setPaid()` to show the success screen in the modal.
+- **Manual**: For QR code payments, the app must poll for payment status and then call `setPaid({ preimage })` to show the success screen in the modal.🤖 Prompt for AI Agents
In `@references/bitcoin-connect/bitcoin-connect.md` around lines 76 - 79, Update
the documentation text to state that setPaid requires a SendPaymentResponse
object rather than being called without arguments; specifically, replace the
phrase "call setPaid()" with guidance to call setPaid(...) passing a
SendPaymentResponse (e.g., { preimage: "..." }) so it matches the API signature
and aligns with the example and the onPaid / bc:onpaid event behavior.
Summary
This PR improves the Bitcoin Connect documentation by adding a clear "Payment Flow Lifecycle" section. It explains how UI components transition during the payment process, addressing the gap identified in #24.
Changes
Start → Requesting Invoice → Paying → Success
Goal
Provide developers with a clear mental model of the full payment lifecycle to reduce friction when building e-commerce or donation flows.
Fixes #24
Summary by CodeRabbit