Skip to content

feat: add context field to AuthorizeResult for settlement passthrough#154

Merged
badjer merged 2 commits intomainfrom
feat/authorize-result-context
Apr 8, 2026
Merged

feat: add context field to AuthorizeResult for settlement passthrough#154
badjer merged 2 commits intomainfrom
feat/authorize-result-context

Conversation

@badjer
Copy link
Copy Markdown
Contributor

@badjer badjer commented Apr 8, 2026

Summary

  • Added optional context field to AuthorizeResult type for carrying settlement context (e.g., X402 paymentRequirements) from the authorize response to the settle step
  • Updated ATXPAccount.authorize() to pass through context from the /authorize/auto response
  • Clarified comment in ProtocolSettlement.buildRequestBody that X402 paymentRequirements come from context (MCP server: pricing config; LLM gateway: authorize response)

This enables services like the LLM gateway to pass X402 paymentRequirements from authorize to settle without bundling them into the credential, which must remain the raw payment header for HTTP retry headers.

Test plan

  • Verify existing X402 settlement tests still pass (MCP server flow where paymentRequirements come from pricing config)
  • Verify authorize → settle flow passes context through for LLM gateway use case
  • Confirm credential field remains unchanged (raw payment header, not modified by context addition)

🤖 Generated with Claude Code

badjer and others added 2 commits April 7, 2026 19:25
…sthrough

Enable services like the LLM gateway to pass X402 paymentRequirements from
the authorize step to the settle step without bundling them into the credential
(which must remain the raw payment header for HTTP retry headers).

- AuthorizeResult type: added optional `context` field
- ATXPAccount.authorize(): passes through `context` from /authorize/auto response
- ProtocolSettlement.buildRequestBody: clarified X402 paymentRequirements source

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ents

- Add test for context passthrough (returns context when present)
- Add test for context absence (undefined when not in response)
- Simplify spread: always include context (undefined won't serialize)
- Fix comment inconsistency: PAYMENT-SIGNATURE / X-PAYMENT (both valid)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@badjer badjer merged commit 7659c1f into main Apr 8, 2026
1 check passed
@badjer badjer deleted the feat/authorize-result-context branch April 8, 2026 16:26
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