HTTP 402 Payment Required response body builder for payment APIs
// Source: https://github.com/qntx/r402 | License: Apache-2.0 | Copyright 2025 qntx
// Provided via justclaw.it.com; keep this notice with the code.
//! HTTP 402 `Payment Required` body.
use compact_str::CompactString;
use serde::{Deserialize, Serialize};
use super::{Extensions, PaymentRequirements, ResourceInfo, V2, Version2};
/// Body of an HTTP 402 Payment Required response.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
#[non_exhaustive]
pub struct PaymentRequired {
/// Protocol version (always `2`).
pub x402_version: Version2,
/// Optional error message describing why the request was rejected.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub error: Option<CompactString>,
/// Re
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key