agentscore-commerce 2.2.0__tar.gz → 2.4.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/.github/workflows/ci.yml +3 -0
  2. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/CLAUDE.md +10 -9
  3. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/PKG-INFO +44 -58
  4. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/README.md +41 -55
  5. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/SECURITY.md +2 -2
  6. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/__init__.py +4 -2
  7. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/_headers.py +1 -2
  8. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/_mppx_receipt.py +5 -5
  9. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/_redis.py +5 -6
  10. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/_warnings.py +1 -1
  11. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/accepted_methods.py +1 -1
  12. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/body.py +5 -2
  13. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/how_to_pay.py +1 -1
  14. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/checkout.py +11 -4
  15. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/checkout_compute_first.py +3 -5
  16. agentscore_commerce-2.4.0/agentscore_commerce/discovery/llms_txt.py +238 -0
  17. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/probe.py +6 -6
  18. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/robots_tag.py +1 -2
  19. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/_response.py +7 -4
  20. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/address.py +1 -1
  21. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/default_denied.py +1 -4
  22. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/fastapi.py +0 -3
  23. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/sessions.py +1 -1
  24. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/types.py +4 -5
  25. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/ucp_jwks.py +28 -37
  26. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/middleware/fastapi.py +2 -2
  27. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/middleware/flask.py +16 -12
  28. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/__init__.py +2 -0
  29. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/amounts.py +4 -5
  30. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/compose_rails.py +0 -2
  31. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/default_rails.py +0 -2
  32. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/directive.py +3 -2
  33. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/mppx_failures.py +0 -2
  34. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/network_kind.py +0 -2
  35. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/payment_header.py +3 -5
  36. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/rail_spec.py +23 -0
  37. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/signer.py +4 -5
  38. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/wwwauthenticate.py +16 -10
  39. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/x402_settle.py +3 -3
  40. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/quote_cache.py +2 -3
  41. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/stripe_multichain/__init__.py +4 -0
  42. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/stripe_multichain/mppx_stripe.py +5 -5
  43. agentscore_commerce-2.4.0/agentscore_commerce/stripe_multichain/pay_to_address.py +278 -0
  44. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/stripe_multichain/simulate_dispatch.py +3 -9
  45. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/README.md +3 -3
  46. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/compliance_merchant.py +2 -1
  47. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/multi_rail_merchant.py +31 -16
  48. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/stripe_multichain_merchant.py +8 -2
  49. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/lefthook.yml +2 -0
  50. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/pyproject.toml +8 -4
  51. agentscore_commerce-2.4.0/tests/__init__.py +0 -0
  52. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_aiohttp.py +156 -0
  53. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_challenge.py +21 -3
  54. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_checkout_coverage_gaps.py +79 -0
  55. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_compose_rails.py +29 -0
  56. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_coverage_fillers.py +1 -1
  57. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_discovery.py +10 -10
  58. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_django.py +177 -0
  59. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_fastapi.py +182 -0
  60. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_flask.py +135 -0
  61. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_middleware.py +176 -0
  62. agentscore_commerce-2.4.0/tests/test_pay_to_address.py +444 -0
  63. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_payment_dispatch.py +27 -0
  64. agentscore_commerce-2.4.0/tests/test_payment_header.py +147 -0
  65. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_payment_misc.py +35 -8
  66. agentscore_commerce-2.4.0/tests/test_payment_servers.py +735 -0
  67. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_quote_cache.py +14 -0
  68. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_rate_limit.py +160 -0
  69. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_response.py +13 -0
  70. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_sanic.py +149 -0
  71. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_seamless_helpers.py +8 -0
  72. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_sessions.py +50 -0
  73. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_signer_match.py +33 -0
  74. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_simulate_dispatch.py +31 -0
  75. agentscore_commerce-2.4.0/tests/test_solana.py +110 -0
  76. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_stripe_multichain.py +42 -6
  77. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_ucp_jwks.py +6 -6
  78. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_zero_settle.py +8 -0
  79. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/uv.lock +134 -114
  80. agentscore_commerce-2.2.0/agentscore_commerce/discovery/llms_txt.py +0 -291
  81. agentscore_commerce-2.2.0/agentscore_commerce/stripe_multichain/pay_to_address.py +0 -127
  82. agentscore_commerce-2.2.0/tests/test_pay_to_address.py +0 -198
  83. agentscore_commerce-2.2.0/tests/test_payment_header.py +0 -74
  84. agentscore_commerce-2.2.0/tests/test_payment_servers.py +0 -363
  85. agentscore_commerce-2.2.0/tests/test_solana.py +0 -36
  86. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  87. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  88. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  89. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/.github/dependabot.yml +0 -0
  90. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/.github/workflows/publish.yml +0 -0
  91. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/.github/workflows/security.yml +0 -0
  92. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/.gitignore +0 -0
  93. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/CODE_OF_CONDUCT.md +0 -0
  94. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/CONTRIBUTING.md +0 -0
  95. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/LICENSE +0 -0
  96. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/api/__init__.py +0 -0
  97. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/__init__.py +0 -0
  98. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/agent_instructions.py +0 -0
  99. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/agent_memory.py +0 -0
  100. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/identity.py +0 -0
  101. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/pricing.py +0 -0
  102. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/receipt.py +0 -0
  103. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/respond_402.py +0 -0
  104. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/challenge/validation_error.py +0 -0
  105. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/checkout_hooks.py +0 -0
  106. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/__init__.py +0 -0
  107. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/agentscore_content.py +0 -0
  108. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/bazaar.py +0 -0
  109. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/openapi.py +0 -0
  110. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/redemption_md.py +0 -0
  111. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/skill_md.py +0 -0
  112. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/well_known.py +0 -0
  113. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/well_known_mpp.py +0 -0
  114. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/discovery/well_known_x402.py +0 -0
  115. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/errors.py +0 -0
  116. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/__init__.py +0 -0
  117. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/_denial.py +0 -0
  118. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/a2a.py +0 -0
  119. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/aiohttp.py +0 -0
  120. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/cache.py +0 -0
  121. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/core.py +0 -0
  122. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/django.py +0 -0
  123. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/flask.py +0 -0
  124. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/middleware.py +0 -0
  125. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/policy.py +0 -0
  126. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/py.typed +0 -0
  127. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/sanic.py +0 -0
  128. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/signer.py +0 -0
  129. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/tokens.py +0 -0
  130. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/identity/ucp.py +0 -0
  131. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/middleware/__init__.py +0 -0
  132. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/middleware/_core.py +0 -0
  133. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/middleware/aiohttp.py +0 -0
  134. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/middleware/asgi.py +0 -0
  135. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/middleware/django.py +0 -0
  136. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/middleware/sanic.py +0 -0
  137. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/constants.py +0 -0
  138. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/dispatch.py +0 -0
  139. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/headers.py +0 -0
  140. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/idempotency.py +0 -0
  141. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/lazy.py +0 -0
  142. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/mppx_server.py +0 -0
  143. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/networks.py +0 -0
  144. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/rails.py +0 -0
  145. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/settlement_override.py +0 -0
  146. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/solana.py +0 -0
  147. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/usdc.py +0 -0
  148. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/x402.py +0 -0
  149. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/x402_server.py +0 -0
  150. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/x402_validation.py +0 -0
  151. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/payment/zero_settle.py +0 -0
  152. /agentscore_commerce-2.2.0/tests/__init__.py → /agentscore_commerce-2.4.0/agentscore_commerce/py.typed +0 -0
  153. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/stripe_multichain/payment_intent.py +0 -0
  154. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/stripe_multichain/pi_cache.py +0 -0
  155. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/agentscore_commerce/stripe_multichain/simulate_deposit.py +0 -0
  156. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/api_provider.py +0 -0
  157. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/compute_first_merchant.py +0 -0
  158. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/identity_only.py +0 -0
  159. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/per_product_policy_merchant.py +0 -0
  160. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/examples/signed_ucp_merchant.py +0 -0
  161. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/osv-scanner.toml +0 -0
  162. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/ruff.toml +0 -0
  163. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/scripts/regenerate_cross_lang_fixtures.py +0 -0
  164. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/conftest.py +0 -0
  165. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-agentscore-gate-blocked.json +0 -0
  166. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-agentscore-gate-full.json +0 -0
  167. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-capability.json +0 -0
  168. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-emoji-keys.json +0 -0
  169. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-es256-rails.json +0 -0
  170. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-extras-int.json +0 -0
  171. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-int-boundary.json +0 -0
  172. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-minimal.json +0 -0
  173. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-multikey.json +0 -0
  174. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/node-unicode.json +0 -0
  175. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-agentscore-gate-blocked.json +0 -0
  176. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-agentscore-gate-full.json +0 -0
  177. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-capability.json +0 -0
  178. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-emoji-keys.json +0 -0
  179. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-es256-rails.json +0 -0
  180. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-extras-int.json +0 -0
  181. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-int-boundary.json +0 -0
  182. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-minimal.json +0 -0
  183. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-multikey.json +0 -0
  184. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/fixtures/cross-lang/py-unicode.json +0 -0
  185. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_a2a.py +0 -0
  186. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_a2a_jws_roundtrip.py +0 -0
  187. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_address.py +0 -0
  188. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_agent_memory_emitter.py +0 -0
  189. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_amounts.py +0 -0
  190. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_api_reexport.py +0 -0
  191. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_cache.py +0 -0
  192. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_checkout.py +0 -0
  193. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_checkout_compute_first.py +0 -0
  194. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_checkout_compute_first_adapters.py +0 -0
  195. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_checkout_compute_first_ofac.py +0 -0
  196. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_checkout_compute_first_settle.py +0 -0
  197. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_checkout_wallet_ofac_default.py +0 -0
  198. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_classify_orchestration_error.py +0 -0
  199. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_core.py +0 -0
  200. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_default_denied.py +0 -0
  201. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_default_rails.py +0 -0
  202. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_default_read_only_on_denied.py +0 -0
  203. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_denial.py +0 -0
  204. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_dispatch.py +0 -0
  205. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_extract_owner_scope.py +0 -0
  206. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_gate_quota_info.py +0 -0
  207. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_get_signer_verdict.py +0 -0
  208. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_idempotency_helper.py +0 -0
  209. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_integration.py +0 -0
  210. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_internal_helpers.py +0 -0
  211. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_lifted_helpers.py +0 -0
  212. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_load_ucp_signing_key_from_env.py +0 -0
  213. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_mppx_failures.py +0 -0
  214. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_mppx_receipt.py +0 -0
  215. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_network_kind.py +0 -0
  216. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_payment_directive.py +0 -0
  217. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_payment_handlers.py +0 -0
  218. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_payment_headers.py +0 -0
  219. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_payment_signer.py +0 -0
  220. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_policy.py +0 -0
  221. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_pricing.py +0 -0
  222. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_public_surface.py +0 -0
  223. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_quote_cache_redis.py +0 -0
  224. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_rail_spec.py +0 -0
  225. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_redis_internal.py +0 -0
  226. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_robots_tag.py +0 -0
  227. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_skill_md.py +0 -0
  228. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_solana_mpp_rail_spec_post_init.py +0 -0
  229. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_tokens.py +0 -0
  230. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_ucp.py +0 -0
  231. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_ucp_cross_lang.py +0 -0
  232. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_validation_error.py +0 -0
  233. {agentscore_commerce-2.2.0 → agentscore_commerce-2.4.0}/tests/test_x402_settle_extra.py +0 -0
@@ -46,6 +46,9 @@ jobs:
46
46
  - name: Type check (ty)
47
47
  run: uv run ty check agentscore_commerce/
48
48
 
49
+ - name: Type check examples (ty)
50
+ run: uv run ty check -c 'src.include=["examples"]'
51
+
49
52
  - name: Vulture
50
53
  run: uv run vulture agentscore_commerce/ --min-confidence 80
51
54
 
@@ -8,13 +8,13 @@ Every helper is extracted from a real consumer, not speculated.
8
8
 
9
9
  | Submodule | What it is |
10
10
  |---|---|
11
- | `agentscore_commerce` (top-level) | `Checkout` orchestrator (the 2.0 high-level surface): one config object + hooks (pre_validate, compute_pricing, mint_recipients, compose_mppx, on_settled, gate), auto-derived x402+pympp servers, per-framework adapters `handle_fastapi`/`handle_flask`/`handle_django`/`handle_aiohttp`/`handle_sanic`, signed UCP routes via `mount_ucp_routes_{fastapi,flask,django,aiohttp,sanic}`, optional `discovery_probe` config for x402-crawler auto-routing. Plus `compute_first_checkout` — variable-cost pay-per-result helper (compute-first + exact-x402). Scope is exact-mode rails only (x402-exact Base, tempo/charge, solana/charge, Stripe SPT); does NOT use x402-upto (Permit2) or Settlement-Overrides — variable cost is captured by running the work pre-settle and emitting a 402 at the exact computed price. `create_quote_cache` — content-hash quote cache used by the compute-first helper (in-memory by default; pass `redis_url` for distributed deployments). `create_default_on_denied` — canonical `on_denied(reason)` factory matching `Checkout`'s gate hook (handles `wallet_signer_mismatch`, `wallet_not_trusted` unfixable fallback, `payment_required`, `token_expired`/`invalid_credential`/`api_error`); merchants pass `merchant_name` + `support_email` and override `wallet_not_trusted_message` / `payment_required_message` / `support_context` for vendor-specific copy. `has_payment_header` — discriminator that splits discovery legs (no payment credential → 402) from settle legs (`payment-signature` / `x-payment` / `Authorization: Payment <jwt>`); `has_x402_header` / `has_mppx_header` — granular dispatch helpers (x402 vs MPP credential present) for routes that branch on rail. `default_read_only_on_denied(reason)` — canonical `on_denied` for read-only resource gates (`GET /orders/:id`): collapses every denial to 401 `unauthorized` + `Cache-Control: no-store` while still spreading `denial_reason_to_body` so `agent_instructions` / `verify_url` ride through. Returns a `DefaultOnDeniedResult(body, status, headers)` dataclass; FastAPI / Flask / aiohttp / Sanic `on_denied` callbacks accept an optional 3-tuple `(body, status, headers)` — convert with `lambda req, reason: (r := default_read_only_on_denied(reason), (r.body, r.status, r.headers or {}))[1]` or a named wrapper. Django + ASGI middleware adapters return Response objects directly; construct `JsonResponse(r.body, status=r.status, headers=r.headers)` / `JSONResponse(content=r.body, status_code=r.status, headers=r.headers)`. `extract_owner_scope(headers) -> OwnerScope` — pull canonical owner identity from `X-Wallet-Address` / `X-Operator-Token` with safe token hashing; pair with a wallet-or-token-scoped resource query so plaintext tokens never leave the request. Plus factories: `pricing_result` (cents → typed `PricingResult`), `validation_response_{fastapi,flask,django,aiohttp,sanic}` (4xx envelope per framework), `Receipt`/`ReceiptNextSteps`/`ProductInfo`/`ShippingAddress` (canonical 200-receipt dataclasses, universal across goods + API merchants) |
12
- | `agentscore_commerce.identity.{fastapi,flask,django,aiohttp,sanic,middleware}` | Trust gate middleware (KYC, age, sanctions on both account name and signer wallet, jurisdiction). Each adapter exports a conditional variant that wraps the gate so it fires only on settle legs (anonymous discovery flows through and gets a 402 with all rails): FastAPI / ASGI expose `ConditionalAgentScoreGate`, Django exposes `ConditionalAgentScoreMiddleware`, Flask + Sanic expose `conditional_agentscore_gate(app, ...)`, aiohttp exposes `conditional_agentscore_gate_middleware(...)`. Adapters export ONLY framework-specific surface (gate classes / fns, accessors, `capture_wallet`); shared helpers like `has_payment_header` / `denial_reason_to_body` import from their canonical home (`agentscore_commerce.payment` and `agentscore_commerce.identity` respectively). The existing `agentscore_gate(app, ...)` and `AgentScoreGate` accept an optional `condition=` callable for inline gating. |
11
+ | `agentscore_commerce` (top-level) | `Checkout` orchestrator (the 2.0 high-level surface): one config object + hooks (pre_validate, compute_pricing, mint_recipients, compose_mppx, on_settled, gate), auto-derived x402+pympp servers, per-framework adapters `handle_fastapi`/`handle_flask`/`handle_django`/`handle_aiohttp`/`handle_sanic`, signed UCP routes via `mount_ucp_routes_{fastapi,flask,django,aiohttp,sanic}`, optional `discovery_probe` config for x402-crawler auto-routing. Plus `compute_first_checkout` — variable-cost pay-per-result helper (compute-first + exact-x402). Scope is exact-mode rails only (x402-exact Base, tempo/charge, solana/charge, Stripe SPT); does NOT use x402-upto (Permit2) or Settlement-Overrides — variable cost is captured by running the work pre-settle and emitting a 402 at the exact computed price. `create_quote_cache` — content-hash quote cache used by the compute-first helper (in-memory by default; pass `redis_url` for distributed deployments). `create_default_on_denied` — canonical `on_denied(reason)` factory matching `Checkout`'s gate hook (handles `wallet_signer_mismatch`, `wallet_not_trusted` unfixable fallback, `payment_required`, `token_expired`/`invalid_credential`/`api_error`); merchants pass `merchant_name` + `support_email` and override `wallet_not_trusted_message` / `payment_required_message` / `support_context` for vendor-specific copy. `has_payment_header` — discriminator that splits discovery legs (no payment credential → 402) from settle legs (`payment-signature` / `x-payment` / `Authorization: Payment <jwt>`); `has_x402_header` / `has_mppx_header` — granular dispatch helpers (x402 vs MPP credential present) for routes that branch on rail. `default_read_only_on_denied(reason)` — canonical `on_denied` for read-only resource gates (`GET /orders/:id`): collapses every denial to 401 `unauthorized` + `Cache-Control: no-store` while still spreading `denial_reason_to_body` so `agent_instructions` / `verify_url` ride through. Returns a `DefaultOnDeniedResult(body, status, headers)` dataclass; FastAPI / Flask / aiohttp / Sanic `on_denied` callbacks accept an optional 3-tuple `(body, status, headers)` — convert with `lambda req, reason: (r := default_read_only_on_denied(reason), (r.body, r.status, r.headers or {}))[1]` or a named wrapper. Django + ASGI middleware adapters return Response objects directly; construct `JsonResponse(r.body, status=r.status, headers=r.headers)` / `JSONResponse(content=r.body, status_code=r.status, headers=r.headers)`. `extract_owner_scope(headers) -> OwnerScope` — pull canonical owner identity from `X-Wallet-Address` / `X-Operator-Token` with safe token hashing; pair with a wallet-or-token-scoped resource query so plaintext tokens never leave the request. Plus factories: `pricing_result` (cents → typed `PricingResult`), `validation_response_{fastapi,flask,django,aiohttp,sanic}` (4xx envelope per framework) |
12
+ | `agentscore_commerce.identity.{fastapi,flask,django,aiohttp,sanic,middleware}` | Trust gate middleware (KYC, age, sanctions on both account name and signer wallet, jurisdiction). Each adapter exports a conditional variant that wraps the gate so it fires only on settle legs (anonymous discovery flows through and gets a 402 with all rails): FastAPI / ASGI expose `ConditionalAgentScoreGate`, Django exposes `ConditionalAgentScoreMiddleware`, Flask + Sanic expose `conditional_agentscore_gate(app, ...)`, aiohttp exposes `conditional_agentscore_gate_middleware(...)`. Adapters export ONLY framework-specific surface (gate classes / fns, accessors, `capture_wallet`); shared helpers like `has_payment_header` / `denial_reason_to_body` import from their canonical home (`agentscore_commerce.payment` and `agentscore_commerce.identity` respectively). The Flask / Sanic `agentscore_gate(app, ...)` function accepts an optional `condition=` callable for inline gating (`AgentScoreGate.__init__` does not). |
13
13
  | `agentscore_commerce.identity.policy` | Per-product compliance helpers: `PolicyBlock`, `build_gate_from_policy`, `run_gate_with_enforcement`, `shipping_country_allowed`, `shipping_state_allowed`, `validate_shipping_against_policy` (one-call country+state validator that raises `CheckoutValidationError` with the canonical envelope on miss) |
14
14
  | `agentscore_commerce.payment` | Networks/USDC/rails registries, paymentauth.org directive builders, `create_x402_server` (wraps `x402[evm]>=2.9` + `cdp-sdk` for `facilitator="coinbase"`; install via the `coinbase` extra), `build_x402_accepts_for_402` (build the 402's `accepts[]` from the registered scheme; derives the right `extra.name` per network), `build_default_checkout_rails(tempo=, x402_base=, solana_mpp=, stripe=)` (canonical 4-rail `rails` dict factory: merchants pass per-rail overrides instead of redeclaring the recipient sentinel + network/chain_id/token boilerplate. When a caller flips `network` without pinning `token` / `chain_id`, the underlying dataclass derives them from the network: Base Sepolia → Sepolia USDC + chain_id 84532, Solana devnet → devnet USDC mint. Explicit overrides always win. Solana's `network` field accepts both CAIP-2 (`solana:5eykt4UsFv8…` / `solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1`) AND the raw `@solana/mpp` form (`mainnet-beta` / `devnet` / `localnet`)), `build_mppx_compose_rails(amount_usd=, tempo_recipient=, solana_recipient=, ...)` (per-call intent factory replacing the hand-rolled `[("tempo/charge", {...}), ("solana/charge", {...}), ("stripe/charge", {...})]` list; auto-handles USD→atomic conversion for Solana; auto-drops the `stripe/charge` rail with a one-time `logging.warning` when `amount_usd < 0.50` since Stripe's fixed ~$0.30 fee makes sub-50-cent charges unprofitable — many Stripe accounts also reject PI creation below the floor with `amount_too_small`; sub-50-cent APIs pass `include_stripe=False` explicitly to silence the warning), `process_x402_settle` (verify+settle in one call), `create_mppx_server` (wraps `pympp[server,tempo,stripe]>=0.6`), `is_evm_network`/`is_solana_network` (CAIP-2 discriminators that hide the `startswith("eip155:")` / `startswith("solana:")` prefix matching), `has_payment_header` (settle-leg vs discovery-leg discriminator), `parse_did_pkh_address` (parses ``did:pkh:<family>:<chain>:<addr>`` into a `PaymentSigner`), dispatch-by-network, signer extraction, WWW-Authenticate header, Settlement-Overrides header |
15
15
  | `agentscore_commerce.discovery` | Discovery probe (`is_discovery_probe_request`, `build_discovery_probe_response`), Bazaar wrapper, `/.well-known/mpp.json`, `llms.txt` builder, `skill.md` builder (Claude-Skill-compatible agent-discovery manifest), `build_redemption_skill_md` (delivery-neutral; printed/emailed/API-trial codes all covered via `delivery_intro`/`body_shape`/`body_rules`/`extra_recovery_rows` overrides), `build_merchant_index_json` + `standard_endpoint_descriptions(kind=)` (canonical `/` discovery body for goods or API merchants), `build_success_next_steps` (universal Passport-active success block), `build_agentscore_onboarding_steps`, OpenAPI snippets, `NoindexNonDiscoveryMiddleware` ASGI middleware. Plus the UCP/JWKS publish surface: `build_signed_ucp_response`, `build_signed_jwks_response`, `well_known_preflight_response`, `default_a2a_services`, `bootstrap_ucp_signing_key`, framework-neutral `SignedDiscoveryResponse` + per-framework wrappers `signed_response_{fastapi,flask,django,aiohttp,sanic}` |
16
16
  | `agentscore_commerce.challenge` | 402-body builders: accepted_methods, identity_metadata (auto-attached by `Checkout` when wallet header present), how_to_pay, agent_instructions, build_402_body, pricing, agent_memory, `build_validation_error` (4xx body builder), `Receipt`/`ReceiptNextSteps`/`ProductInfo`/`ShippingAddress` (canonical 200-receipt dataclasses) |
17
- | `agentscore_commerce.stripe_multichain` | Multichain PaymentIntent helper (`create_multichain_payment_intent` returns `MultichainPaymentIntentResult`; read `result.deposit_addresses[network]` directly), `create_pay_to_address_from_stripe_pi(authorization_header=, amount_cents=, stripe=, pi_cache=, networks=, metadata=, order_id=, preferred_network=)` — one-call per-order payTo resolver matching `Checkout.mint_recipients`: on the settle leg, reuses the buyer's signed-against payTo from the MPP credential (after `pi_cache.has_address` check); on the discovery leg, mints a fresh PI via `create_multichain_payment_intent` and caches the addresses + PI mapping. Testnet simulator (`simulate_crypto_deposit`, `simulate_deposit_if_test_mode`), `simulate_deposit_for_outcome(outcome=, deposit_address=, get_payment_intent_id=, stripe_secret_key=, stripe_version=)` (dispatches the simulator based on a Checkout / compute_first_checkout settle outcome; replaces the per-merchant rail-switch + thin `simulate_deposit_if_testnet(addr, network)` wrapper), `network_for_outcome` (outcome → simulator network arg, handles both Checkout-shaped `rail_key` and compute-first-shaped `mpp_method`, accepts bare scheme names AND `<scheme>/charge` forms), `create_pi_cache`, `create_mppx_stripe` |
17
+ | `agentscore_commerce.stripe_multichain` | Multichain PaymentIntent helper (`create_multichain_payment_intent` returns `MultichainPaymentIntentResult`; read `result.deposit_addresses[network]` directly), `create_pay_to_address_from_stripe_pi(authorization_header=, amount_cents=, stripe=, pi_cache=, networks=, static_recipients=, metadata=, order_id=, preferred_network=)` — one-call per-order payTo resolver matching `Checkout.mint_recipients`: on the settle leg, reuses the buyer's signed-against payTo from the MPP credential (after `pi_cache.has_address` check OR a `static_recipients` match — the static address is always-accepted because the merchant owns it); on the discovery leg, mints a fresh PI for the rails NOT covered by `static_recipients`, caches the merged map, registers static addresses with `pi_cache.cache_address`. `mint_multichain_recipients(...same kwargs) -> MintMultichainRecipientsResult(recipients, payment_intent_id, reused_from_credential)` — structured variant returning the full per-rail map; prefer this when the merchant's `mint_recipients` hook needs all rail addresses (typical multi-rail merchant), and to avoid the "returned-string-is-ambiguous" trap on the settle leg when `static_recipients` is configured. Use `static_recipients={"solana": "<wallet>"}` for low-margin endpoints where rotating per-PI Solana addresses can't absorb MPP spec §13.6's ~$0.50 ATA rent per call — the SDK skips Stripe minting on that network and reuses the static recipient forever; pair with a one-time external USDC pre-funding of the recipient's ATA and every settle pays only the per-tx fee. `SolanaMppRailSpec.ata_creation_required` defaults to `True` (data-only — solana method registration through `create_mppx_server` is a follow-up; merchants building the solana method directly via `pympp` should pass the flag themselves to the charge factory). Testnet simulator (`simulate_crypto_deposit`, `simulate_deposit_if_test_mode`), `simulate_deposit_for_outcome(outcome=, deposit_address=, get_payment_intent_id=, stripe_secret_key=, stripe_version=)` (dispatches the simulator based on a Checkout / compute_first_checkout settle outcome; replaces the per-merchant rail-switch + thin `simulate_deposit_if_testnet(addr, network)` wrapper), `network_for_outcome` (outcome → simulator network arg, handles both Checkout-shaped `rail_key` and compute-first-shaped `mpp_method`, accepts bare scheme names AND `<scheme>/charge` forms), `create_pi_cache`, `create_mppx_stripe` |
18
18
  | `agentscore_commerce.api` | Re-exports `AgentScore` from `agentscore` SDK |
19
19
  | `agentscore_commerce.middleware.{fastapi,flask,django,aiohttp,sanic,asgi}` | Framework-specific rate-limit middleware. FastAPI exposes `rate_limit_fastapi(...)` (FastAPI dependency) plus the ASGI `RateLimitMiddleware` re-export; Flask exposes `rate_limit_flask(app, ...)` (installs a `before_request` hook); Django exposes a class-based async `RateLimitMiddleware` configured via `settings.AGENTSCORE_RATE_LIMIT`; aiohttp exposes `rate_limit_aiohttp(...)` middleware factory; Sanic exposes `rate_limit_sanic(app, ...)` installer; `asgi.RateLimitMiddleware` is a generic ASGI middleware that works with any starlette-compatible app. Shared options: `window_seconds` (default 60), `max_requests` (default 60), `key_resolver` (default first hop of `x-forwarded-for`), `redis_url` (lazy-imports `redis.asyncio` when set, in-memory `dict` fallback otherwise), `key_prefix`. `redis` is an optional peer dep (install via the `redis` extra). |
20
20
 
@@ -46,7 +46,7 @@ Peer-dep pattern: payment/x402/mppx/stripe modules import lazily at runtime; ven
46
46
  | `multi_rail_merchant.py` | Full agent-commerce: identity + Tempo MPP + x402 + Stripe SPT |
47
47
  | `stripe_multichain_merchant.py` | Stripe-anchored multichain (PaymentIntent → tempo/base/solana deposit addresses) |
48
48
  | `compute_first_merchant.py` | Pay-per-result variable-cost merchant via the compute-first + exact-x402 helper (`compute_first_checkout`). Exact-mode rails only (x402-exact Base, tempo/charge, solana/charge, Stripe SPT); deliberately scoped out of x402-upto (Permit2) and Settlement-Overrides. Probe runs the work + caches by body content-hash; settle replays the cached result at the computed exact price. Pairs with `rate_limit_fastapi` since the probe leg runs work pre-payment. |
49
- | `compliance_merchant.py` | Regulated-goods merchant: full compliance gate + custom `on_denied` composing the denial helpers (`verification_agent_instructions`, `is_fixable_denial`, `build_signer_mismatch_body`, `build_contact_support_next_steps`, `denial_reason_to_body`/`denial_reason_status`) |
49
+ | `compliance_merchant.py` | Regulated-goods merchant: full compliance gate + custom `on_denied` composing the denial helpers (`verification_agent_instructions`, `is_fixable_denial`, `build_contact_support_next_steps`, `denial_reason_to_body`/`denial_reason_status`) |
50
50
  | `per_product_policy_merchant.py` | Multi-product merchant where each row carries its own compliance policy. One product hard-gates KYC + age + state; another is anonymous; a third uses `enforcement="soft"` (request KYC but don't block sale). Demonstrates `PolicyBlock`, `build_gate_from_policy`, `run_gate_with_enforcement`, `shipping_country_allowed`, `shipping_state_allowed`. |
51
51
  | `signed_ucp_merchant.py` | Signed UCP profile (`/.well-known/ucp`) + JWKS endpoint (`/.well-known/jwks.json`). AgentScore's `agentscore-profile+jws` is a vendor extension on top of UCP for trust-mode verifiers (regulated-commerce, AP2-aware) that opt into auditable cryptographic provenance — UCP §6 itself does NOT mandate signing; production UCP merchants commonly ship unsigned. Wires ephemeral-for-dev / env-JWK-for-prod signing, kid rotation, and `Cache-Control` posture. Uses `generate_ucp_signing_key`, `sign_ucp_profile`, `build_jwks_response`, `UCPSigningKey.from_jwk`, `UCPVerificationError`. Demonstrates the payment-handler builders (`mpp_payment_handler`, `x402_payment_handler`, `stripe_spt_payment_handler` — see "Payment-handler builders" below). |
52
52
 
@@ -55,6 +55,7 @@ Peer-dep pattern: payment/x402/mppx/stripe modules import lazily at runtime; ven
55
55
  The SDK ships protocol-rooted builders for the AgentScore-published payment handlers — vendors compose UCP `payment_handlers` blocks by spreading these helpers instead of hand-writing the verbose binding wrapper:
56
56
 
57
57
  ```python
58
+ from agentscore_commerce import StripeRailSpec, TempoRailSpec, X402BaseRailSpec
58
59
  from agentscore_commerce.identity import (
59
60
  build_ucp_profile,
60
61
  mpp_payment_handler,
@@ -65,14 +66,14 @@ from agentscore_commerce.identity import (
65
66
  build_ucp_profile(
66
67
  ...,
67
68
  payment_handlers={
68
- **mpp_payment_handler(networks=[{"network": "tempo-mainnet", "chain_id": 4217, "recipient": "0x..."}]),
69
- **x402_payment_handler(networks=[{"network": "base-8453", "recipient": "0x..."}]),
70
- **stripe_spt_payment_handler(profile_id="profile_..."),
69
+ **mpp_payment_handler(networks=[TempoRailSpec(recipient="0x...")]),
70
+ **x402_payment_handler(networks=[X402BaseRailSpec(recipient="0x...")]),
71
+ **stripe_spt_payment_handler(spec=StripeRailSpec(profile_id="profile_...")),
71
72
  },
72
73
  )
73
74
  ```
74
75
 
75
- Each helper returns `{ <reverse-DNS-key>: [binding] }` so spreading composes the parent map. The handler `version`, spec URL, and schema URL are owned by the helpers (`agentscore_commerce/identity/ucp.py`) — bumping a handler spec version is a one-line change there. `mpp` + `x402` share the same `networks: [{network, recipient?, ...extras}]` config shape so consumers parse both identically. `recipient` is optional omit when the merchant uses per-order recipients (e.g. Stripe-derived deposit addresses); the authoritative recipient still ships in the 402 body.
76
+ Each helper returns `{ <reverse-DNS-key>: [binding] }` so spreading composes the parent map. The handler `version`, spec URL, and schema URL are owned by the helpers (`agentscore_commerce/identity/ucp.py`) — bumping a handler spec version is a one-line change there. `mpp` takes `TempoRailSpec` / `SolanaMppRailSpec` instances and `x402` takes `X402BaseRailSpec`; each carries a `recipient` a static address string, or `""` / a factory callable to signal per-order minting (e.g. Stripe-derived deposit addresses), in which case the authoritative recipient ships in the 402 body rather than the static UCP profile.
76
77
 
77
78
  ## Identity model
78
79
 
@@ -120,7 +121,7 @@ Anonymous POST flows through to the handler unauthenticated and gets a 402 with
120
121
 
121
122
  ### `compatible_clients` field on emitted 402s
122
123
 
123
- `build_agent_instructions` emits a `compatible_clients` field in the 402 body, derived automatically from `how_to_pay`: per-rail list of CLIs the AgentScore team has smoke-verified end-to-end. Vendors override with `BuildAgentInstructionsInput(compatible_clients={...})` to add their own tested clients. Set to an empty dict `{}` to suppress the default. Same data is published as `core/docs/integrations/x402-clients.mdx` for human-side rationale + per-rail commands.
124
+ `build_agent_instructions` emits a `compatible_clients` field in the 402 body, derived automatically from `how_to_pay`: per-rail list of CLIs the AgentScore team has smoke-verified end-to-end. Vendors override with `build_agent_instructions(how_to_pay=how_to_pay, compatible_clients={...})` to add their own tested clients. Set to an empty dict `{}` to suppress the default. Same data is published as `core/docs/integrations/x402-clients.mdx` for human-side rationale + per-rail commands.
124
125
 
125
126
  ## Tooling
126
127
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agentscore-commerce
3
- Version: 2.2.0
3
+ Version: 2.4.0
4
4
  Summary: Agent commerce SDK for Python — identity middleware (FastAPI, Flask, Django, AIOHTTP, Sanic, ASGI) + payment helpers + 402 builders + discovery + Stripe multichain. The full merchant-side toolkit for AgentScore-powered agent commerce.
5
5
  Project-URL: Homepage, https://agentscore.sh
6
6
  Project-URL: Repository, https://github.com/agentscore/python-commerce
@@ -18,7 +18,7 @@ Classifier: License :: OSI Approved :: MIT License
18
18
  Classifier: Programming Language :: Python :: 3
19
19
  Classifier: Topic :: Software Development :: Libraries
20
20
  Requires-Python: >=3.11
21
- Requires-Dist: agentscore-py>=2.3.0
21
+ Requires-Dist: agentscore-py>=2.4.0
22
22
  Requires-Dist: httpx<1.0.0,>=0.25.0
23
23
  Provides-Extra: aiohttp
24
24
  Requires-Dist: aiohttp>=3.8.0; extra == 'aiohttp'
@@ -33,7 +33,7 @@ Requires-Dist: flask>=2.0.0; extra == 'flask'
33
33
  Provides-Extra: mppx
34
34
  Requires-Dist: pympp[server,stripe,tempo]<1,>=0.6; extra == 'mppx'
35
35
  Provides-Extra: redis
36
- Requires-Dist: redis<7,>=5.0; extra == 'redis'
36
+ Requires-Dist: redis<8,>=5.0; extra == 'redis'
37
37
  Provides-Extra: sanic
38
38
  Requires-Dist: sanic>=23.0.0; extra == 'sanic'
39
39
  Provides-Extra: starlette
@@ -74,11 +74,11 @@ pip install 'agentscore-commerce[fastapi,x402,coinbase]'
74
74
  |---|---|
75
75
  | `agentscore_commerce` (top-level) | `Checkout` orchestrator + `CheckoutContext` + `CheckoutGateConfig` + `CheckoutValidationError` + `DiscoveryProbeConfig` + `SettleOutcome` + `MppxComposeOutcome` + `PricingResult` (the 2.0 high-level surface: one config object, hooks for pre_validate/compute_pricing/on_settled/mint_recipients/compose_mppx, auto-derived x402+mppx servers, per-framework adapters `handle_fastapi`/`handle_flask`/`handle_django`/`handle_aiohttp`/`handle_sanic`, signed UCP routes via `mount_ucp_routes_{fastapi,flask,django,aiohttp,sanic}`); `pricing_result` (factory: cents-denominated → typed `PricingResult` with embedded `PricingBlock`); `validation_response_{fastapi,flask,django,aiohttp,sanic}` (per-framework 4xx envelope wrappers); `make_mppx_compose_hook` (canonical pympp compose adapter). |
76
76
  | `agentscore_commerce.identity.{fastapi,flask,django,aiohttp,sanic,middleware}` | Trust gate middleware: KYC, sanctions (account name + signer wallet), age, jurisdiction. `AgentScoreGate(...)` (or `agentscore_gate(app, ...)` on Flask/Sanic), `get_agentscore_data(...)`, `capture_wallet(...)`, `get_signer_verdict(...)`. The gate extracts the payment signer pre-evaluate and passes it to `/v1/assess`, so the API composes both wallet-binding (`signer_match`) and OFAC SDN wallet-address (`signer_sanctions`) verdicts on one round trip. |
77
- | `agentscore_commerce.identity` (package level) | Re-exports the denial helpers: `denial_reason_status`, `denial_reason_to_body`, `build_signer_mismatch_body`, `build_contact_support_next_steps`, `verification_agent_instructions`, `is_fixable_denial`, `FIXABLE_DENIAL_REASONS`. The per-framework adapter modules also expose `get_gate_quota_info(request)` for surfacing X-RateLimit info from gate state. Also re-exports the per-product policy helpers: `PolicyBlock`, `GateResult`, `EnforcementMode`, `IdentityStatus`, `build_gate_from_policy`, `run_gate_with_enforcement`, `shipping_country_allowed`, `shipping_state_allowed`, `validate_shipping_against_policy` (one-call country+state validator that raises `CheckoutValidationError` with the canonical envelope on miss) — for multi-product merchants where each product carries its own compliance config: hard gate vs soft vs none, per-product shipping allowlists. Key + token helpers: `load_ucp_signing_key_from_env` (cached env-driven loader for the UCP signing key — reads `UCP_SIGNING_KEY_JWK_PRIVATE` JSON JWK, detects alg from shape, falls back to ephemeral when unset, sanitizes errors so key bytes never reach logs, concurrent-safe via `threading.Lock`; env-var names and `default_kid` / `default_alg` are overridable as kwargs); `hash_operator_token` (sha256 hex of plaintext `opc_...` — for merchants persisting `operator_token_id` to their own DB without ever storing the plaintext); `extract_owner_scope(headers) -> OwnerScope` (canonical owner-identity extractor for caller-scoped resource queries — reads `X-Wallet-Address` / `X-Operator-Token`, hashes the token so plaintext never leaves the request); `has_payment_header` / `has_x402_header` / `has_mppx_header` (request discriminators — any-credential vs x402 vs MPP); `default_read_only_on_denied(reason)` (canonical `on_denied` for read-only resource gates: 401 + `Cache-Control: no-store` while still spreading `denial_reason_to_body`. Returns a `DefaultOnDeniedResult(body, status, headers)`; FastAPI / Flask / aiohttp / Sanic `on_denied` callbacks accept an optional 3-tuple `(body, status, headers)` to carry headers through; wrap with `lambda req, reason: (lambda r: (r.body, r.status, r.headers or {}))(default_read_only_on_denied(reason))`). |
78
- | `agentscore_commerce.payment` | `networks`, `USDC`, `rails` registries; `payment_directive`, `build_payment_directive`, `www_authenticate_header`, `payment_required_header`, `alias_amount_fields` (v1↔v2 amount field shim that emits both `amount` and `maxAmountRequired` so v1-only x402 parsers like Coinbase awal can read v2 bodies), `settlement_override_header`, `dispatch_settlement_by_network`, `extract_payment_signer` (accepts positional `x402_payment_header` AND/OR `authorization_header=` kwarg; recovers signer from x402 EIP-3009 `payload.authorization.from` OR MPP `Authorization: Payment <base64>` `did:pkh:eip155:<chain>:<addr>` / `did:pkh:solana:<genesis>:<addr>` source DID), `detect_rail_from_headers` (returns `"x402"` / `"mpp"` / `None` from inbound headers), `register_x402_schemes_v1_v2`; drop-in x402 helpers: `validate_x402_network_config` (boot-time guard), `verify_x402_request` (parse + validate inbound X-Payment), `process_x402_settle` (verify-then-settle with one call), `classify_x402_settle_result` (maps the tagged settle result to a recommended HTTP status / code / next_steps so merchants get a controlled envelope without coupling to facilitator-specific error text), `classify_orchestration_error` (same `ClassifiedX402Error` shape but for uncaught exceptions thrown elsewhere in the orchestration; returns `None` for unknown errors so merchants rethrow instead of swallowing); `zero_amount_carve_out` (skip CDP / pympp upstream verify+settle for $0 settles where the upstream rejects value=0 payloads; parses the credential, lifts signer + network, returns a `ZeroSettleResult` shaped identically to the success path so callers branch on rail, not on result shape); `usd_to_atomic` (Decimal-based USD → atomic int, ROUND_HALF_UP — for Tempo / Solana / Base USDC amount construction). |
77
+ | `agentscore_commerce.identity` (package level) | Re-exports the denial helpers: `denial_reason_status`, `denial_reason_to_body`, `build_signer_mismatch_body`, `build_contact_support_next_steps`, `verification_agent_instructions`, `is_fixable_denial`, `FIXABLE_DENIAL_REASONS`. The per-framework adapter modules also expose `get_gate_quota_info(request)` for surfacing X-RateLimit info from gate state. Also re-exports the per-product policy helpers: `PolicyBlock`, `GateResult`, `EnforcementMode`, `IdentityStatus`, `build_gate_from_policy`, `run_gate_with_enforcement`, `shipping_country_allowed`, `shipping_state_allowed`, `validate_shipping_against_policy` (one-call country+state validator that raises `CheckoutValidationError` with the canonical envelope on miss) — for multi-product merchants where each product carries its own compliance config: hard gate vs soft vs none, per-product shipping allowlists. Key + token helpers: `load_ucp_signing_key_from_env` (cached env-driven loader for the UCP signing key — reads `UCP_SIGNING_KEY_JWK_PRIVATE` JSON JWK, detects alg from shape, falls back to ephemeral when unset, sanitizes errors so key bytes never reach logs, concurrent-safe via `threading.Lock`; env-var names and `default_kid` / `default_alg` are overridable as kwargs); `hash_operator_token` (sha256 hex of plaintext `opc_...` — for merchants persisting `operator_token_id` to their own DB without ever storing the plaintext); `extract_owner_scope(headers) -> OwnerScope` (canonical owner-identity extractor for caller-scoped resource queries — reads `X-Wallet-Address` / `X-Operator-Token`, hashes the token so plaintext never leaves the request); `default_read_only_on_denied(reason)` (canonical `on_denied` for read-only resource gates: 401 + `Cache-Control: no-store` while still spreading `denial_reason_to_body`. Returns a `DefaultOnDeniedResult(body, status, headers)`; FastAPI / Flask / aiohttp / Sanic `on_denied` callbacks accept an optional 3-tuple `(body, status, headers)` to carry headers through; wrap with `lambda req, reason: (lambda r: (r.body, r.status, r.headers or {}))(default_read_only_on_denied(reason))`). |
78
+ | `agentscore_commerce.payment` | `networks`, `USDC`, `rails` registries; `payment_directive`, `build_payment_directive`, `www_authenticate_header`, `payment_required_header`, `alias_amount_fields` (opt-in v1↔v2 amount-field shim that adds both `amount` and `maxAmountRequired` to an entry. The 402 builders do NOT apply it by default — strict x402 v2 settlement matches the agent's echoed requirement by exact comparison, so an extra field the server's rebuilt requirement lacks breaks settle; use only when you know a client is hardcoded to read `maxAmountRequired`), `settlement_override_header`, `dispatch_settlement_by_network`, `extract_payment_signer` (accepts positional `x402_payment_header` AND/OR `authorization_header=` kwarg; recovers signer from x402 EIP-3009 `payload.authorization.from` OR MPP `Authorization: Payment <base64>` `did:pkh:eip155:<chain>:<addr>` / `did:pkh:solana:<genesis>:<addr>` source DID), `detect_rail_from_headers` (returns `"x402"` / `"mpp"` / `None` from inbound headers), `register_x402_schemes_v1_v2`; drop-in x402 helpers: `validate_x402_network_config` (boot-time guard), `verify_x402_request` (parse + validate inbound X-Payment), `process_x402_settle` (verify-then-settle with one call), `classify_x402_settle_result` (maps the tagged settle result to a recommended HTTP status / code / next_steps so merchants get a controlled envelope without coupling to facilitator-specific error text), `classify_orchestration_error` (same `ClassifiedX402Error` shape but for uncaught exceptions thrown elsewhere in the orchestration; returns `None` for unknown errors so merchants rethrow instead of swallowing); `zero_amount_carve_out` (skip CDP / pympp upstream verify+settle for $0 settles where the upstream rejects value=0 payloads; parses the credential, lifts signer + network, returns a `ZeroSettleResult` shaped identically to the success path so callers branch on rail, not on result shape); `usd_to_atomic` (Decimal-based USD → atomic int, ROUND_HALF_UP — for Tempo / Solana / Base USDC amount construction). |
79
79
  | `agentscore_commerce.discovery` | `is_discovery_probe_request`, `build_discovery_probe_response` (with optional `x402_sample` for x402-aware crawlers like `awal x402 details`), `sample_x402_accept_for_network` (USDC sample-accept builder for known CAIP-2 networks), `build_well_known_mpp`, `build_llms_txt` + `llms_txt_identity_section` + `llms_txt_payment_section` (compact + verbose modes), `build_skill_md` (Claude-Skill-compatible `/skill.md` agent-discovery manifest; strictly agent-facing data only, no internal posture), `build_redemption_skill_md` (delivery-neutral redemption-code template — printed mailers, emailed codes, API trial credits all covered; `endpoint_path`/`delivery_intro`/`body_shape`/`body_rules`/`extra_recovery_rows` overrides for non-goods shapes), `build_merchant_index_json` (canonical `/` discovery body), `standard_endpoint_descriptions(kind=)` (canonical method+path → description map for goods vs api merchants; optional `include_order_status_route` for goods), `build_success_next_steps` (universal Passport-active success block), `build_agentscore_onboarding_steps` (canonical skill.md onboarding for goods or API merchants), `agentscore_openapi_snippets`, `build_bazaar_discovery_payload`, `NoindexNonDiscoveryMiddleware` (ASGI middleware emitting `X-Robots-Tag: noindex` on every path except the agent-discovery surfaces; pure helpers `is_discovery_path` + `DEFAULT_DISCOVERY_PATHS` for non-ASGI frameworks). Plus the UCP/JWKS publish surface: `build_signed_ucp_response`, `build_signed_jwks_response`, `well_known_preflight_response`, `default_a2a_services`, `bootstrap_ucp_signing_key`, framework-neutral `SignedDiscoveryResponse` + per-framework wrappers `signed_response_{fastapi,flask,django,aiohttp,sanic}`. |
80
80
  | `agentscore_commerce.challenge` | `build_402_body`, `build_accepted_methods`, `build_identity_metadata` (auto-attached by `Checkout` when an inbound `X-Wallet-Address` header is present), `build_how_to_pay`, `build_agent_instructions` (auto-emits per-rail `compatible_clients`: smoke-verified CLIs the agent should use; vendor override supported; pure helper `compatible_clients_by_rails(rails)` returns the same map for vendors building custom 402s), `build_pricing_block` (cents to dollar-string with optional shipping/tax), `first_encounter_agent_memory` (cross-merchant hint, returns the canonical block or `None` based on a per-merchant first-seen flag), `Receipt` + `ReceiptNextSteps` + `ProductInfo` + `ShippingAddress` (canonical 200-receipt dataclasses — universal across goods + API merchants); `respond_402`, a drop-in 402 emit that preserves pympp's `WWW-Authenticate` and layers x402's `PAYMENT-REQUIRED`. `build_validation_error`: structured 4xx body builder (`{error: {code, message}, required_fields?, example_body?, next_steps?, ...extra}`) so vendors compose body shapes by name instead of inlining at every validation site. |
81
- | `agentscore_commerce.stripe_multichain` | `create_multichain_payment_intent` (returns `MultichainPaymentIntentResult(payment_intent_id, deposit_addresses)`; read `result.deposit_addresses[network]` directly), `create_pay_to_address_from_stripe_pi(authorization_header=, amount_cents=, stripe=, pi_cache=, networks=, metadata=, order_id=, preferred_network=)` — per-order payTo resolver: on the settle leg, reuses the buyer's signed-against payTo from the MPP credential (after `pi_cache.has_address` check); on the discovery leg, mints a fresh PI and caches it. `simulate_crypto_deposit`; `create_pi_cache` (TTL'd PI / deposit-address cache, Redis-backed when `redis_url` set, in-memory otherwise), `simulate_deposit_if_test_mode` (gates on `sk_test_` and looks up the PI for you), `STRIPE_TEST_TX_HASH_SUCCESS` / `STRIPE_TEST_TX_HASH_FAILED` constants. Peer dep on `stripe`. |
81
+ | `agentscore_commerce.stripe_multichain` | `create_multichain_payment_intent` (returns `MultichainPaymentIntentResult(payment_intent_id, deposit_addresses)`; read `result.deposit_addresses[network]` directly), `create_pay_to_address_from_stripe_pi(authorization_header=, amount_cents=, stripe=, pi_cache=, networks=, static_recipients=, metadata=, order_id=, preferred_network=)` — per-order payTo resolver: on the settle leg, reuses the buyer's signed-against payTo from the MPP credential (after `pi_cache.has_address` check OR a `static_recipients` match — the static address is always-accepted because the merchant owns it); on the discovery leg, mints a fresh PI for the rails NOT covered by `static_recipients`, caches the merged map, registers static addresses with `pi_cache.cache_address` so verify-leg lookups pass. `mint_multichain_recipients(...same kwargs)` — structured variant returning `MintMultichainRecipientsResult(recipients, payment_intent_id, reused_from_credential)` for the full per-rail map (typical multi-rail merchant hook). Use `static_recipients={"solana": "<wallet>"}` for low-margin endpoints where Solana per-call ATA rent (~$0.50 against MPP spec §13.6) dominates revenue — the SDK skips Stripe minting on that network, reuses the static recipient forever, and (with a one-time external pre-funding of the recipient's USDC ATA) lets every settle pay only the ~$0.001 per-tx fee. `SolanaMppRailSpec.ata_creation_required` defaults to `True` (data-only; solana method registration through `create_mppx_server` is a follow-up — merchants building the solana method directly via `pympp` should pass the flag themselves to the charge factory). `simulate_crypto_deposit`; `create_pi_cache` (TTL'd PI / deposit-address cache, Redis-backed when `redis_url` set, in-memory otherwise), `simulate_deposit_if_test_mode` (gates on `sk_test_` and looks up the PI for you), `STRIPE_TEST_TX_HASH_SUCCESS` / `STRIPE_TEST_TX_HASH_FAILED` constants. Peer dep on `stripe`. |
82
82
  | `agentscore_commerce.api` | Everything from `agentscore-py` re-exported in one place: `AgentScore` + `AgentScoreError`, `AGENTSCORE_TEST_ADDRESSES` + `is_agentscore_test_address`. **Don't add `agentscore-py` as a separate dep**: the two can drift versions and cause subtle type mismatches. |
83
83
  | `agentscore_commerce.middleware.{fastapi,flask,django,aiohttp,sanic,asgi}` | Framework-specific rate-limit middleware. FastAPI: `rate_limit_fastapi(...)` (FastAPI dependency) plus the ASGI `RateLimitMiddleware` re-export. Flask: `rate_limit_flask(app, ...)` installer. Django: class-based async `RateLimitMiddleware` configured via `settings.AGENTSCORE_RATE_LIMIT`. aiohttp: `rate_limit_aiohttp(...)` middleware factory. Sanic: `rate_limit_sanic(app, ...)` installer. `asgi.RateLimitMiddleware` works with any starlette-compatible app. Shared options: `window_seconds` (default 60), `max_requests` (default 60), `key_resolver` (default first hop of `x-forwarded-for`), `redis_url` (lazy-imports `redis.asyncio` when set, in-memory `dict` fallback otherwise), `key_prefix`. `redis` is an optional peer dep (install via the `redis` extra). |
84
84
 
@@ -231,8 +231,6 @@ For the `on_denied` hook on Checkout's gate config, `create_default_on_denied(me
231
231
  ```python
232
232
  from agentscore_commerce import extract_payment_signer
233
233
  from agentscore_commerce.payment import (
234
- BuildPaymentDirectiveInput,
235
- PaymentDirectiveInput,
236
234
  build_payment_directive,
237
235
  networks,
238
236
  payment_directive,
@@ -241,12 +239,12 @@ from agentscore_commerce.payment import (
241
239
 
242
240
  # Build paymentauth.org directives by symbolic rail name (decimals + currency from registry)
243
241
  directives = [
244
- build_payment_directive(BuildPaymentDirectiveInput(
242
+ build_payment_directive(
245
243
  rail="tempo-mainnet", id="chg_t", realm="ex.com", recipient=TEMPO_ADDR, amount_usd=0.01,
246
- )),
247
- build_payment_directive(BuildPaymentDirectiveInput(
244
+ ),
245
+ build_payment_directive(
248
246
  rail="x402-base-mainnet", id="chg_b", realm="ex.com", recipient=BASE_ADDR, amount_usd=0.01,
249
- )),
247
+ ),
250
248
  ]
251
249
  www_auth = www_authenticate_header(directives)
252
250
 
@@ -259,25 +257,15 @@ if signer:
259
257
  ## Discovery + 402 builders
260
258
 
261
259
  ```python
260
+ from agentscore_commerce import TempoRailSpec
262
261
  from agentscore_commerce.discovery import (
263
- BuildLlmsTxtInput,
264
- LlmsTxtIdentitySectionInput,
265
- LlmsTxtPaymentSectionInput,
266
262
  LlmsTxtSection,
267
263
  PaymentMethodConfig,
268
- WellKnownMppInput,
269
264
  build_llms_txt,
270
265
  build_well_known_mpp,
271
266
  )
272
267
  from agentscore_commerce.challenge import (
273
- Build402BodyInput,
274
- BuildAcceptedMethodsInput,
275
- BuildAgentInstructionsInput,
276
- BuildHowToPayInput,
277
- HowToPayRails,
278
268
  PricingBlock,
279
- TempoConfig,
280
- TempoRailConfig,
281
269
  build_402_body,
282
270
  build_accepted_methods,
283
271
  build_agent_instructions,
@@ -286,19 +274,20 @@ from agentscore_commerce.challenge import (
286
274
  first_encounter_agent_memory,
287
275
  )
288
276
 
289
- accepted = build_accepted_methods(BuildAcceptedMethodsInput(tempo=TempoConfig(recipient=TEMPO_ADDR)))
290
- how_to_pay = build_how_to_pay(BuildHowToPayInput(
277
+ # build_accepted_methods + build_how_to_pay are async (they resolve per-order recipients).
278
+ accepted = await build_accepted_methods(tempo=TempoRailSpec(recipient=TEMPO_ADDR))
279
+ how_to_pay = await build_how_to_pay(
291
280
  url="https://my.merchant/buy", retry_body_json="{}", total_usd="10.00",
292
- rails=HowToPayRails(tempo=TempoRailConfig(recipient=TEMPO_ADDR)),
293
- ))
294
- body = build_402_body(Build402BodyInput(
281
+ rails={"tempo": TempoRailSpec(recipient=TEMPO_ADDR)},
282
+ )
283
+ body = build_402_body(
295
284
  accepted_methods=accepted,
296
- agent_instructions=build_agent_instructions(BuildAgentInstructionsInput(how_to_pay=how_to_pay)),
285
+ agent_instructions=build_agent_instructions(how_to_pay=how_to_pay),
297
286
  pricing=build_pricing_block(subtotal_cents=1000, tax_cents=80, shipping_cents=999, tax_rate=0.08, tax_state="CA"),
298
287
  amount_usd="10.80",
299
288
  # First-encounter merchants attach the cross-merchant agent_memory hint.
300
289
  agent_memory=first_encounter_agent_memory(first_encounter=not merchant.has_seen_operator(op_token)),
301
- ))
290
+ )
302
291
  ```
303
292
 
304
293
  `build_pricing_block` handles cents → dollar-string (with optional shipping). Pass `discount_cents` for redemption codes / coupons: `subtotal` stays the list price, the block surfaces `discount` as a dollar-string, and `total` becomes `subtotal + tax + shipping - discount` (floored at 0). `pricing_result` accepts the same `discount_cents` and propagates it to `block.discount` so agents reading the 402 see the savings line. Pass `decimals: N` (default `2`) on either helper for sub-cent unit pricing — e.g. `decimals=4` advertises `$0.0005`-precision instead of rounding to two decimals. Set `decimals` on `PricingResult` and the SDK threads it through `build_how_to_pay`, `build_pricing_block`, and the x402 settle `price` string automatically; the cents inputs accept floats under that mode (per-token / per-byte unit pricing). `first_encounter_agent_memory` returns the canonical hint or `None` based on a per-merchant first-seen flag. `Receipt` (plus `ReceiptNextSteps`, `ProductInfo`, `ShippingAddress`) is a universal dataclass for the post-settlement 200 response shape — goods merchants populate the shipping/fulfillment/tracking slots, API merchants fill only the universal fields (id, created_at, pricing, payment_status, next_steps).
@@ -307,7 +296,6 @@ body = build_402_body(Build402BodyInput(
307
296
 
308
297
  ```python
309
298
  from agentscore_commerce.payment import (
310
- BuildPaymentHeadersInput,
311
299
  PaymentHeadersRail,
312
300
  build_idempotency_key,
313
301
  build_payment_headers,
@@ -315,7 +303,7 @@ from agentscore_commerce.payment import (
315
303
 
316
304
  idempotency_key = build_idempotency_key(payment_intent_id=pi_id, order_id=order_id, amount_cents=amount)
317
305
 
318
- headers = build_payment_headers(BuildPaymentHeadersInput(
306
+ headers = build_payment_headers(
319
307
  order_id=order_id,
320
308
  realm="agents.merchant.example",
321
309
  rails=[
@@ -323,7 +311,7 @@ headers = build_payment_headers(BuildPaymentHeadersInput(
323
311
  PaymentHeadersRail(rail="x402-base-mainnet", amount_usd="10.00", recipient=BASE_ADDR),
324
312
  PaymentHeadersRail(rail="stripe", amount_usd="10.00", network_id=STRIPE_PROFILE_ID),
325
313
  ],
326
- ))
314
+ )
327
315
  # headers["www_authenticate"] → set as Authorization-style WWW-Authenticate header
328
316
  # headers["payment_required"] → set as PAYMENT-REQUIRED header (when x402 is present)
329
317
  ```
@@ -331,6 +319,7 @@ headers = build_payment_headers(BuildPaymentHeadersInput(
331
319
  ### Identity publishing (cross-vendor standards)
332
320
 
333
321
  ```python
322
+ from agentscore_commerce import StripeRailSpec, TempoRailSpec, X402BaseRailSpec
334
323
  from agentscore_commerce.identity import (
335
324
  AgentScoreGatePolicy,
336
325
  UCPServiceBinding,
@@ -339,6 +328,9 @@ from agentscore_commerce.identity import (
339
328
  A2AAgentSkill,
340
329
  build_a2a_agent_card,
341
330
  build_ucp_profile,
331
+ mpp_payment_handler,
332
+ x402_payment_handler,
333
+ stripe_spt_payment_handler,
342
334
  ucp_a2a_extension,
343
335
  )
344
336
 
@@ -383,9 +375,9 @@ profile = build_ucp_profile(
383
375
  ],
384
376
  },
385
377
  payment_handlers={
386
- **mpp_payment_handler(networks=[{"network": "tempo-mainnet", "chain_id": 4217, "recipient": TEMPO_ADDR}]),
387
- **x402_payment_handler(networks=[{"network": "base-8453", "recipient": BASE_ADDR}]),
388
- **stripe_spt_payment_handler(profile_id="profile_5xKvNqM9BaH"),
378
+ **mpp_payment_handler(networks=[TempoRailSpec(recipient=TEMPO_ADDR)]),
379
+ **x402_payment_handler(networks=[X402BaseRailSpec(recipient=BASE_ADDR)]),
380
+ **stripe_spt_payment_handler(spec=StripeRailSpec(profile_id="profile_5xKvNqM9BaH")),
389
381
  },
390
382
  signing_keys=[UCPSigningKey(kid="me", kty="EC", alg="ES256")],
391
383
  # Optional: declare merchant gate policy as an `sh.agentscore.identity` capability
@@ -443,40 +435,37 @@ ACP (Stripe + OpenAI Agentic Commerce Protocol) is a transactional checkout prot
443
435
  import os
444
436
  import stripe
445
437
  from agentscore_commerce.stripe_multichain import (
446
- CreateMultichainPaymentIntentInput,
447
- PiCacheOptions,
448
- SimulateDepositIfTestModeInput,
449
438
  create_multichain_payment_intent,
450
439
  create_pi_cache,
451
440
  simulate_deposit_if_test_mode,
452
441
  )
453
442
 
454
443
  stripe_client = stripe.StripeClient(os.environ["STRIPE_SECRET_KEY"])
455
- result = create_multichain_payment_intent(CreateMultichainPaymentIntentInput(
444
+ result = create_multichain_payment_intent(
456
445
  stripe=stripe_client,
457
446
  amount=1000,
458
447
  networks=["tempo", "base", "solana"],
459
448
  metadata={"order_id": order_id},
460
449
  idempotency_key=order_id,
461
- ))
450
+ )
462
451
  base_address = result.deposit_addresses.get("base")
463
452
  solana_address = result.deposit_addresses.get("solana")
464
453
 
465
454
  # PI / deposit-address cache. Redis-backed when REDIS_URL is set, in-memory otherwise.
466
455
  # Multi-instance deployments need Redis so a deposit lands on whichever instance settles it.
467
- pi_cache = create_pi_cache(PiCacheOptions(redis_url=os.environ.get("REDIS_URL")))
456
+ pi_cache = create_pi_cache(redis_url=os.environ.get("REDIS_URL"))
468
457
  for addr in result.deposit_addresses.values():
469
458
  await pi_cache.cache_address(addr)
470
459
  pi_cache.cache_payment_intent(addr, result.payment_intent_id)
471
460
  pi_cache.cache_network_addresses(result.payment_intent_id, result.deposit_addresses)
472
461
 
473
462
  # Testnet helper. Gates on sk_test_ and looks up the PI for you. No-op on live keys.
474
- await simulate_deposit_if_test_mode(SimulateDepositIfTestModeInput(
463
+ await simulate_deposit_if_test_mode(
475
464
  get_payment_intent_id=pi_cache.get_payment_intent_id,
476
465
  deposit_address=base_address,
477
466
  network="base",
478
467
  stripe_secret_key=os.environ["STRIPE_SECRET_KEY"],
479
- ))
468
+ )
480
469
  ```
481
470
 
482
471
  ## Build the x402 accepts entry for the 402 challenge
@@ -498,12 +487,8 @@ Returns a list of plain dicts ready for the 402 body's `accepts[]`. `extra.name`
498
487
  ## Drop-in 402 + settle (x402)
499
488
 
500
489
  ```python
501
- from agentscore_commerce.challenge import Build402BodyInput, Respond402Input, respond_402
490
+ from agentscore_commerce.challenge import build_402_body, respond_402
502
491
  from agentscore_commerce.payment import (
503
- PaymentRequiredHeaderInput,
504
- ProcessX402SettleInput,
505
- ValidateX402NetworkConfigInput,
506
- VerifyX402RequestInput,
507
492
  classify_x402_settle_result,
508
493
  process_x402_settle,
509
494
  validate_x402_network_config,
@@ -511,26 +496,26 @@ from agentscore_commerce.payment import (
511
496
  )
512
497
 
513
498
  # Boot-time guard. Raises if a configured network isn't supported.
514
- validate_x402_network_config(ValidateX402NetworkConfigInput(base_network=X402_BASE))
499
+ validate_x402_network_config(base_network=X402_BASE)
515
500
 
516
501
  @app.post("/purchase")
517
502
  async def purchase(request: Request):
518
503
  # Path A: agent presented an x402 X-Payment header
519
504
  if request.headers.get("payment-signature") or request.headers.get("x-payment"):
520
- verified = await verify_x402_request(VerifyX402RequestInput(
505
+ verified = await verify_x402_request(
521
506
  headers=dict(request.headers),
522
507
  is_cached_address=pi_cache.has_address,
523
508
  accepted_network=X402_BASE,
524
- ))
509
+ )
525
510
  if not verified.ok:
526
511
  return JSONResponse(verified.body, status_code=verified.status)
527
512
 
528
- settle = await process_x402_settle(ProcessX402SettleInput(
513
+ settle = await process_x402_settle(
529
514
  x402_server=x402_server,
530
515
  payload=verified.payload,
531
516
  resource_config={"scheme": "exact", "network": verified.signed_network, "price": f"${total}", "payTo": verified.signed_pay_to, "maxTimeoutSeconds": 300},
532
517
  resource_meta={"url": str(request.url), "mimeType": "application/json"},
533
- ))
518
+ )
534
519
  classified = classify_x402_settle_result(settle)
535
520
  if classified is not None:
536
521
  # Log raw `settle` server-side; return controlled phase-based response to the agent.
@@ -545,11 +530,12 @@ async def purchase(request: Request):
545
530
 
546
531
  # Path B: cold call (or Authorization: Payment for pympp). After pympp.compose() returns 402,
547
532
  # respond_402 PRESERVES pympp's WWW-Authenticate and ADDS x402's PAYMENT-REQUIRED.
548
- result = respond_402(Respond402Input(
533
+ # `body` is the dict from build_402_body; `x402` carries the payment_required_header kwargs.
534
+ result = respond_402(
549
535
  mppx_challenge_headers=pympp_challenge_headers,
550
- body=Build402BodyInput(accepted_methods=accepted, agent_instructions=instructions, pricing=pricing, amount_usd=total, retry_body=body),
551
- x402=PaymentRequiredHeaderInput(x402_version=2, accepts=x402_accepts, resource={"url": str(request.url), "mimeType": "application/json"}),
552
- ))
536
+ body=build_402_body(accepted_methods=accepted, agent_instructions=instructions, pricing=pricing, amount_usd=total, retry_body=body),
537
+ x402={"x402_version": 2, "accepts": x402_accepts, "resource": {"url": str(request.url), "mimeType": "application/json"}},
538
+ )
553
539
  return JSONResponse(result.body, status_code=result.status, headers=result.headers)
554
540
  ```
555
541