Skip to content

feat: add service metadata on resource to all 3 SDKs#2200

Merged
CarsonRoscoe merged 9 commits intox402-foundation:mainfrom
aayushijain21:mux/x402-claude-monfn7o3
May 6, 2026
Merged

feat: add service metadata on resource to all 3 SDKs#2200
CarsonRoscoe merged 9 commits intox402-foundation:mainfrom
aayushijain21:mux/x402-claude-monfn7o3

Conversation

@aayushijain21
Copy link
Copy Markdown
Contributor

Description

Adds three optional service-metadata fields — serviceName, tags, iconUrl — to the top-level resource object on a PaymentRequired response, and formalizes them in the bazaar extension spec. Facilitators use these to enrich Bazaar search results with a provider-published name, topical tags, and an icon, with no admin step.

The CDP facilitator will parse these fields defensively from 402 responses. This PR formalizes the convention upstream so all three SDKs and the foundation spec agree on the shape and validation rules.

All changes are purely additive and backwards compatible:

  • New fields are optional in TS / Python / Go (?:, | None = None, omitempty); existing servers produce byte-identical 402 bodies.
  • New helpers and types are new exports — no existing function signature, field, or test was changed or removed.
  • Spec change is a new section; existing tables and examples are untouched apart from one example gaining the three new keys.

Tests

New tests in each SDK cover the helpers (boundaries at 32/33 chars, tag truncation, data: / file: / javascript: / ftp: schemes, userinfo, IPv4 and IPv6 literals including [::1] and [2001:db8::1], mixed-case localhost, control characters \x00 / \n / \x7f, relative paths) plus end-to-end extraction cases for the all-valid path and the all-invalid soft-drop path.

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits
  • I added a changelog fragment for user-facing changes (docs-only changes can skip)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

@aayushijain21 is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added specs Spec changes or additions typescript go sdk Changes to core v2 packages python labels May 5, 2026
Copy link
Copy Markdown
Contributor

@CarsonRoscoe CarsonRoscoe left a comment

Choose a reason for hiding this comment

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

Please update the x402-specification-v2.md file:

  1. The **5.1 PaymentRequired Schema** section's json example to include these fields (lines 74-99)
  2. The ResourceInfo table (lines 125-133) to include these new fields as optional at the spec level

@CarsonRoscoe CarsonRoscoe merged commit 608034f into x402-foundation:main May 6, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go python sdk Changes to core v2 packages specs Spec changes or additions typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants