Skip to content

docs: add production payment binding guidance#107

Open
TateLyman wants to merge 2 commits into
google-agentic-commerce:mainfrom
TateLyman:codex/a2a-x402-security-controls
Open

docs: add production payment binding guidance#107
TateLyman wants to merge 2 commits into
google-agentic-commerce:mainfrom
TateLyman:codex/a2a-x402-security-controls

Conversation

@TateLyman

Copy link
Copy Markdown

Description

Adds production security guidance to the v0.2 x402 A2A spec for payment-to-task/resource binding, atomic claim-before-grant behavior, settlement finality, receipt history, scheme field checks, and HTTP cache/header handling.

Also updates the root README to point new readers at spec/v0.2/spec.md as the current specification.

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the Conventional Commits specification.
  • Ensure the tests and linter pass. Docs-only change; ran git diff --check.
  • Appropriate docs were updated.

Fixes #<issue_number_goes_here>

@TateLyman TateLyman requested a review from a team as a code owner May 16, 2026 19:29
@google-cla

google-cla Bot commented May 16, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the project documentation to point to version 0.2 of the x402 extension specification and introduces a new section on production payment binding requirements. These requirements define mandatory behaviors for task binding, atomic payment claims, settlement finality, receipt history, and secure HTTP transport handling. The review feedback suggests clarifying the comparison target for the resource field and explicitly using the term idempotency to improve the technical clarity of the specification.

Comment thread spec/v0.2/spec.md Outdated

Implementations that grant paid service results, mutate account state, or trigger downstream commerce workflows MUST bind payment verification to the exact task and paid resource being fulfilled:

* **Task and requirement binding**: Merchant Agents MUST validate that the submitted `PaymentPayload` matches a `PaymentRequirements` option that was previously issued for the same `taskId`. If the accepted requirements include a `resource` field, the Merchant Agent MUST compare it exactly before settlement. If the flow is embedded in a higher-level protocol, the implementation MUST also verify that the enclosing order or mandate identity matches the task being fulfilled.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The requirement to "compare it exactly" is slightly ambiguous. It should specify what the resource field is being compared against (e.g., the identifier of the resource the client is attempting to access). Consider clarifying this to ensure developers understand the binding target.

Suggested change:

  • Task and requirement binding: Merchant Agents MUST validate that the submitted PaymentPayload matches a PaymentRequirements option that was previously issued for the same taskId. If the accepted requirements include a resource field, the Merchant Agent MUST compare it exactly against the resource identifier being fulfilled before settlement. If the flow is embedded in a higher-level protocol, the implementation MUST also verify that the enclosing order or mandate identity matches the task being fulfilled.

Comment thread spec/v0.2/spec.md Outdated
Implementations that grant paid service results, mutate account state, or trigger downstream commerce workflows MUST bind payment verification to the exact task and paid resource being fulfilled:

* **Task and requirement binding**: Merchant Agents MUST validate that the submitted `PaymentPayload` matches a `PaymentRequirements` option that was previously issued for the same `taskId`. If the accepted requirements include a `resource` field, the Merchant Agent MUST compare it exactly before settlement. If the flow is embedded in a higher-level protocol, the implementation MUST also verify that the enclosing order or mandate identity matches the task being fulfilled.
* **Atomic claim before grant**: Merchant Agents MUST atomically record the accepted payment claim, such as the nonce, transaction authorization, or scheme-specific payment identifier, before returning paid artifacts or performing paid side effects. Duplicate submissions for an already claimed payment MUST NOT produce another paid result; implementations SHOULD return the existing receipt or fail with `DUPLICATE_NONCE`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This section describes idempotency. Explicitly mentioning that the implementation should be idempotent for a given payment claim would improve clarity for developers familiar with this pattern.

Suggested change:

  • Atomic claim before grant: Merchant Agents MUST atomically record the accepted payment claim, such as the nonce, transaction authorization, or scheme-specific payment identifier, before returning paid artifacts or performing paid side effects. To ensure idempotency, duplicate submissions for an already claimed payment MUST NOT produce another paid result; implementations SHOULD return the existing receipt or fail with DUPLICATE_NONCE.

@TateLyman

Copy link
Copy Markdown
Author

Addressed the review suggestions in 5587b6f: clarified what the resource field is compared against and made the duplicate-claim requirement explicitly idempotent. passes locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant