diff --git a/go/http/evm_paywall_template.go b/go/http/evm_paywall_template.go index 1f03ef1070..83867a322e 100644 --- a/go/http/evm_paywall_template.go +++ b/go/http/evm_paywall_template.go @@ -2,4 +2,4 @@ package http // EVMPaywallTemplate is the pre-built EVM paywall template with inlined CSS and JS -const EVMPaywallTemplate = "\n \n \n Payment Required\n \n
\n \n \n " +const EVMPaywallTemplate = "\n \n \n Payment Required\n \n
\n \n \n " diff --git a/go/http/svm_paywall_template.go b/go/http/svm_paywall_template.go index 1ca1b8e095..dd586b94ee 100644 --- a/go/http/svm_paywall_template.go +++ b/go/http/svm_paywall_template.go @@ -2,4 +2,4 @@ package http // SVMPaywallTemplate is the pre-built SVM paywall template with inlined CSS and JS -const SVMPaywallTemplate = "\n \n \n Payment Required\n \n
\n \n \n " +const SVMPaywallTemplate = "\n \n \n Payment Required\n \n
\n \n \n " diff --git a/python/x402/http/paywall/evm_paywall_template.py b/python/x402/http/paywall/evm_paywall_template.py index cb301fe539..d39b605ad5 100644 --- a/python/x402/http/paywall/evm_paywall_template.py +++ b/python/x402/http/paywall/evm_paywall_template.py @@ -1,2 +1,2 @@ # THIS FILE IS AUTO-GENERATED - DO NOT EDIT -EVM_PAYWALL_TEMPLATE = '\n \n \n Payment Required\n \n
\n \n \n ' +EVM_PAYWALL_TEMPLATE = '\n \n \n Payment Required\n \n
\n \n \n ' diff --git a/python/x402/http/paywall/svm_paywall_template.py b/python/x402/http/paywall/svm_paywall_template.py index de853d5bf5..f1d95458ad 100644 --- a/python/x402/http/paywall/svm_paywall_template.py +++ b/python/x402/http/paywall/svm_paywall_template.py @@ -1,2 +1,2 @@ # THIS FILE IS AUTO-GENERATED - DO NOT EDIT -SVM_PAYWALL_TEMPLATE = '\n \n \n Payment Required\n \n
\n \n \n ' +SVM_PAYWALL_TEMPLATE = '\n \n \n Payment Required\n \n
\n \n \n ' diff --git a/typescript/.changeset/fix-paywall-token-name.md b/typescript/.changeset/fix-paywall-token-name.md new file mode 100644 index 0000000000..8c478a4ef6 --- /dev/null +++ b/typescript/.changeset/fix-paywall-token-name.md @@ -0,0 +1,10 @@ +--- +"@x402/paywall": patch +--- + +fix(paywall): read token name from payment requirements instead of hardcoding "USDC" + +The EVM paywall now reads the token name from `extra.name` in payment requirements +and uses it for all display text. Falls back to "Token" (generic) when `extra.name` +is absent. This fixes mislabeled token names for non-USDC chains (MegaUSD, USDT0, +Mezo USD, etc.). diff --git a/typescript/packages/http/paywall/src/evm/EvmPaywall.tsx b/typescript/packages/http/paywall/src/evm/EvmPaywall.tsx index b28c130093..81dc062566 100644 --- a/typescript/packages/http/paywall/src/evm/EvmPaywall.tsx +++ b/typescript/packages/http/paywall/src/evm/EvmPaywall.tsx @@ -49,6 +49,7 @@ export function EvmPaywall({ paymentRequired, onSuccessfulResponse }: EvmPaywall } const network = firstRequirement.network; + const tokenName = (firstRequirement.extra?.name as string) || "Token"; const chainName = getNetworkDisplayName(network); const testnet = isTestnetNetwork(network); @@ -138,11 +139,11 @@ export function EvmPaywall({ paymentRequired, onSuccessfulResponse }: EvmPaywall setIsPaying(true); try { - setStatus("Checking USDC balance..."); + setStatus("Checking balance..."); const balance = await getUSDCBalance(publicClient, address); if (balance === 0n) { - throw new Error(`Insufficient balance. Make sure you have USDC on ${chainName}`); + throw new Error(`Insufficient balance. Make sure you have ${tokenName} on ${chainName}`); } setStatus("Creating payment signature..."); @@ -196,11 +197,11 @@ export function EvmPaywall({ paymentRequired, onSuccessfulResponse }: EvmPaywall

Payment Required

{paymentRequired.resource?.description && `${paymentRequired.resource.description}.`} To - access this content, please pay ${amount} {chainName} USDC. + access this content, please pay ${amount} {tokenName}.

{testnet && (

- Need {chainName} USDC?{" "} + Need {tokenName} on {chainName}?{" "} Get some here. @@ -259,14 +260,16 @@ export function EvmPaywall({ paymentRequired, onSuccessfulResponse }: EvmPaywall

Amount: - ${amount} USDC + + ${amount} {tokenName} +
Network: diff --git a/typescript/packages/http/paywall/src/evm/gen/template.ts b/typescript/packages/http/paywall/src/evm/gen/template.ts index 3020163e83..73ce58d52c 100644 --- a/typescript/packages/http/paywall/src/evm/gen/template.ts +++ b/typescript/packages/http/paywall/src/evm/gen/template.ts @@ -3,4 +3,4 @@ * The pre-built EVM paywall template with inlined CSS and JS */ export const EVM_PAYWALL_TEMPLATE = - '\n \n \n Payment Required\n \n
\n \n \n '; + '\n \n \n Payment Required\n \n
\n \n \n '; diff --git a/typescript/packages/http/paywall/src/svm/gen/template.ts b/typescript/packages/http/paywall/src/svm/gen/template.ts index 3daad69d9d..a6e7bd39b0 100644 --- a/typescript/packages/http/paywall/src/svm/gen/template.ts +++ b/typescript/packages/http/paywall/src/svm/gen/template.ts @@ -3,4 +3,4 @@ * The pre-built SVM paywall template with inlined CSS and JS */ export const SVM_PAYWALL_TEMPLATE = - '\n \n \n Payment Required\n \n
\n \n \n '; + '\n \n \n Payment Required\n \n
\n \n \n ';