|
| 1 | +<section id="session-flow"> |
| 2 | + <h2>Session Flow</h2> |
| 3 | + <p> |
| 4 | + This section describes the payment session flow that occurs when a user visits a [=web monetized website=]. |
| 5 | + The session flow involves establishing a payment session, managing ongoing payments, and handling session lifecycle events. |
| 6 | + </p> |
| 7 | + |
| 8 | + <h3>Session Flow Overview</h3> |
| 9 | + <p> |
| 10 | + When a user navigates to a web monetized website, the browser initiates a payment session flow that includes: |
| 11 | + </p> |
| 12 | + <ul> |
| 13 | + <li>Discovery of payment endpoints.</li> |
| 14 | + <li>Session establishment.</li> |
| 15 | + <li>Payment streaming.</li> |
| 16 | + <li>Session management and cleanup.</li> |
| 17 | + </ul> |
| 18 | + |
| 19 | + <h3>Session Initiation</h3> |
| 20 | + <p> |
| 21 | + The payment session begins when the browser detects a monetization link element on a webpage. |
| 22 | + The browser must validate the [=wallet address=] and establish a connection with the configured wallet. |
| 23 | + </p> |
| 24 | + |
| 25 | + <p>To initiate a payment session, given a <var>walletAddress</var>:</p> |
| 26 | + <ol> |
| 27 | + <li>Validate the [=wallet address=] format.</li> |
| 28 | + <li>Check if a wallet is configured and available.</li> |
| 29 | + <li>Establish a payment session with the wallet.</li> |
| 30 | + <li>Begin payment streaming to the [=wallet address=].</li> |
| 31 | + </ol> |
| 32 | + |
| 33 | + <h3>Payment Streaming</h3> |
| 34 | + <p> |
| 35 | + Once a session is established, the browser manages the ongoing payment stream according to the configured budget and rate limits. |
| 36 | + </p> |
| 37 | + |
| 38 | + <h3>Session Lifecycle Management</h3> |
| 39 | + <p> |
| 40 | + The browser must handle various session lifecycle events including: |
| 41 | + </p> |
| 42 | + <ul> |
| 43 | + <li>Session pause and resume.</li> |
| 44 | + <li>Tab focus changes.</li> |
| 45 | + <li>Page navigation.</li> |
| 46 | + <li>Wallet disconnection.</li> |
| 47 | + <li>Budget exhaustion.</li> |
| 48 | + </ul> |
| 49 | + |
| 50 | + <h3>Error Handling</h3> |
| 51 | + <p> |
| 52 | + The session flow must gracefully handle various error conditions and provide appropriate feedback to both the website and the user. |
| 53 | + </p> |
| 54 | +</section> |
0 commit comments