Skip to content

Default paywall price discrepency #55

Description

@jamesbachini

The default paywall that displays pricing seems to be a decimal out (see screenshot attached)

Image

I've isolated this down to the simplest possible implementation:

Code to reproduce

import express from "express";
import { paymentMiddlewareFromConfig } from "@x402/express";
import { HTTPFacilitatorClient } from "@x402/core/server";
import { ExactStellarScheme } from "@x402/stellar/exact/server";

const NETWORK = "stellar:testnet";
const FACILITATOR_URL = "https://www.x402.org/facilitator";
const PAY_TO = "G...YOURADDRESS...";
const app = express();

app.use(
  paymentMiddlewareFromConfig(
    {
      [`GET /my-service`]: {
        accepts: {
          scheme: "exact",
          price: "$0.51", // price in USDC
          network: NETWORK,
          payTo: PAY_TO,
        },
      },
    },
    new HTTPFacilitatorClient({ url: FACILITATOR_URL }),
    [{ network: NETWORK, server: new ExactStellarScheme() }],
  ),
);
app.get("/my-service", (_, res) => res.json({ secret: "valuable content" }));

app.listen(3003);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions