-
Notifications
You must be signed in to change notification settings - Fork 139
docs: add production payment binding guidance #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
TateLyman
wants to merge
2
commits into
google-agentic-commerce:main
Choose a base branch
from
TateLyman:codex/a2a-x402-security-controls
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -479,6 +479,17 @@ If a payment fails, the server MUST set the x402.payment.status to payment-faile | |
| * **Replay Protection**: Servers MUST track used nonces to prevent replay attacks. | ||
| * **Transport Security**: All A2A communication MUST use a secure transport layer like HTTPS/TLS. | ||
|
|
||
| ### **10.1. Production Payment Binding Requirements** | ||
|
|
||
| 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`. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 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:
|
||
| * **Settlement and finality**: Merchant Agents MUST NOT set `x402.payment.status` to `"payment-completed"` or release final paid artifacts until the settlement response satisfies the implementation's finality policy. The `"payment-verified"` status MAY be used after signature verification but before settlement is final. | ||
| * **Receipt history**: `x402.payment.receipts` MUST append every settlement attempt, including failures, and MUST NOT replace earlier receipt entries for the same task. | ||
| * **Scheme field checks**: When the payment scheme or facilitator exposes payer, recipient, network, asset, amount, or resource fields, Merchant Agents MUST compare those values against the issued `PaymentRequirements` and reject mismatches before granting service. | ||
| * **HTTP transport handling**: Implementations that expose A2A payment messages over HTTP SHOULD mark payment-required and paid-task responses with cache controls such as `Cache-Control: no-store, private`. Gateways and middleware MUST reject ambiguous duplicate payment metadata or payment headers instead of silently choosing one. | ||
|
|
||
| ## **11\. References** | ||
|
|
||
| * [**A2A Protocol Specification**](https://a2a-protocol.org/latest/specification) | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The requirement to "compare it exactly" is slightly ambiguous. It should specify what the
resourcefield 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:
PaymentPayloadmatches aPaymentRequirementsoption that was previously issued for the sametaskId. If the accepted requirements include aresourcefield, 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.