-
Notifications
You must be signed in to change notification settings - Fork 635
[X402] Update payment data retrieval example in server documentation #8537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[X402] Update payment data retrieval example in server documentation #8537
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
4 Skipped Deployments
|
|
WalkthroughCode examples in the server-side documentation are updated to retrieve paymentData from request headers using Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
Comment |
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8537 +/- ##
=======================================
Coverage 54.66% 54.66%
=======================================
Files 921 921
Lines 61163 61163
Branches 4151 4151
=======================================
Hits 33434 33434
Misses 27627 27627
Partials 102 102
🚀 New features to boost your workflow:
|
d2d0060 to
ddde5b1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
apps/portal/src/app/x402/server/page.mdx (1)
90-91: Consider clarifying when the storage fallback pattern should be used.The section introduction could briefly mention that the storage fallback pattern (lines 138–139) is useful when reusing payment authorization across multiple requests within a session. This would help users understand which example pattern to apply in their use case.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/portal/src/app/x402/server/page.mdx(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Size
- GitHub Check: Analyze (javascript)
🔇 Additional comments (5)
apps/portal/src/app/x402/server/page.mdx (5)
54-69: Good pattern for direct header-based payment data retrieval.The Exact Payment Scheme example correctly retrieves payment data directly from request headers, which aligns with the PR objective to prioritize header sources.
92-103: Upto Payment Scheme example correctly uses header retrieval.The payment arguments object properly retrieves
paymentDatafrom the request headers, maintaining consistency with the Exact Scheme pattern.
135-159: Fallback pattern is well-demonstrated.The commented example on lines 138–139 clearly shows the intended behavior: retrieve from storage first, then fall back to request headers. This properly demonstrates the PR's enhancement goal and provides a realistic pattern for scenarios where payment data may be cached or persisted.
221-376: Dedicated endpoint examples use framework-idiomatic header access consistently.All three frameworks (Next.js, Express, Hono) correctly access the
x-paymentheader using their respective APIs, and all examples properly extract payment data from request headers before passing to settlement functions.
378-560: Middleware examples maintain consistent header retrieval pattern.All three middleware implementations (Next.js, Express, Hono) correctly retrieve payment data from headers, providing solid examples for users protecting multiple endpoints with shared payment verification logic.
size-limit report 📦
|

PR-Codex overview
This PR focuses on updating how
paymentDatais retrieved in the payment processing flow, ensuring it can be sourced from request headers when necessary.Detailed summary
paymentDatato retrieve it fromrequest.headers.get("x-payment")instead of using a direct variable.paymentDatato prioritize request headers if stored data is unavailable.Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.