pay.sh docs
SDKRust

Pricing

Price a route in solana-pay-kit — a fixed dollar string or a per-request closure. There is no catalogue type; each route names its own price inline.

Unlike a catalogue-based SDK, solana-pay-kit takes the price inline at the gate. paid_get / paid_post accept anything that converts into a Price: a &str (or String) for a fixed amount, or Price::dynamic for a per-request closure.

Fixed price

A dollar string converts straight into a price:

use solana_pay_kit::paid_get;

let app = Router::new()
    .route("/report", paid_get(report, "0.10", &pay))
    .route("/api/data", paid_get(api_data, "0.001", &pay));

Per-request price

Price::dynamic takes a closure that sees the request (method, URI, headers) and returns the dollar amount. The resolved amount is what the payment credential is pinned against, so dynamic pricing is replay-safe.

use solana_pay_kit::{paid_get, Price};

let app = Router::new().route(
    "/quote",
    paid_get(
        quote,
        Price::dynamic(|ctx| match ctx.query_param("tier").as_deref() {
            Some("premium") => "5.00".to_string(),
            _ => "0.10".to_string(),
        }),
        &pay,
    ),
);

The currency and decimals are set once on PayKitConfig (currency defaults to "USDC", decimals to 6); prices are quoted against them.

On this page