Skip to content

Conversation

@arditti
Copy link

@arditti arditti commented Jan 16, 2026

Adds a CloudFront + Lambda@Edge example demonstrating how to add x402 payments to any web server without modifying the backend. This pattern allows payment verification at the edge, working with any HTTP origin (AWS, GCP, Azure, on-prem, or third-party APIs).

Key features:

Zero backend changes required - origin server stays untouched
Route-based payment configuration with glob pattern matching (* and **)
Facilitator integration for payment verification and settlement
Support for Base Sepolia (testnet) and Base Mainnet networks

Files added:

  • README.md: Documentation with architecture diagram and usage guide
  • index.ts: Lambda@Edge handler
  • config.ts: Route configuration and pattern matching
  • payment.ts: Facilitator client for verify/settle
  • responses.ts: x402 response formatting

Tests

This is a reference implementation example. Verified by:

  • TypeScript compilation passes (tsc --noEmit)
  • ESBuild bundling works (npm run build in lambda/ directory)
  • From /typescript directory: pnpm format && pnpm lint

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge)

arditti and others added 2 commits January 14, 2026 16:10
feat(examples): add CloudFront Lambda@Edge server example

Reference implementation for adding x402 payments at the edge without
modifying backend code.

- Add complete Lambda@Edge handler implementation for x402 payment verification
- Include configuration system for route-based pricing and payment settings
- Add payment verification and settlement logic via x402 facilitator
- Include response formatting for 402 Payment Required and success cases
- Include advanced patterns for WAF integration, caching optimization, and cookie-based sessions
@cb-heimdall
Copy link

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@vercel
Copy link

vercel bot commented Jan 16, 2026

@arditti is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions bot added the examples Changes to examples label Jan 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

examples Changes to examples

Development

Successfully merging this pull request may close these issues.

2 participants