Skip to content

fix(paywall): read token name from payment requirements instead of hardcoding USDC#1973

Open
ryanRfox wants to merge 1 commit intox402-foundation:mainfrom
ryanRfox:fix/paywall-dynamic-token-name
Open

fix(paywall): read token name from payment requirements instead of hardcoding USDC#1973
ryanRfox wants to merge 1 commit intox402-foundation:mainfrom
ryanRfox:fix/paywall-dynamic-token-name

Conversation

@ryanRfox
Copy link
Copy Markdown
Contributor

@ryanRfox ryanRfox commented Apr 9, 2026

Description

The EVM paywall hardcodes "USDC" as the token label in all display text. The payment requirements already carry the token name in extra.name (populated from the default asset registry on the server side), but the paywall ignores it.

This means any non-USDC token — MegaUSD, USDT0, or any future default stablecoin — shows a misleading "USDC" label in the paywall UI.

Fixes #1972
Related: #1971

Changes

EvmPaywall.tsx:

  • Read tokenName from firstRequirement.extra.name
  • Fall back to "USDC" when extra.name is absent (backward compatible)
  • Update 5 user-facing display strings: payment header, testnet prompt, balance, amount row, error message

Generated templates: Regenerated Go, Python, and TS paywall templates via pnpm --filter @x402/paywall build:paywall.

1 source file changed, +8 -7 lines (plus regenerated templates).

Testing

  • All existing tests pass (pnpm test — 41/41 tasks)
  • Lint clean (pnpm lint:check)
  • Backward compatible: tokens without extra.name still display "USDC"

Checklist

  • Code formatted and linted (pnpm format && pnpm lint:check)
  • All new and existing tests pass (pnpm test)
  • Commits are signed
  • Changeset fragment added
  • Generated paywall templates rebuilt (pnpm --filter @x402/paywall build:paywall)

@github-actions github-actions bot added typescript go sdk Changes to core v2 packages python labels Apr 9, 2026
…rdcoding USDC

The EVM paywall hardcodes "USDC" as the token label in all display
text. The payment requirements already carry the token name in
extra.name (populated by the server from the default asset registry),
but the paywall ignores it.

Read extra.name from the first payment requirement and use it for
all user-facing token text. Falls back to "USDC" when extra.name
is absent (backward compatible with EIP-3009 tokens).

5 display strings updated:
- Header: "please pay $X {tokenName}" (was "USDC")
- Testnet prompt: "Need {tokenName} on {chainName}?" (was "USDC")
- Balance: "$X {tokenName}" (was "USDC")
- Amount row: "$X {tokenName}" (was "USDC")
- Error: "Make sure you have {tokenName} on {chainName}" (was "USDC")

Regenerated Go, Python, and TS paywall templates.
@ryanRfox ryanRfox force-pushed the fix/paywall-dynamic-token-name branch from bef12e1 to ea20eb4 Compare April 10, 2026 01:44
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 10, 2026

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

A member of the Team first needs to authorize it.

@phdargen
Copy link
Copy Markdown
Collaborator

Thanks for the fix @ryanRfox , please rebase and regenerate the templates to resolve merge conflicts

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 typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(paywall): EVM paywall hardcodes "USDC" label for all tokens

2 participants