Skip to content

Commit 1d2d827

Browse files
[Paywall] Support string price format when tokenAddress is not provided
1 parent 3d235e2 commit 1d2d827

File tree

1 file changed

+3
-3
lines changed
  • apps/playground-web/src/app/api/paywall

1 file changed

+3
-3
lines changed

apps/playground-web/src/app/api/paywall/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export async function GET(request: NextRequest) {
4141

4242
const amount = queryParams.get("amount") || "0.01";
4343
const payTo = queryParams.get("payTo") ?? undefined;
44-
const tokenAddress = queryParams.get("tokenAddress") || token.address;
44+
const tokenAddress = queryParams.get("tokenAddress");
4545
const decimals = queryParams.get("decimals") || token.decimals.toString();
4646
const waitUntil =
4747
(queryParams.get("waitUntil") as "simulated" | "submitted" | "confirmed") ||
@@ -53,13 +53,13 @@ export async function GET(request: NextRequest) {
5353
paymentData,
5454
network: defineChain(Number(chainId)),
5555
payTo,
56-
price: {
56+
price: tokenAddress ? {
5757
amount: toUnits(amount, parseInt(decimals)).toString(),
5858
asset: {
5959
address: tokenAddress as `0x${string}`,
6060
decimals: decimals ? parseInt(decimals) : token.decimals,
6161
},
62-
},
62+
} : amount,
6363
routeConfig: {
6464
description: "Access to paid content",
6565
},

0 commit comments

Comments
 (0)