25 Commits

Author SHA1 Message Date
A. McDermott
64f91591c8
Bump minor versions (#739) 2025-12-09 16:54:08 -05:00
phdargen
944eeb17a5
intercept/buffer responses in flask middleware (#693) 2025-12-01 07:46:52 -05:00
A. McDermott
a5dd3d872a
feat: Improved error responses and validation (#665)
* Improve error response on testnet facilitator

* feat: improve error handling and smart wallet support

Add undeployed smart wallet detection, enhance error messages across SDK/facilitator/paywall, restrict site facilitator to base-sepolia and solana-devnet testnets

* Add unit tests

* Use magic bytest constant and add tests

* Update template

* Format

* Update comment

* Don't check for 6492; just check for length of signature

* Update templates

* feat: improve error handling in payment verification

Changes:
- Updated useFacilitator verify() and settle() to parse and return
  detailed error messages from facilitator JSON responses
- Added try-catch around verify() call in Next.js middleware to handle
  thrown errors and return proper 402 JSON responses
- Prevents 500 HTML error pages, now returns clean 402 JSON responses

Future work:
- v2: Preserve semantic HTTP status codes (400 for validation errors,
  402 for payment errors) for better API semantics
2025-11-21 18:37:16 -05:00
Carson Roscoe
0dfd3e683f
chore: version python package (#348) 2025-08-19 10:19:21 -07:00
Mike Coriolan
6ea9e17414
Update middleware.py (#330) 2025-08-15 10:41:15 -04:00
Carson Roscoe
d4c0c276a3
feat: add opt-in/opt-out flag for discovery (#335)
* feat: add opt-in/opt-out flag for discovery

* fix: unit tests
2025-08-14 13:56:29 -04:00
Carson Roscoe
318d174a43
chore: version python package (#329) 2025-08-09 10:10:38 -04:00
Carson Roscoe
c66a6fdf39
feat: typescript and python discovery examples (#325)
* feat: added typescript discovery example

* feat: added python discovery example

* fix: format/lint
2025-08-09 08:50:24 -04:00
Carson Roscoe
9d0e081132
feat: adding default input schema (#317) 2025-08-05 16:50:50 -07:00
Carson Roscoe
9e539014a6
chore: version python package (#312) 2025-07-31 16:12:26 -07:00
Carson Roscoe
1eb160be6f
feat: discovery layer (#294)
* feat: initial typescript proposal

* feat: initial python proposal

* fix: typescript format/lint/unit tests

* chore: reverted example changes

* feat: added and tested list in useFacilitator

* feat: added list to python facilitator

* fix: removed resource from param

* feat: finalize typescript implementation

* feat: finalize typescript implementation

* feat: lint/format

* fix: unit tests

* fix: lock

* fix: pr feedback

* fix: pr feedback

* fix: removed placeholder data in x402.org's GET discovery/resources
2025-07-30 16:36:21 -07:00
Carson Roscoe
69c0401948
chore: bump x402 package version (#290) 2025-07-16 09:06:20 -07:00
Amanda McDermott
765a9a4782
feat: Add & clean up examples for Python (#287)
* Python pricing example WIP

* Update readme

* Update types, format

* Simplify, don't use http exception shape

* Fix bug where python pkg would set empty fields to nil instead of omitting entirely

* Update readmes, appease linter

* Fix bug where we always try to settle w/ the first payment requirement in the list

* Fix network filtering bug-- settle was always using the first one in the list

* Fix same payment requirements list bug in python example

* Add notes about the client network filter

* Add custom payment selector to the other python client as well

* use json5 for md formatting

* Din't need to recreate util

* Create find_matching_payment_requirements util in python

* Update middlewares, tests
2025-07-15 15:37:47 -04:00
Amanda McDermott
0f436a8b03
fix: Rebuild template after core package update (#286)
* Build template after core pkg update

* format

* Update CONTRIBUTING.md
2025-07-14 18:41:44 -04:00
Amanda McDermott
679389022a
feat: Paywall support for Python (flask & fastapi) (#279)
* WIP python paywall

* Add paywall config

* Fix type errors, add flask to project deps

* Pydantic v2.10 doesn't support serialize_by_alias as a config option

* clean up middlewares

* That was unnecessarily complicated

* per pydantic: use  instead of  on Python < 3.12

* Update paywall to full html file, update path

* Allow users to pass in custom HTML as a string for their paywall

* Validate supported networks

* Don't use type in middleware, but do verify

* Minify paywall html during build process

* Add example that uses new python paywall

* Update env to be mainnet in mainnet example

* Add flask and fastapi fullstack examples

* Correct types

* Update paywall html

* Hide balance on paywall

* Format

* ADd proper logging to fastapi middleware

* Escape strings and guard against prototype pollution

* Automatically copy the paywall file over to the python directory

* Update example lockfiles

* Update python tests

* Update paywall template build steps so python matches TS

* Format and lint
2025-07-11 14:42:18 -07:00
Carson Roscoe
f87717093b
depps: in python updated x402's pydantic depp to >=2.10.3 (#280)
* depps: in python updated x402's pydantic depp to >=2.10.3

* fix: lockfiles
2025-07-10 15:34:01 -07:00
Carson Roscoe
b160924304
ix: removed type which was not needed (#278) 2025-07-09 18:09:20 -07:00
Carson Roscoe
220057a591
E2E Regression Tests (#269)
* feat: initial e2e draft

* feat: implemented axios, express and hono

* feat: implemented fetch and next. Fixed a next bug

* feat: added httpx client

* feat: added requests clients

* feat: added fastapi

* feat: added flask

* feat: added gin

* fix: reinstated full tests

* fix: format

* feat: added README

* chore: log cleanup

* feat: improved logging

* feat: fixed express e2e protected-2 tests
2025-07-06 02:36:14 -07:00
Carson Roscoe
094dcd2b95
chore: bump python package version (#263) 2025-06-27 14:51:44 -07:00
Carson Roscoe
008c45730c
feat: initial flask middleware implementation (#257) 2025-06-25 15:28:33 -07:00
Carson Roscoe
8341f1ccee
chore: bump x402 package (#251) 2025-06-19 17:54:20 -07:00
Carson Roscoe
5693bab6da
feat: expanded support from USDC to any eip-3009 asset (#249)
* feat: expanded support from USDC to any eip-3009 asset

* fix: unit tests
2025-06-19 11:47:28 -07:00
Carson Roscoe
67b35da940
chore: downgraded required python version to >=3.10 (#248) 2025-06-19 09:33:17 -07:00
Carson Roscoe
9288c8d3b0
feat: python x402 mainnet (#247)
* feat: added facilitator config

* initial

* working towards downgrading pydantic

* fix: first mainnet call

* feat: updated cdp-sdk version in example to prod
2025-06-18 16:00:49 -07:00
erikreppel-cb
830976be46
[Draft] Add python support (#215)
* Start types

* Increase tests and fix type issues

* feat: completed fastapi draft and added example (#229)

* feat: fixed fastapi and added example

* chore: tweak README

* feat: python clients (#226)

* feat: httpx client and example

* fix: cleanup httpx example

* feat: added requests example

* feat: unit testing clients & helpers

* chore: format/lint

* chore: correct READMEs of examples

* fix: removed debug logs

* fix: removed artifact code from testing

* chore: removed excess comments

* feat: refactored from web3 to eth_account as accounts

* feat: refactored interfaces per pr feedback

* fix: pr feedback

* chore: rebase & merge

* chore: renamed x402 request exports

* fix: pr feedback

* feat: release GHA and improved readme (#232)

* feat: release GHA and improved readme

* chore: bump to v0.1.1

* chore: renamed PyPi token

---------

Co-authored-by: Carson Roscoe <CarsonRoscoe7@gmail.com>
2025-06-13 15:42:26 -07:00