Pricing
Price a route in pay-kit Go — typed USD amounts, settlement assets, and fee splits on the Gate struct.
A paykit.Gate carries the price and the fee splits. The amount is a typed Price built with MustParseUSD (or the error-returning ParseUSD).
Amounts
import "github.com/solana-foundation/pay-kit/go/paykit"
paykit.MustParseUSD("0.10") // $0.10, default settlement (USDC)
paykit.MustParseUSD("0.10", paykit.USDC, paykit.USDT) // narrow/order the settlement assetsThe customer is quoted in USD; the settlement stablecoin (USDC, USDT, …) is what actually transfers. ParseUSD returns an error instead of panicking on a malformed amount.
The Gate struct
gate := paykit.Gate{
Amount: paykit.MustParseUSD("0.10"),
Desc: "Premium report",
Name: "report", // optional; identifies the gate in receipts
PayTo: "Ay…", // optional; defaults to the operator recipient
}Kind selects the settlement shape (GateFixed by default, or GateUsage — see Schemes).
Fees and splits
FeeWithin carves a fee out of the amount (the recipient nets less); FeeOnTop adds a surcharge on top (the customer pays more, the recipient nets full). Both route to a fee recipient address:
gate := paykit.Gate{
Amount: paykit.MustParseUSD("10.00"),
PayTo: paykit.Address("Ay…"), // seller
FeeWithin: paykit.Fees{paykit.Address("CX…"): paykit.MustParseUSD("0.30")}, // seller nets $9.70
}Fees is a map[paykit.Address]paykit.Price.
Fee-bearing gates require MPP (x402 exact is single-recipient), so an x402-only gate with fees returns ErrSchemeIncompatible at New time.